wood burning stoves 2.0*
The moose likes JDBC and the fly likes No suitable driver using msql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "No suitable driver using msql" Watch "No suitable driver using msql" New topic
Author

No suitable driver using msql

Ajay Singh
Ranch Hand

Joined: Jan 04, 2008
Posts: 105
HI all

i am trying to fetch values from SQL database which is present in remote server.The url string of my code is

String url = "jdbc:msql://10.87.125.74:8080/DatabaseName";
Class.forName ("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(url,"Ajay","Singh");
Statement stmt = conn.createStatement();
ResultSet rs;

rs = stmt.executeQuery("SELECT * from Employee");
while ( rs.next() )
{
String name = rs.getString("Name");
System.out.println(name);
}
conn.close();


Now when i run my code the following error comes

"No suitable Driver".i have downloaded oracle drivers(or which driver should i download?) and set them in the class path but still the same problem.Kindly help
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"oracle.jdbc.driver.OracleDriver"

I would expect to see the MySql Driver here...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39575
    
  27
I am quite sure that JDBC URL you're using is not correct for an Oracle database. Consult the Oracle driver documentation for what to use instead.


Ping & DNS - updated with new look and Ping home screen widget
Ajay Singh
Ranch Hand

Joined: Jan 04, 2008
Posts: 105
i have googled through and found this driver to be used for msql database


Class.forName("com.imaginary.sql.msql.MsqlDriver");

but i am not getting from where to download the above mentioned driver.

Also can we use MySql driver ?

As far as i know MS Sql ,MySql ,and mSQL are three different things
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Yep, I misread. You still need to get the jdbc url and driver correct though.
Ajay Singh
Ranch Hand

Joined: Jan 04, 2008
Posts: 105
i tried to download the mSQL driver from

http://www.imaginary.com/Java/

but it says page cannot be found:-(
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18151
    
    8

So why did you choose that particular page? When I google for "msql" I find several pages for a company that claims to have distributed MSql since 1994, but not that one.

None of those pages mentions JDBC, either, but I only spent 30 seconds researching. I would say don't start writing your program to use MSql until you see what it can do.

Edit: But apparently you already have MSql running on a server somewhere. In that case I would go and talk to the administrator of that server. They should have contacts for MSql. They might already have a JDBC driver as part of their installation.
[ July 24, 2008: Message edited by: Paul Clapham ]
Ajay Singh
Ranch Hand

Joined: Jan 04, 2008
Posts: 105
thanks everybody for the replies.The database is changed to Ms Sql and now its working fine now:-)
 
wood burning stoves
 
subject: No suitable driver using msql
 
Similar Threads
ClassNotFoundException with ResourceBundle
cannot connect to db2 v8 trial version with jdbc
Finding out the correct URL
interface method definition?
Everytime getting an empty ResultSet