Hi, can someone help me with the problem Im having. I dont know how to do a class that takes care of creating database connection. For example if db changes I have to do changes only in one place instead all the places where I created connection. Please help?
My advise is that you use connection pooling. for instance, www.javaexchange.com. And yes, it is for free. with javaexchange you specify in a single servlet the database you are going to use, minimum number of connections, maximum number of connection, etc. in other words, it acts as a broker. You just make use of the connection and free them when you are done. in this way if you change your database you only change the database name and the driver (if you need to change it) in a single place. cheers
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Joined: May 16, 2002
Thanks Andres, but if I understand correctly I need to have a server to run servlet? I guess what I need is some sort of class doing
and whenever I need to have a connection it is created like
but that doesnt work :/ [ June 16, 2002: Message edited by: Martin Schneider ]
Joined: Nov 27, 2001
hhhmm... I did not quite understand what you meant Martin. The code you posted is done internally by the class you download from javaexchange.
but if I understand correctly I need to have a server to run servlet?
I use Forte for java, but you can also use tomcat, if this is your question... I do not have the code here in this PC, but if you requiere so more in-depth example let me know. cheers