Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help me with one connection multiple jdbc queries.

 
Sumit Gautam
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I neeed to setup a JDBC connection with one connection multiple jdbc queries
 
Maneesh Godbole
Saloon Keeper
Posts: 11331
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This FAQ page contains lot of information which might help
https://coderanch.com/wiki/660162/General-Jdbc-Questions

In the meanwhile I will add your topic to the JDBC forum
 
Enthu Tarun Singh
Greenhorn
Posts: 3
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to create a utility class for JDBC Connection. Inside this utility class write a static method which returns JDBC connection object. This way any class can access the connection object. Moreover inside your method do not create connection object if it is not null. Please let me know you need any further help.
 
Anton Golovin
Ranch Hand
Posts: 527
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sumit Gautam wrote:I neeed to setup a JDBC connection with one connection multiple jdbc queries


Hi, Sumit,

It's called connection pool and there are a few good implementations, look online. (Java connection pool as the search string).

Probably not a good idea to roll your own because synchronization issues and also transaction issues (such as local or JTA transactions, etc.)

With best regards,

Anton.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic