I have tried a lot for JDBC using mysql but none of them work....
Can anyone help me how to get this work....

import java.sql.Connection;
import java.sql.DriverManager;

public class Main {
  public static void main(String[] argv) throws Exception {
    String driver = "com.mysql.jdbc.Driver";
    String connection = "jdbc:mysql://localhost:3306/abc";
    String user = "root";
    String password = "password";
    Connection con = DriverManager.getConnection(connection, user, password);
    if (!con.isClosed()) {

I have downloaded com.mysql.jdbc.driver file.
included in my classpath but still i am getting the classnotfound error for "com.mysql.jdbc.Driver'.

Then you have not "included it on your classpath" properly. How did you "include it on your classpath" and how, exactly are you executing this code.

Edited 5 Years Ago by masijade: n/a

I already came with solution....
Their was nothing wrong.....only a bit mistake in the way of using classpath....
By the way thanks for your suggeestions!!!

This question has already been answered. Start a new discussion instead.