• 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

proper url for mssql 7 server? (newbie question)

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I've found some good examples of connecting to a database using a jdbc-odbc bridge, and I got it to work on a little access database. Now I need to connect to my real database, which is ms sql server 7. I see where to specify the dns, and I know I specify the table in the query, but where do I specify which database on the server I'm calling? Do I add it to the url with a semi-colon, or do I preface my table name with the database in the query, or.. ?
(I'd just start messing with it, but the dba will kill me if I break anything.)
Thanks for any help anyone can give!
g.
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Garann
If your using the JDBC-ODBC bridge and a DSN then the db administrator should have set up and you would just use that one. If your not using a dsn then you'll connect directly to the DB with type a type 4 driver (probably).
here is microsofts driver. Then it would be up to the driver to specify the url that you'd use to connect.
hope that helps
 
Garann Means
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Dave.
Is there a type 4 driver I can use that will work for both mssql and db2? Or are they database-specific?
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Type 4 drivers would be database specific, but you can load multiple drivers into your code if you like:

Then at run time the DriverManager willpick the correct driver from among those loaded. That's the beauty of it all - same code written by you, multiple drivers, multiple DBs.
About the only thing you can do to get one driver to work with both would be to use the JDBC-ODBC bridge but then you adding a couple of layers to your connection. And you'd have to have DSN set up on everyones machne that would be running the code.
hope that helps
 
reply
    Bookmark Topic Watch Topic
  • New Topic