Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Help regarding JDBC Driver(Using the mysql-connector-java-5.1.22 with Juno giving Class Not Found error.)
Help regarding JDBC Driver [message #986014] Sat, 17 November 2012 13:47 Go to next message
Praveen Raj is currently offline Praveen RajFriend
Messages: 2
Registered: November 2012
Junior Member
I use <b>windows 7 x64<b>.

I downloaded and installed these latest version softwares and installed them using environment variables and other proceedures:
<b>jdk7u9(64 bit)</b>
<b>MySQL Server 5.5(64 bit)</b>
<b>Apache 7.0.32</b>
<b>Eclipse 4.2 Juno(64 bit)</b>
and <b>mysql-connector-java-5.1.22.zip</b>

The jdk, eclipse and apache had been integrated. I had them tested. MySQL also works fine on itself. I accessed it using the command prompt.
But could'nt use the 'com.mysql.jdbc.Driver' within, neither my java application program nor my jsp program. These programs were tested successfully on another machine. So the codes are correct.
I'm affraid it is some version incompatibility between these...

The java application was just to insert a value into the database:

<b>import java.sql.*;
public class dbtest
{
public static void main(String[] args)
{
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/student201","student201","tester201");
Statement st=con.createStatement();
st.executeUpdate("Insert into LoginRegister values('jhgjh','gfhj','jhf',2)");
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}</b>

The error report and the complete stack at the time of error was...

<b>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
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.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at dbtest.main(dbtest.java:7)</b>

Please Help!! Sad
Re: Help regarding JDBC Driver [message #986026 is a reply to message #986014] Sat, 17 November 2012 17:32 Go to previous messageGo to next message
Praveen Raj is currently offline Praveen RajFriend
Messages: 2
Registered: November 2012
Junior Member
There had been an improvement... the jdbc driver just worked for the application I mentioned above, by explicitly describing the location of the 'docs' and 'src' folder in the driver defenition. <b>But is still not in terms with the jsp project.</b> I get the same error.
Re: Help regarding JDBC Driver [message #986039 is a reply to message #986026] Sat, 17 November 2012 19:41 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 11/17/2012 10:32 AM, Praveen Raj wrote:
> There had been an improvement... the jdbc driver just worked for the
> application I mentioned above, by explicitly describing the location of
> the 'docs' and 'src' folder in the driver defenition. <b>But is still
> not in terms with the jsp project.</b> I get the same error.
>

The JDBC connector (JAR) must be in on the classpath (use Build Path).
icon9.gif  Re: Help regarding JDBC Driver [message #1180330 is a reply to message #986026] Sun, 10 November 2013 23:18 Go to previous message
raji m is currently offline raji mFriend
Messages: 1
Registered: November 2013
Junior Member
hi praveen,

please could you explain me in detail what you did to fix this error as i did add the jar file to the buildpath and the simplest standalone java application to connect to mysql database still doesnt work , whereas it does work in comandprompt when i write the same code in a notepad and run it ...

Previous Topic:How to change my user name?
Next Topic:Compute SWT widget size according to Windows DPI
Goto Forum:
  


Current Time: Thu Apr 25 04:35:21 GMT 2024

Powered by FUDForum. Page generated in 0.08300 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top