Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JDBC and Relational Databases and the fly likes No Suitable Driver Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "No Suitable Driver Error" Watch "No Suitable Driver Error" New topic

No Suitable Driver Error

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
This is my class. I get error No Suitable Driver. Please help:

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
I think the ":microsoft" in the connection URL is superfluous; try "jdbc:sqlserver:" instead.

By the way, it's much more common not to instantiate the driver directly, but to do something like:

That also makes it easy to keep driver class name and connection url details in an external data source, instead of hardcoding them.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
Now I get a message: Unknown Source
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1138

Database connection URLs are usually JDBC driver specific.
I don't use SQL Server but I imagine that its compatible JDBC drivers have documentation which provide details of how to write a suitable one for your situation.
Am I mistaken?

Just did a Google search and came up with this:

Maybe it will help you?

Good Luck,
Nishanth Sivaraman

Joined: Aug 12, 2008
Posts: 7
are you using sqlserver 2000 or 2005? connection varies for them, see the coed below. Get appropriate driver from microsoft site.

String connectionstring="jdbc:microsoft:sqlserver://nishanths:1433";
//use any one of the line according to your sqlserver version
//DriverManager.registerDriver(new; //Use For SQL Server 2005

DriverManager.registerDriver(new; //Use For SQL Server 2000
Con = DriverManager.getConnection(connectionstring,username,password);


I agree. Here's the link:
subject: No Suitable Driver Error
jQuery in Action, 3rd edition