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

jdbc connection in main method  RSS feed

 
shivam aggarwal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 55681
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You ought not to have a connection in the main method. Use the main method to start the application and nothing else.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!