This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Running jdbc methods from my application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Running jdbc methods from my application" Watch "Running jdbc methods from my application" New topic
Author

Running jdbc methods from my application

Jacob Hoda
Greenhorn

Joined: Apr 09, 2004
Posts: 6
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running jdbc methods from my application
 
Similar Threads
How to do JNDI lookup?
Excelsheet content reading
database-access JavaBean - thread safety
JDBC application running very slow
CachedRowSet JavaApp-Servlet