Thread: JDBC & mysql

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

    Join Date
    May 2001
    Location
    Belgium
    Posts
    39
    Rep Power
    14

    JDBC & mysql


    error message I get
    Error connecting to database!
    ClassNotFoundException throws:com.mysql.jdbc.Driver
    source:
    PHP Code:
    try{
                            Class.
    forName("com.mysql.jdbc.Driver");
                            
    this.conDB DriverManager.getConnection(this.strUrl);
                    }catch(
    ClassNotFoundException e){
                            
    System.out.println("Error connecting to database!\n\tClassNotFoundException throws:" e.getMessage());
                    }catch(
    SQLException e){
                            
    System.out.println("Error connecting to database!\n\tSQLException throws:" e.getMessage());
                    } 
    Last edited by H@voc_!nc.; November 28th, 2002 at 01:54 PM.
    With Your Hand On A Hot Stove, Fifteen Seconds Can Seem Like Fifteen Minutes. Fifteen Minutes Can Seem Fifteen Seconds When You Are With A Beautiful Woman. That's The Theory Of Relativity

    -- Albert Einstein \\
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Belgium
    Posts
    39
    Rep Power
    14
    It is (has been) solved

    When Using Jbuilder (like I do)
    Project Properties > paths >requires libraries
    add.. --> mysql-driver

    (I reckon java -cp /path/to/driver.jar should work fine 2 not shure about this!!)

    I am getting there
    With Your Hand On A Hot Stove, Fifteen Seconds Can Seem Like Fifteen Minutes. Fifteen Minutes Can Seem Fifteen Seconds When You Are With A Beautiful Woman. That's The Theory Of Relativity

    -- Albert Einstein \\
  4. #3
  5. dont click here
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Posts
    409
    Rep Power
    13
    Originally posted by H@voc_!nc.
    It is (has been) solved


    (I reckon java -cp /path/to/driver.jar should work fine 2 not shure about this!!)

    I am getting there

    that will work. Another option is to put the jar file in the same folder as the class files.. a cheap way of gettin around it but it works.

    I do this when im programming at school and my source has to mve from one machine to another w/o JBuilder.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Belgium
    Posts
    39
    Rep Power
    14
    did that 2 now
    With Your Hand On A Hot Stove, Fifteen Seconds Can Seem Like Fifteen Minutes. Fifteen Minutes Can Seem Fifteen Seconds When You Are With A Beautiful Woman. That's The Theory Of Relativity

    -- Albert Einstein \\

IMN logo majestic logo threadwatch logo seochat tools logo