A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
jdbc connection in main method
shivam aggarwal
Greenhorn
Joined: Oct 15, 2009
Posts: 8
posted
Oct 15, 2009 08:40:40
0
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
posted
Oct 15, 2009 08:59:22
0
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: 32599
4
posted
Oct 15, 2009 09:54:08
0
You ought not to have a connection in the main method. Use the main method to start the application and nothing else.
I agree. Here's the link:
http://zeroturnaround.com/jrebel/download
subject: jdbc connection in main method
Similar Threads
Hibernate static SessionFactory
id of the new field in my table
VAJ Oracle connection problem
JDBC Connection Interface
Validating user/password for database connection
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter