1 Reply Latest reply: Oct 27, 2010 3:11 AM by 793415 RSS

    Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc

    807922
      Hi
      I'm having problem with this simple code , connecting to a mysql database on an linux server on the same LAN
      The error I'm receiving is:

      Exception in thread "main" java.lang.ClassNotFoundException: com.mysql.jdbc

      and this is the code:
      Please help



      import java.sql.Connection;
      import java.sql.Statement;
      import java.sql.DriverManager;
      import java.sql.ResultSet;
      import java.sql.ResultSetMetaData;
      import java.sql.SQLException;

      public class mysql {

      static final String DRIVER = "com.mysql.jdbc.Driver";
      static final String Database_url = "jdbc:mysql://192.168.20.40/books";

      public static void main(String args[]) throws ClassNotFoundException, SQLException
      {
      Connection connection = null;
      Statement statement = null;
      ResultSet resultSet = null;

      Class.forName(DRIVER);
      connection = DriverManager.getConnection(Database_url , "razvan" , "razvan");
      }

      }