Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySQL DataBase

 
Rajesh Rami Reddy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic