Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-10-2004, 07:58 PM   PM User | #1
jtaylor
New Coder

 
Join Date: Apr 2004
Location: The Ghetto (Winchendon, MA)
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
jtaylor is an unknown quantity at this point
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
jtaylor is offline   Reply With Quote
Old 05-17-2004, 12:29 AM   PM User | #2
Antoniohawk
Senior Coder

 
Join Date: Aug 2002
Location: Kansas City, Kansas
Posts: 1,518
Thanks: 0
Thanked 2 Times in 2 Posts
Antoniohawk will become famous soon enough
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.
Antoniohawk is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:53 AM.


Advertisement
Log in to turn off these ads.