Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Running jdbc methods from my application  RSS feed

 
Jacob Hoda
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jdbc.class which executes queries etc.

I also have an application class.

When the app runs I'd like to to execute some methods in the jdbc to perform queries, how do I go about doing this?

I know how to call methods but I have to pass the connection paramter which has not been setup in my applicatoin class.

Thanks,
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37222
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jacob,
I would recommend having a separate class that handles creating the connection. Then your class containing the JDBC can call it and you don't need to pass the connection around all over.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!