JDBC mysql

Hi

I am new to Java and I want to ask while creating a website or any of the project i want to setup the connection only once. I mean connection should be made in only one class and to be provided to all the classes and need not to be made in all classes. How can i do that?

Regards and thanks

Shaveta

[328 byte] By [divinea] at [2007-11-27 10:19:42]
# 1

This is probably not a good idea , especially if there is going to some sort of lag (time difference) between hits on the database. If you are going to do it then just like everything else, pass the connection as a parameter.

floundera at 2007-7-28 16:59:17 > top of Java-index,Java Essentials,New To Java...
# 2

If you are using tomcat as the deployment server for your website, you can use the connection pooling provided by Jakarta Commons DBCP libraries.

Refer to this link

http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Brucesworda at 2007-7-28 16:59:17 > top of Java-index,Java Essentials,New To Java...