Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Handling Database Connction  RSS feed

 
MI Mohammed
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Complements to all ranchers.
I am presently working on my personal project,
I am using mysql db, am surpose to retrive and
submit data to the db. I created a connect class
that handle all the db connection. But i feel the design
isn't the best. So what is the best way of handling db look ups.
(as in the indutrial standard without much over head on resource.
Thanks.

SCJA SCJP SCWCD
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your best bet is container-managed connection pooling.
 
naras pai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about letting the Container do the Work- the connect class u made for handling queries/updates etc. - are u using jdbc stuff? How about, again, as I sed- use a jndi lookup and utilize existing connection pooling facility offered by the container??
Also, for my Info.- are u maintaining separate classes for different databases(Oracle, MySQL etc. ) in case of a future switch over to another DBMS? Anyone else care to answer this also- I'll be grateful..How do u handle such issues??
And finally,Forgive the greenhorn (Me) for any trespasses he commits..

My first Post
Thnx lotss,
Leo


Originally posted by mi Mohammed:
Hi,

Complements to all ranchers.
I am presently working on my personal project,
I am using mysql db, am surpose to retrive and
submit data to the db. I created a connect class
that handle all the db connection. But i feel the design
isn't the best. So what is the best way of handling db look ups.
(as in the indutrial standard without much over head on resource.
Thanks.

SCJA SCJP SCWCD
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"naraspai",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by naraspai:
Are u maintaining separate classes for different databases(Oracle, MySQL etc. ) in case of a future switch over to another DBMS? Anyone else care to answer this also- I'll be grateful..How do u handle such issues??


Use standard queries. Avoid doing database specific stuff.
You can also go for CMP or some ORM Tool.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!