facebook

mysql & myeclipse

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #244009 Reply

    jonknutson
    Member

    I see a number of references to this topic but after trying some of the resolutions still have the same problem. I am getting an error
    No suitable driver
    SQLState: 08001
    VendorError: 0
    When trying to test my jdbc connector setup.
    I have set my environment path to include the jar file: mysql-connector-java-3.1.10-bin.jar
    I have also added the same jar file to my java build path in MyEclipse.
    In addition I added that same jar file to the drivers in MyEclipse Database Explorer.

    This is the code I am running:
    package com.mysql;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;

    public class TestConnection {

    public TestConnection() {
    super();
    String url = “jdbc:mysql://localhost:3306/mysql”;
    try {
    Connection conn = DriverManager.getConnection(url, “root”, “system”);
    System.out.println(“url: ” + url);
    System.out.println(“conn: ” + conn);
    conn.close();

    } catch (SQLException ex) {
    System.out.println(“SQLException: ” + ex.getMessage());
    System.out.println(“SQLState: ” + ex.getSQLState());
    System.out.println(“VendorError: ” + ex.getErrorCode());
    }
    }

    But I am assuming I’m still missing something in the setup, just can’t figure out where.
    Any help is greatly appreciated.

    #244013 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    You need to register the driver with a call to Class.forName, this should be in the Connector/J docs. Then when you do getConnection the DriverManager will be able to find the Connector/J driver and use it. This isn’t a ME issue, that’s why I’m moving it.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: mysql & myeclipse

You must be logged in to post in the forum log in