🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.databases
Article #33

Connecting to MS Access without DSN?

#33
From: Roland Zumkeller
Date: Sat, 05 Aug 2000 00:00
32 lines
2004 bytes
Hi,
Does someone kno how to connect via JDBC to a MS Access database without
creating a System DSN?

I heard this would be possible with a statement like this:
Connection conn = DriverManager.getConnection(
 "jdbc:odbc:;DRIVER={Microsoft Acces Driver *.mdb)};DBQ=C:\\mydb.mdb",
 "", "");

I've tried this using "sun.jdbc.odbc.JdbcOdbcDriver" with both JDK 1.2
and 1.3. I always get a:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name
not found and no default driver specified

I heard it works with Microsoft's "com.ms.jdbc.odbc.JdbcOdbcDriver", but
using this with (MS SDK 4.0) I get the same Exception.

The database mydb.mdb exists and I've also tried the url 
"jdbc:odbc:DRIVER={Microsoft Acces Driver (*.mdb)};DBQ=C:\\mydb.mdb"
(without the first ";"). I've also connected to System DSNs successfully
with both SDKs, but that's just what I want to avoid.

I would be really happy if someone could help me.

Thanks!

Roland


PS. If it's necessary to use Microsoft's driver, how can it used within
Sun's SDK? (Just adding some zip-file to the classpath didn't work for
me.)
Technical Details
Message-ID: <398C309B.A19117DC@web.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 107d46,f814c85ba108c2bc,start
X-Google-Attributes: gid107d46,public
X-Google-Thread: 10a146,f814c85ba108c2bc,start
X-Google-Attributes: gid10a146,public
X-Google-Thread: 1073da,f814c85ba108c2bc,start
X-Google-Attributes: gid1073da,public
X-Google-Thread: 113ae9,f814c85ba108c2bc,start
X-Google-Attributes: gid113ae9,public
From: Roland Zumkeller <Roland.Zumkeller@web.de>
Subject: Connecting to MS Access without DSN?
Date: 2000/08/05
Message-ID: <398C309B.A19117DC@web.de>
X-Deja-AN: 654781412
Content-Transfer-Encoding: 7bit
X-Accept-Language: de
Content-Type: text/plain; charset=us-ascii
X-Trace: fu-berlin.de 965488838 6979717 62.54.15.237 (16 [43476])
Mime-Version: 1.0
Newsgroups: comp.lang.java.databases,borland.public.jbuilder.database,comp.lang.java.programmer,comp.lang.java.help