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  jdbc connection in main method 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 " jdbc connection in main method" Watch " jdbc connection in main method" New topic
Author

jdbc connection in main method

shivam aggarwal
Greenhorn

Joined: Oct 15, 2009
Posts: 8
is it mandatory to make jdbc connection in main method;i tried to use it in event handling method of a button and it gives no response and no errors
samir singha
Greenhorn

Joined: Mar 17, 2008
Posts: 23
Not at all. You should make a separate Connection class for JDBC. Did your code in event handling method includes any output statement??
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38025
    
  22
You ought not to have a connection in the main method. Use the main method to start the application and nothing else.
 
wood burning stoves
 
subject: jdbc connection in main method
 
Similar Threads
JDBC Connection Interface
Hibernate static SessionFactory
id of the new field in my table
Validating user/password for database connection
VAJ Oracle connection problem