Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2004
    Location
    The Ghetto (Winchendon, MA)
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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:

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection("jdbcdbc: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("jdbcdbc:;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.

    JT

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •