ODBC connection works for windows form but not for web

Problem: I am trying to connect to a database via ODBC in an existing .NET web application, so I created a prototype windows form application to verify I could access the data. The winform works with no problems, so I put the exact code in my web application and I get errors establishing a connection.

Specs: I am running windows XP on my machine, the location of the datasource is on a 2003 server. The database I'm trying to connect to is an advantage database.

Code:
string connectionString = "Dsn=myDataSource;uid=user;pwd=password;";
using (OdbcConnection connection = new OdbcConnection(connectionString)) {
...
connection.Open();
}

Error Message:
System.Data.Odbc.OdbcException: ERROR [HY000] [Extended Systems][Advantage SQL][ASA] Error 5033: No connected server was found for the given drive letter.
ERROR [HY000] [Extended Systems][Advantage SQL][ASA] Error 5033: No connected server was found for the given drive letter.
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()

[1974 byte] By [nickyzzi] at [2008-1-8]
# 1
Problem solved: the database path in the ODBC connection was using a mapped drive. I changed it to a UNC path, and it works fine.
nickyzzi at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...
# 2

Could you please post your working connection string.

I am having a similar problem but I don't know if the \ is some kind of 'scape character that has to be taken in consideration.

Regards

Lewis

Legarcia at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...
# 3
The connection string is correct in my previous post; however when setting up the datasource in the ODBC Data Source Administrator, my data dictionary path needs a UNC path, I.E. "\\server\share\data.add"

This is a connection to an advantage database file. Let me know if you need more explanation or help

nickyzzi at 2007-10-2 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...

.NET Development

Site Classified