How to access a database on the server using java
Okay Java experts, here's my dilemia:
I'm trying to write a Java application to connect to a database that resides on our network server. I've been able to connect to the database in question from my client PC using the basic connection code:
Connection conn = DriverManager.getConnection("jdbc:odbc:TEST");
I created a DSN on my client computer named TEST that mapped a network drive to the database that I wanted to use. All is well! My question is, since there are a fair number of client computers in my network, how can I rig it so that I can connect to the DSN on the server?
I'd really rather not have to create a DSN on every single client computer, and I'm assuming that there is a way to do this, since it would be really dumb if there wasn't. So if anyone can give me the syntax on how to work this, i'd be delighted. I'm connecting to an access database. One site suggested doing this:
Connection conn = DriverManager.getConnection("jdbc:odbc:;Driver=Microsoft Access Driver (*.mdb);DBQ=E:/Databases/TestInv.mdb");
I thought the syntax was a little messy looking but I tried it and it didn't work. So again, if anyone out there knows the answer, please let me know it too.
There are some extremely talented Java people over at [Java Ranch]. I'm pretty sure that someone over there will be able to answer about any question that you have.
|All times are GMT +1. The time now is 12:59 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.