Results 1 to 3 of 3
  1. #1
    anand_fevi is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Post jdbc connection with phpmyadmin

    Hello friends,
    i am trying to connect to mysql which available online through java with below code.
    I can not find a jar which contains the com.imaginary.sql.msql.MsqlDriver which is used the program.

    Can any body help me out how to connect to the database or whats the jar file needed for the below programe or from where to download that jar file(imaginary).

    Code for your ref:
    import java.sql.*;
    class testjdbc {

    public static void main (String[] args) {
    try
    {
    // Step 1: Load the JDBC driver.
    Class.forName("com.imaginary.sql.msql.MsqlDriver") ;
    System.out.println("Driver loaded success");
    // Step 2: Establish the connection to the database.
    String url = "jdbc:msql://www.abc.com:3306/mysql";
    Connection conn = DriverManager.getConnection(url,"username","passwo rd");
    System.out.println("test connection success");
    }
    catch (Exception e)
    {
    System.err.println("Got an exception! ");
    System.err.println(e.getMessage());
    e.printStackTrace();
    }
    }
    }


    Thanks in advance!
    by
    Anand
    Last edited by anand_fevi; 05-19-2010 at 02:40 PM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You are trying to load a driver for mSQL not for MySQL. The two are different.
    If you want to connect to MySQL then get the driver from the MySQL driver site.

  3. #3
    anand_fevi is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default

    Thank u senior,
    I have tried that also.But i am getting the below error sir,
    No suitable driver
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(DriverManager .java:545)
    at java.sql.DriverManager.getConnection(DriverManager .java:171)
    Note:i need to connect to the mysql database which is available online(not locally) through java(jdbc).
    Kindly help me to come out of this issue.
    Thanks for ur kind reply.
    Anand.M

Similar Threads

  1. JDBC DataBase Connection
    By sh4dyPT in forum New To Java
    Replies: 1
    Last Post: 04-06-2010, 03:13 AM
  2. JDBC connection
    By evermore in forum JDBC
    Replies: 1
    Last Post: 03-19-2010, 09:35 AM
  3. JDBC Connection...
    By onlysumitg in forum JDBC
    Replies: 3
    Last Post: 08-21-2009, 12:34 PM
  4. JDBC connection
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-10-2007, 08:39 PM
  5. How to close JDBC Connection
    By Heather in forum JDBC
    Replies: 2
    Last Post: 07-15-2007, 02:07 PM

Tags for this Thread

Posting Permissions

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