This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes MySQL DataBase Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "MySQL DataBase " Watch "MySQL DataBase " New topic
Author

MySQL DataBase

Rajesh Rami Reddy
Greenhorn

Joined: Mar 04, 2008
Posts: 5
Hello friends,
I had wrote a programe for establish a connection MySql database using JDBC. My Programming code is



When i was run this programme it is displaying as


Copyright 2004, R.G.Baldwin
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at JdbcConnection.main(JdbcConnection.java:11)
Cannot connect to database server

I am setting the CLASS PATH is "C:\Program Files\Java\jdk1.5.0\jre\lib\MYSQL.jar;C:\Program Files\Java\jdk1.5.0\jre\lib\mysql-connector-java-5.0.8-bin.jar;"

Could you know where i did a mistake. Please tell me.
[ March 04, 2008: Message edited by: Ulf Dittmer ]
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
Dows it work if you add the jar file on the command line, like


[ March 04, 2008: Message edited by: Ulf Dittmer ]
Rajesh Rami Reddy
Greenhorn

Joined: Mar 04, 2008
Posts: 5
Thank you Sir.
Now Jdbc Connection is established and perform the Transactions only sample programs.
I am also setting the classpath as you suggested previously in the Environment Variables.
What is the difference bitween setting the class path as command prompt and environment variables in Mycomputer properties in windows mode.

i had never expect raise this type of problams.

Once again Thank you very much.

could you know how to establish a connection pool in tomcat server using hibernate and spring frameworks. The database is Sql Server 2000.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
could you know how to establish a connection pool in tomcat server using hibernate and spring frameworks.

Hibernate can do that using the C3PO pool implementation. Shouldn't take more than the appropriate entries in the hibernate.properties file. See this for further information.
[ March 05, 2008: Message edited by: Ulf Dittmer ]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: MySQL DataBase
 
It's not a secret anymore!