• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please help me with one connection multiple jdbc queries.

 
Sumit RawalArora
Greenhorn
Posts: 22
  • 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
Bartender
Posts: 11445
18
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: 531
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.
 
I am Arthur, King of the Britons. And this is a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!