DSN Connection to Microsoft Access

S

Sandeep Gupta

Hi,

I want to use a DSN connection to connect to MS Access Database. The
ODBC DSN has been configured as MIT.
I use the following connection string to connect (using VB.NET):

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
DSN=MIT")

This throws up an error: Could not find installable ISAM
[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203

Can some one please let me know how to make a DSN connection to
Microsoft Access 2000 database in ASP.NET 1.1?

Thanks in advance,
Sandeep
 
M

Mark Rae

I want to use a DSN connection to connect to MS Access Database.
Why?

Can some one please let me know how to make a DSN connection to
Microsoft Access 2000 database in ASP.NET 1.1?

Is there any reason you're not using OleDb???
 
S

sloan

see mark's comment

and

Check your connection string very anally. When "ISAM" pops up , it is 70%
of the time a bad connection string.

ODBC is ..... a thing of the past, and a "last resort cuz I got nothing else
to use".
 
S

Sandeep Gupta

My web hosting service does not allow me direct OLE DB connections...
for it needs to have physical path to the file. I have tried fetching
the paths from server and using them but it just doesn't work.
 
S

Sandeep Gupta

I checked for the connection string. A search on MSDN reveals that the
error mentioned can crop up if there is any parameter that is not
supported in the connection string or if the parameter needs to be
specified once the connection is specified.

As per MSDN, we cannot use DSN entries with the OLE Jet driver and
hence the error.

- Sandeep


see mark's comment

and

Check yourconnectionstring very anally. When "ISAM" pops up , it is 70%
of the time a badconnectionstring.

ODBC is ..... a thing of the past, and a "last resort cuz I got nothing else
to use".


I want to use aDSNconnectionto connect to MSAccessDatabase. The
ODBCDSNhas been configured as MIT.
I use the followingconnectionstring to connect (using VB.NET):
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
DSN=MIT")
This throws up an error: Could not find installable ISAM
[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
Can some one please let me know how to make aDSNconnectionto
MicrosoftAccess2000 database in ASP.NET 1.1?
Thanks in advance,
Sandeep
 
S

Sandeep Gupta

Mark,

I am using the following code:

Dim conn as String = "Provider=Microsoft.Jet.OLEDB.4.0; DataSource=" +
Server.MapPath(".") + "\Data\MIT.db"
Dim cn As New OleDbConnection(conn)

Now the Server.MapPath(".") returns d:\host\mit\www, which build my
connection string to be
d:\host\mit\www\data\mit.db

While connecting using cn.open() i get a file not found error. I have
configured a DSN for the database using my host control panel,
and while connecting using the DSN it is connecting fine.

But as the DSN thing is not recommended for connecting to Microsoft
Access, I am trying to figure out a way to connect to my database
using the Jet OleDB driver.

Thanks,
Sandeep
 
M

Mark Rae

Dim conn as String = "Provider=Microsoft.Jet.OLEDB.4.0; DataSource=" +
Server.MapPath(".") + "\Data\MIT.db"
Dim cn As New OleDbConnection(conn)

Now the Server.MapPath(".") returns d:\host\mit\www, which build my
connection string to be d:\host\mit\www\data\mit.db

A couple of further questions:

1) Is 'd:\host\mit\www\data\mit.db' actually correct...?

2) What is MIT.db? It doesn't appear to be a Jet database from the file
extension...
While connecting using cn.open() i get a file not found error.

See 1) above...
 
S

Sandeep Gupta

Mark,

The path for the database file "d:\host\mit\www\data\mit.mdb" is
actually been constructed on the fly using the Server.MapPath()

And, about the extension, sorry, that was actually a typographical
error. It is actually MDB (the extension of Microsoft Access)

Thanks,
Sandeep Gupta
 
M

Mark Rae

The path for the database file "d:\host\mit\www\data\mit.mdb" is
actually been constructed on the fly using the Server.MapPath()

Yes, but is it actually *correct*? Does the database file actually exist in
that folder?
And, about the extension, sorry, that was actually a typographical
error. It is actually MDB (the extension of Microsoft Access)

And does the account that ASP.NET is running under have write permissions on
that folder?
When a Jet database is opened, it creates a corresponding "locking" (.ldb)
file in the same folder...
 
S

Sandeep Gupta

Mark,

Thanks a lot. The issue was of write permission for the ASP.NET
account.
I got it resolved from my HOST.

Thanks a lot again.
Sandeep Gupta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top