Groups | Blog | Home
all groups > dotnet ado.net > may 2007 >

dotnet ado.net : DSN Connection for Microsoft Access in ASP.NET


Sandeep Gupta
5/17/2007 9:45:54 PM
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 Gupta
Sandeep Gupta
5/18/2007 8:07:21 AM
Thanks a lot Paul, I was able to connect to the database using your
suggestions.

One more query,

When I am using the Jet OLEDB provider and specifying the physical
path using the Server.MapPath(".")+"/Data/MIT.db", I get the error
saying the file "d:\host\mit\www\data\mit.db" could not be found. But
the location of the uploaded file is www\data\mit.db.

Is there any workaround to get access using the Jet driver?

- Sandeep


On May 18, 7:27 pm, Paul Clement
[quoted text, click to view]

Paul Clement
5/18/2007 9:27:17 AM
[quoted text, click to view]

¤ 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?

First, ODBC is not the recommend method for connecting to an Access database. This method is not as
stable and doesn't provide the level of functionality supported by Jet OLEDB.

Second, It looks like you're trying to use the DSN with the Jet OLEDB provider. This is not
supported. If you use a DSN then you will probably need to use the ODBC library instead of OLEDB.

Dim ODBCConnection As Microsoft.Data.Odbc.OdbcConnection

Dim ConnectionString As String = "DSN=MIT;"

ODBCConnection = New Microsoft.Data.Odbc.OdbcConnection(ConnectionString)
ODBCConnection.Open()


Paul
~~~~
Paul Clement
5/22/2007 11:41:27 AM
[quoted text, click to view]

¤ Thanks a lot Paul, I was able to connect to the database using your
¤ suggestions.
¤
¤ One more query,
¤
¤ When I am using the Jet OLEDB provider and specifying the physical
¤ path using the Server.MapPath(".")+"/Data/MIT.db", I get the error
¤ saying the file "d:\host\mit\www\data\mit.db" could not be found. But
¤ the location of the uploaded file is www\data\mit.db.
¤
¤ Is there any workaround to get access using the Jet driver?

Could you post your code?

I can't tell where your Data folder is relative to your application path.


Paul
~~~~
Sandeep Gupta
5/22/2007 9:56:16 PM
Hi Paul,

I am using the following code:

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

Now the Server.MapPath(".") returns d:\host\mit\www, but while
connecting it says the path cannot be found.

Thanks,
Sandeep


On May 22, 9:41 pm, Paul Clement
[quoted text, click to view]

Paul Clement
5/25/2007 11:15:17 AM
[quoted text, click to view]

¤ Hi Paul,
¤
¤ 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, but while
¤ connecting it says the path cannot be found.
¤

If the path is valid could this be a permissions issue? What type of authentication is your web
application configured for? Anonymous? Basic? Integrated Windows?


Paul
~~~~
AddThis Social Bookmark Button