Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC beginner doubt  RSS feed

 
Manoj Zachariah
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jdbc
i use two classes. in one class i create a datasource object and open a connection.
in the other class i want to run a query using the open connection.

will the conn object in query class be able to run the query based on the connection opened by con in the DBManager class
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should, as long as your DBConnection class returns a connection object. As it is now, it's not. Hav this method "getDBConnection()" in your DBConnection class return a connection object. It should not even compile the way you have it now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!