Thread: Java & MySQL

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Belgium
    Posts
    39
    Rep Power
    13

    Java & MySQL


    I know I got to d/l a driver (and I hev it )

    I downloaded it from www.mysql.com
    but I just kant figure it out how to install it....

    I have to put a jar-file somewhere but I dont know why...


    -----------------------------------------------------------------------------------

    can you compile java into a *.exe? (or executable file unter llinux)
    I use Borlands Jbuilder

    thx in advance
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    You have to put the .jar file into your classpath. Look at your help files, they'll tell you how to do that.

    To execute a java program, you'd do something like:

    java myClass

    where myClass is a class file: "myClass.class".
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Belgium
    Posts
    39
    Rep Power
    13
    Either copy the "com" and "org" subdirectories and all of their contents
    to anywhere you like, and put the directory holding the "com" and "org"
    subdirectories in your classpath, or...

    Put mysql-connector-j-2.0.14-bin.jar in your classpath, either by adding the
    FULL path to it to your CLASSPATH enviornment variable, or putting it
    in $JAVA_HOME/jre/lib/ext.


    ----> but what is the class_path???

    -----------------------------------
    The class path is used during compiling. This path is constructed from all of the following:
    The output path
    The class path for each library listed on the Paths page of the Project Properties dialog box (in the same order in which they are listed)
    The target JDK version selected on the Paths page of the Project Properties dialog box

    The complete class path is composed of these elements in this order: output path + library class paths (in the order libraries are listed in the Project Properties dialog box) + target JDK version

    For example, the complete class path for Lion.class is: /<home>/<username>/jbproject/SampleProject/classes:
    /user/jbuilder/lib/dbswing3.1.jar:/user/jdk1.3/bin
    The class path is displayed on the Build tab after you compile.

    ------------------------------------
    so this means that I have to install de driver seperatly for all applications? and the driver is compiled into the application itself?

    I am a complete Java n00b

    thanx in advance
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Belgium
    Posts
    39
    Rep Power
    13
    Found The Solution

    coppied the mysql-connector-java-2.0.14-bin.jar -file into jbuilders

    lib directory (youcan place it anywhere U like)

    In Jbuilder
    Tools> Enterprise Setup
    select Database Drivers
    Add...
    ->new...
    unter Library paths click add.. and select the mysql-connector-java-2.0.14-bin.jar

    and you're set

    (you can use the database pilot to test it)
  8. #5
  9. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Ya, the class path is used both during compilation and during execution.

    Basically, it's a list of locations to look for extra classes, like an include path in php or header files in C.

    You can control the classpath each time you run the compiler or java executable, or you can set an environment variable with your own default classpath, or (like you found out) your ide has a few directories that are already in its own classpath.

    Oh, and classpaths can contain more than one directory, so you're not limited to putting all your classes in the same place.
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Belgium
    Posts
    39
    Rep Power
    13
    but where can you find it .... is it held in a environment variable, ini,jar..... whatever...
  12. #7
  13. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Often it's an environment variable, but it's also often passed to the java/javac executable as a command line parameter. To find what parameter is being passed, you'll have to look through the options/documentation for your IDE.

IMN logo majestic logo threadwatch logo seochat tools logo