Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java.jar and Mysql.jar

  1. #1
    Join Date
    Nov 2010
    Thanked 0 Times in 0 Posts

    Default Java.jar and Mysql.jar

    Hi all

    Right I currently have a two servers, one holding a database, and one with files stored.
    I have created a file which gets all the files stored on the second and inserts it into the database.
    Using the IP address of the first to tell the system that this is the host.

               url = "jdbc:mysql://" + database;
               conn = DriverManager.getConnection(url, user, password);

    When i try and run this, the server cannot locate the mysql driver.
    with netbean i selected the option to create a jar with specified libs included.

    I have also tried adding the driver to the java/lib folder on the second server and this didnt work.

    My question is, Is there a way i can point explicitly, to the mysql driver file from the java class?
    or combine the Jar files together so they work with each other.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default Re: Java.jar and Mysql.jar

    You need to place the jar on your classpath. If you package the jar's together, you need to make sure the manifest file reflects the class path (see Modifying the Manifest). Otherwise, your server may have a default directory to place jar's that, once in that directory are inherently on the classpath.

Similar Threads

  1. [SOLVED] i cant make a java jar file which can search data from mysql
    By talha07 in forum JDBC & Databases
    Replies: 6
    Last Post: January 20th, 2011, 06:09 AM
  2. Java Applet and MySQL
    By Terillius in forum JDBC & Databases
    Replies: 4
    Last Post: August 21st, 2010, 10:05 PM
  3. MySQL Database
    By pjeremy90 in forum Java Theory & Questions
    Replies: 2
    Last Post: June 12th, 2010, 10:34 AM
  4. Connectivity problem:MySQL and Java
    By Pragya in forum JDBC & Databases
    Replies: 2
    Last Post: January 22nd, 2010, 03:58 AM
  5. Use of Unicode 5.1 in MySQL DB with Java
    By Desert Fox in forum JDBC & Databases
    Replies: 2
    Last Post: November 12th, 2008, 08:29 AM