wood burning stoves 2.0*
The moose likes JDBC and the fly likes proper url for mssql 7 server? (newbie question) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "proper url for mssql 7 server? (newbie question)" Watch "proper url for mssql 7 server? (newbie question)" New topic
Author

proper url for mssql 7 server? (newbie question)

Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
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.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
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


Dave
Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
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

Joined: May 10, 2001
Posts: 3244
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: proper url for mssql 7 server? (newbie question)
 
Similar Threads
Hashtable in memory versus database table in memory
connecting to db - Oracle vs MS SQL
Basic SQL Server JDBC problem
Urgent->where the table is stored by default of an cmp entity bean
Hibernate,Query,setMaxResults