wood burning stoves
The moose likes IDEs, Version Control and other tools and the fly likes JDBC would'nt connect to mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "JDBC would Watch "JDBC would New topic

JDBC would'nt connect to mysql

Vasanthan Dharmar

Joined: Jun 30, 2005
Posts: 2
I have been trying to connect to MYSQl database. Just learning JDBC and this is my first sample program.I use netbeans IDE. I also tried executing it from the command prompt and still i get hte same error.

Compiles fine but throws up this error

Exception in thread "main" java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)

I searched the web and came across few solutions

1) Checked the class pathlike 100 times.
2)Used mysql-connector-java-bin-3.1.8 instead of mysql-connector-java-bin-3.1.8-g
3)unzipped the aspectjrt.jar file and set included that directory to the class path.

Still doesnt seem to work!
Got suggestions to help me out?

[ July 01, 2005: Message edited by: Bear Bibeault ]

[Jeanne added code tags]
[ July 02, 2005: Message edited by: Jeanne Boyarsky ]
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211


It definately looks like a classpath issue.
But, if you are just learning JDBC, I suggest you not mix it up with any Aspect J stuff. That will narrow down the code that you need to check to find the cause of error.

The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
Vasanthan Dharmar

Joined: Jun 30, 2005
Posts: 2
Yep, I do take it as my fault. I use netbeans ide.

I have set up the class path My libray. When i expand the my library icon. I do see the org.aspectj.lang.signature class file. This library is also included the project.

So basically stumped.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33124

Welcome to JavaRanch!

Since this looks like a question about using Netbeans with AspectJ, I'm moving this to our IDEs forum.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Matan Mazursky

Joined: Jul 11, 2005
Posts: 9
haha, netbeans JDBC
I struggled with this for a while myself.
here's my code:
import java.sql.*;
public void connect() throws Exception
conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=root&password=m1a2t3a4n5");

This works after having added to libraries the appropriate JAR, who's name is: mysql-connector-java-3.1.10-bin.jar

Tell me if you need that JAR.
I agree. Here's the link: http://aspose.com/file-tools
subject: JDBC would'nt connect to mysql
It's not a secret anymore!