views:

400

answers:

3

I'M NOT ASKING ABOUT THE CODE. I just want to know what are and all the steps involved in the connection other than coding. I'm using j2sdk1.4.0 and MySQL Server 4.1. Am very new to this area.

Thanks in advance

A: 

Hi, I maybe my advice will not be as useful as that from Vinegar, but to keep it simple you can always do it like this:

  1. First download the'mysql-connector-java.jar' -- I suppose you already have this -- if you're in Linux a yum install mysql-connector-java will suffice.
  2. Compile your code normally
  3. Now when you need to run your app do something like this on the command line:

    java -classpath .:“/someplace in your computer/mysql-connector-java.jar” your app

I hope this can help you get started. Good luck!

wallyqs
A: 

Im sorry Vinegar and Wallyqs both the answers doesn't help me. Actually am using mysql-connector-java-3.0.17-ga and I can understand the problem is with the connection. When I try to execute my program it throws an error NoClassFoundException: com.mysql.jdbc.Driver.

I do not mean to be rude but, did you actually tried it the way I told you? I think it should have worked. It's a classpath thing. Anyway happy coding!
wallyqs
Oh got it, you're using JSP. Yeah modify the classpath.
wallyqs
A: 

If your code cannot find the class, then that's always going to be an issue with your classpath (and this isn't specific to JDBC in any way). Make sure you have the MySQL JDBC JAR on your classpath at runtime (it's probably called mysql-connector-java-3.0.17-ga.jar; if you have an IDE, it can probably tell you where the class in question lives).

Andrzej Doyle