Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem while connecting to MS Access 2007

94 views
Skip to first unread message

ruds

unread,
Sep 1, 2012, 7:04:50 AM9/1/12
to
Hi, I'm getting " Data source name not found and no default driver
specified" Error while connecting to MS Access database through
tomcat. I have created user DSN for my db.
My connection code is:
Connection con =null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String conStr = "jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb, *.accdb)};DBQ=" +
"D:\\OLD D DRIVE\\FileManager\\FileManager.mdb";
con = DriverManager.getConnection(conStr);
} catch(Exception e) {
e.printStackTrace();}

Arne Vajhøj

unread,
Sep 1, 2012, 10:19:18 AM9/1/12
to
Pre-2007 it is:
.mdb files
{Microsoft Access Driver (*.mdb)} driver

2007 and later is:
.accdb files
{Microsoft Access Driver (*.mdb, *.accdb)} driver

Also be sure that you use 32 bit Java as I believe the
ODBC driver is 32 bit.

Arne


ruds

unread,
Sep 3, 2012, 1:45:40 AM9/3/12
to
My CPU is 64 bit and for creating DSN I'm executing "C:\Windows\SysWOW64\odbcad32.exe". I have installed jdk1.6.0_32 version of java.

Arne Vajhøj

unread,
Sep 3, 2012, 10:34:56 PM9/3/12
to
On 9/3/2012 1:45 AM, ruds wrote:
> My CPU is 64 bit and for creating DSN I'm executing "C:\Windows\SysWOW64\odbcad32.exe". I have installed jdk1.6.0_32 version of java.

32 or 64 bit Java?

Arne


ruds

unread,
Sep 4, 2012, 1:02:42 AM9/4/12
to
I had downloaded the exe file for i586 so ithink it is 32 bit.

Roedy Green

unread,
Sep 6, 2012, 7:22:13 PM9/6/12
to
On Sat, 1 Sep 2012 04:04:50 -0700 (PDT), ruds <rudr...@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>Hi, I'm getting " Data source name not found and no default driver
>specified" Error while connecting to MS Access database through
>tomcat. I have created user DSN for my db.

see http://mindprod.com/jgloss/jdbc.html

--
Roedy Green Canadian Mind Products http://mindprod.com
A new scientific truth does not triumph by convincing its opponents and making them see the light,
but rather because its opponents eventually die, and a new generation grows up that is familiar with it.
~ Max Planck 1858-04-23 1947-10-04


Arne Vajhøj

unread,
Sep 6, 2012, 8:41:41 PM9/6/12
to
On 9/4/2012 1:02 AM, ruds wrote:
> I had downloaded the exe file for i586 so ithink it is 32 bit.

So 32 bit Java and 32 bit ODBC.

And Access must be 32 bit as well as I don't believe a 64 bit version
exists.

Mysterious.

Can you access it via DSN?

Arne


ruds

unread,
Sep 6, 2012, 11:32:23 PM9/6/12
to
yes I'm able to open it and view the contents. Is it required to have a META-INF/context.xml file? would that be a problem?

Arne Vajhøj

unread,
Sep 8, 2012, 6:01:23 PM9/8/12
to
On 9/6/2012 11:32 PM, ruds wrote:
> yes I'm able to open it and view the contents.

I meant - can you access it from Java using the DSN?

> Is it required to have a META-INF/context.xml file? would that be a problem?

That is configuration for Tomcat. Including defining data sources.

It is not needed when using DriverManager.

Arne

PS: Using an Access database from a web application usually gives
problems as Access is not designed for that type of context.

0 new messages