• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

No Suitable Driver Error

 
Ranch Hand
Posts: 2119
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my class. I get error No Suitable Driver. Please help:

 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2119
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now I get a message: Unknown Source
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Steve,
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:

http://support.microsoft.com/kb/313100

Maybe it will help you?

Good Luck,
Avi.
 
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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";
username="abc";
password="abcd";
//use any one of the line according to your sqlserver version
//DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver()); //Use For SQL Server 2005

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


Thanks,

Nishanth.S
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic