Results 1 to 3 of 3
Thread: jdbc connection with phpmyadmin
- 05-13-2010, 08:27 AM #1
Member
- Join Date
- May 2010
- Posts
- 3
- Rep Power
- 0
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
AnandLast edited by anand_fevi; 05-19-2010 at 01:40 PM.
- 05-13-2010, 08:46 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
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.
- 05-19-2010, 01:45 PM #3
Member
- Join Date
- May 2010
- Posts
- 3
- Rep Power
- 0
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
-
JDBC DataBase Connection
By sh4dyPT in forum New To JavaReplies: 1Last Post: 04-06-2010, 02:13 AM -
JDBC connection
By evermore in forum JDBCReplies: 1Last Post: 03-19-2010, 08:35 AM -
JDBC Connection...
By onlysumitg in forum JDBCReplies: 3Last Post: 08-21-2009, 11:34 AM -
JDBC connection
By Java Tip in forum Java TipReplies: 0Last Post: 11-10-2007, 07:39 PM -
How to close JDBC Connection
By Heather in forum JDBCReplies: 2Last Post: 07-15-2007, 01:07 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks