• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC ms sql server driver issue

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to connect to a sqlserver 2000 database. The database is on my microsoft network and I can correctly ping the machine by typing:

ping databasename


I'd like to connect to the database through microsoft's jdbc drivers. I'm using the sql server 2000 service pack drivers which can be found here.
These are the relevant lines of code:

I get this error back:

java.sql.SQLException: No suitable driver


I know that the classpath is setup correctly, because when run with verbose output enabled I can see the classes from the microsoft jars being loaded:

[Loaded com.microsoft.jdbc.base.BaseDriver]
[Loaded com.microsoft.jdbc.sqlserver.SQLServerDriver]
[Loaded com.microsoft.jdbc.extensions.ExtEmbeddedConnection]
[Loaded com.microsoft.jdbc.base.BaseConnection]
[Loaded com.microsoft.jdbc.sqlserver.SQLServerConnection]
etc.


I've tried various url's, both pointing at a local database and at remote databases. Because of this I don't think it's a network issue. I've also tried adding a default database option to the url.
I've tried compiling and running with jre 1.3.1 and jre 1.4.2, but I still get the error.
I'm stuck and confused, am I missing something obvious? I would greatly appreciate any help.
Thanks.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you may try
String url = "jdbc:microsoft:sqlserver://systemname:1433/databasename;"
--- add a ":" and "databasename "
 
Michael Crutcher
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestion, but I tried that:

I've also tried adding a default database option to the url.


It was probably pretty easy to miss because of the length of the original post.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It definitely looks like a problem with the database URL.
Are you sure it should have the semi-colon on the end?
Checking the FAQ, the suggested syntax is jdbc:Microsoft:sqlserver://my-virtualserver:1433;DatabaseName=Pubs
I'd try adding the database name in the form above, or leave off everything after (and including) the semicolon.
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic