Results 1 to 5 of 5
  1. #1
    awaistoor is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

    Default jdbc Driver Error

    hey

    this is my first post on this form .. i have a problem ... the thing is dat i have linux machine on wich im running mysql server n all my databases are there..

    now i have tried accessing the database from localhost .. but can any1 tell me the correct way of connecting my data base through a java application ...

    i have created a connection class for this purpose n it is like this :

    package dbPackage;

    import java.sql.*;

    public class Connect {
    static Connection conn = null;
    public Connect() {
    }

    public static Connection getConnection() {


    try {
    String userName = "someuser";
    String password = "pwd";
    String url = "jdbc:msql://10.1.10.105:3306/myDataBase";
    Class.forName("com.mysql.jdbc.Driver").newInstance ();
    conn = DriverManager.getConnection(url, userName, password);
    System.out.println("Database connection established");
    } catch (Exception e) {
    System.err.println("Cannot connect to database server" + e.getMessage());
    }
    return conn;
    }

    it work fine when i use it on linux machine my just changing the ip to localhost
    now when i use from deferent pc (i.e Windows machine) it gives my this error:

    Cannot connect to database serverNo suitable driver found for jdbc:msql://10.1.10.105:3306/myDataBase

    can any1 help me with this ??
    thanx
    awaistoor

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    10

    Default

    On the "other" pc you do not have the mysql JDBC Driver jarfile in your classpath.

  3. #3
    awaistoor is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

    Default

    lolx no ... i was doing a very stupid mistake for past few days :D

    on the line: String url = "jdbc:msql://10.1.10.105:3306/myDataBase";
    my b u also ddnt notice dat i wrote msql instead of mysql :D .. i saw this yesterday after posting here :o
    now its working alryt
    but thanx masijade for replying

    <% awaistoor %>

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    10

    Default

    That was a stupid answer anyway as "no suitable driver" isn't an indication for that. I must have been drunk.

  5. #5
    awaistoor is offline Member
    Join Date
    Mar 2011
    Posts
    3
    Rep Power
    0

Similar Threads

  1. com.mysql.jdbc.Driver
    By uthpalaw in forum Eclipse
    Replies: 2
    Last Post: 10-14-2010, 05:09 AM
  2. JDBC Driver
    By Ursula in forum New To Java
    Replies: 6
    Last Post: 08-23-2010, 05:41 PM
  3. creating .jar with jdbc driver?
    By Godsent in forum New To Java
    Replies: 2
    Last Post: 04-16-2009, 05:58 PM
  4. JDBC Driver problem
    By Swamipsn in forum New To Java
    Replies: 3
    Last Post: 08-09-2007, 03:55 PM
  5. Help with JDBC driver
    By Daniel in forum JDBC
    Replies: 2
    Last Post: 07-03-2007, 08:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •