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 08:47 Go to next message
Praveen Raj is currently offline Praveen Raj
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 12:32 Go to previous messageGo to next message
Praveen Raj is currently offline Praveen Raj
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 14:41 Go to previous message
Russell Bateman is currently offline Russell Bateman
Messages: 2711
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).
Previous Topic:update error
Next Topic:Updates and plugin installs are impossible
Goto Forum:
  


Current Time: Sun May 26 00:33:09 EDT 2013

Powered by FUDForum. Page generated in 0.01603 seconds