Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes MySQL DataBase Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
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
Marshal

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


[ March 04, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
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
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
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 ]
 
jQuery in Action, 2nd edition
 
subject: MySQL DataBase
 
Similar Threads
mySQL driver problem jvm WindowsXP, tried everything!! - please help!!!
Unable to connect MYSQL :(
not able to connect to the database
MySQL Connector/J
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver