Article View: comp.lang.java.databases
Article #29Re: Connecting to MS Access without DSN?
From: D.M. Mattix
Date: Mon, 07 Aug 2000 00:00
Date: Mon, 07 Aug 2000 00:00
41 lines
2431 bytes
2431 bytes
In article <398C309B.A19117DC@web.de>, Roland.Zumkeller@web.de says...
> 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.)
>
>
Maybe it's just a typo but it occured twice. My ODBC MS Access driver
has two s's in Access. Since this is a keyed lookup if your code has
only one s in Access then that might be the problem.
Mike Mattix
dmmattix@swbell.net
Technical Details
Message-ID:
<MPG.13f89d7e419e056d989697@news.swbell.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<398C309B.A19117DC@web.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 107d46,f814c85ba108c2bc X-Google-Attributes: gid107d46,public X-Google-Thread: 1073da,f814c85ba108c2bc X-Google-Attributes: gid1073da,public X-Google-Thread: 10a146,f814c85ba108c2bc X-Google-Attributes: gid10a146,public X-Google-Thread: 113ae9,f814c85ba108c2bc X-Google-Attributes: gid113ae9,public From: D.M.(Mike) Mattix <dmmattix@swbell.net> Subject: Re: Connecting to MS Access without DSN? Date: 2000/08/07 Message-ID: <MPG.13f89d7e419e056d989697@news.swbell.net> X-Deja-AN: 655468271 References: <398C309B.A19117DC@web.de> X-Complaints-To: abuse@swbell.net X-Trace: nnrp2.sbc.net 965665106 199.89.234.125 (Mon, 07 Aug 2000 11:18:26 CDT) Organization: Kelco BioPolymers NNTP-Posting-Date: Mon, 07 Aug 2000 11:18:26 CDT Newsgroups: comp.lang.java.databases,borland.public.jbuilder.database,comp.lang.java.programmer,comp.lang.java.help