DSN Connection to Microsoft Access

  • Thread starter Thread starter Sandeep Gupta
  • Start date Start date
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
 
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???
 
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".
 
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.
 
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
 
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
 
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...
 
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
 
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...
 
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
 
Back
Top