none
Unable to get {Watcom 4.0 SQL (ODBC 2.)} driver to connect with .NET 2.0 / C# /System.Data.Odbc

    Question

  • Having gotten System.Data.Odbc connections to work with Access, I've turned to trying to connect to a old legacy application using Watcom.  I have successfully used the VS 2005 Data Connection wizard for Server Explorer to access the database and do table reads.

     

    I'd like to replace some previous  C# code with the Access ODBC driver by that for Watcom.

     

     The settings for the Watcom driver in the WinXP ODBC Adminstrator are as follows...

    Driver – "Watcom SQL 4.0 (ODBC 2.0)"

    Data Source Name – "TestDB"

    Description – ""

    User ID – "dba"

    Password – "sql"

    Server Name – "TESTSERVER"

    Database Alias – ""

    Database File – "C:\app\TestBD.db"

    Custom – checked (enabled), leading to..

                Start Command – "dbeng40 –c32M"

                Database Switches – ""

                Autostop Database – checked (enabled)

    Translator Name - "<no translator>"

    Microsoft Applications – checked (enabled)

    Prevent Driver not Capable errors – unchecked

    Delay Autocommit - unchecked

     

    ODBC Adminstrator Drivers tab reports this as...

    Name - "Watcom SQL 4.0 (ODBC 2.0)"

    Version  - 5.00.00.00

    File - WOD40T20.dll

    File Date - 7/24/2001

     

    I had seen a Watcom 5.0 string at www.connectionstrings.com, and tried that first.  By removing an initial "ODBC" parameter, I came close.  Same thing with trying a DSN connection string.

    The code and error messages are as follows for the DSN version, followed by the "verbose" Watcom 5.0 -like version...

           private void LoadDatabaseOdbc()

            {

                string sConnectString = "Dsn=TestDB;uid=dba;pwd=sql";

                string sPerson = "";

     

                // create a new OdbcDbConnection object

                OdbcConnection odbcConn = new OdbcConnection(sConnectString);

     

                // open the connection

                odbcConn.Open();

     

                // create the command object

                OdbcCommand odbcComm = new OdbcCommand(

                    "SELECT PERSON FROM TESTTABLE", odbcConn);

     

                // read the data sequentially and store the row in Arezzo

                OdbcDataReader r = odbcComm.ExecuteReader();

     

                while (r.Read())

                {

                    // get values

                    sPerson = (string)r["Person"];

    ...

                }

     

                // close the reader

                r.Close();

     

                // close the connection

                odbcConn.Close();

     

    }

    ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server: unable to start specified database
    ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
    ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.Odbc.OdbcException: ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server: unable to start specified database
    ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
    ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server

     

     

    [OdbcException (0x80131937): ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server: invalid database engine command line
    ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
    ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server]
       System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) +35
       System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle) +131
       System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +98
       System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105

      

     

    string sConnectString = "Driver={Watcom SQL 4.0 (ODBC 2.0)}; DefaultDir=C:\\app\\;Dbf=C:\\TestDB.db;Uid=dba;Pwd=sql;Dsn=\"\"";

               

    ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server: unable to start database engine
    ERROR [01S00] [WATCOM][ODBC Driver]Invalid connection string attribute
    ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
    ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.Odbc.OdbcException: ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server: unable to start database engine
    ERROR [01S00] [WATCOM][ODBC Driver]Invalid connection string attribute
    ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
    ERROR [08001] [WATCOM][ODBC Driver]Unable to connect to database server

     

    Clearly the "automated" way is doing something right in  dealing with a pre-ODBC 3.0 that deals with SQLSetEnvAttr.

     

    Any thoughts are appreciated!

    Saturday, May 20, 2006 9:17 PM

All replies

  • Hello wsalomon

     

    I am working with Sybase Anywhere 5.0 and Visual Studio 2005. 
    I am planning a webservice, when I run the webservice from the solution, I have no problems.
    However, after that I published it sends error.
     
    I have the same problem you, when I try to connect to the database.
     
    This is the error
     
    EXCEPCION System.Data.Odbc.OdbcException: ERROR [08001] [Sybase][ODBC Driver]Unable to connect to database server: unable to start database engine
    ERROR [01000] [Microsoft][Administrador de controladores ODBC] El controlador no admite una versión de ODBC distinta de la que la necesita la aplicación (vea SQLSetEnvAttr).
       en System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
       en System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
       en System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       en System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
       en System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       en System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       en System.Data.Odbc.OdbcConnection.Open()
       en Service.ValidarUsuario(String ls_usuario, String ls_clave)

     

     

     
     
    I would like to know if you could resolve this problem and if I may say as resolved.
     
    I hope can help me please.    my email is yessica.quiros@gmail.com
    Monday, October 13, 2008 2:21 PM
  • Do you have Sybase ODBC driver installed in published environment? What is your connection string, can you post it here?
    Monday, October 13, 2008 4:50 PM
  • Hey VMazur I have also same problem I am posting my code. I don't know I have installed Sybase ODBC driver installed in published environment or not. Please let me know how to is it in published mode or not?

    OdbcConnection cn;
    OdbcCommand cmd;
    string MyString;
    MyString = "Select * from guest.backup";
    cn = new OdbcConnection("Driver={Adaptive Server Enterprise};server=****;port=****; db=*****;uid=*****;pwd=******;");
    cmd = new OdbcCommand(MyString, cn);
    OdbcDataAdapter da = new OdbcDataAdapter(cmd);
    DataSet ds = new DataSet();
    da.Fill(ds, "Table");
    return ds.Tables["Table"];

     

     

     

    Thursday, November 12, 2009 3:24 PM
  • Uou need to check if ODBC driver for Sybase is in stalled in deployed environment. If you go to Data Source (ODBC) in Administrative Tools of Windows, you should see leist of the drivers installed.
    Val Mazur (MVP) http://www.xporttools.net
    Friday, November 13, 2009 11:40 AM
  • Uou need to check if ODBC driver for Sybase is in stalled in deployed environment. If you go to Data Source (ODBC) in Administrative Tools of Windows, you should see leist of the drivers installed.
    Val Mazur (MVP) http://www.xporttools.net

    Hi!

    My client has a Caché Databease, wich I´m not familiar with, but in his environment the apllication works fine.

    But when I try to debug my Vb .Net aplication from my machine using VS 2K8 via VPN I get the following error:

    Erro ocorrido em: clsBancoDados.Connect às 27/11/2009 04:14:08
    Descrição do erro: ERROR [08S01] [Caché ODBC][State : 08S01][Native Code 461]
    [D:\Fontes\_Novo\TotalSales\Administrador\Admin\bin\Admin.vshost.exe]
    InterSystems Caché ODBC Error 461.
    ERROR [01000] [Microsoft][ODBC Driver Manager] O driver não oferece suporte à versão de comportamento de ODBC solicitada pelo aplicativo (consulte SQLSetEnvAttr).

    Its in portuguese, but in English I believe it wolud be something like this:

    Error Source: clsDataBase.Connect às 27/11/2009 04:14:08
    Error Description: ERROR [08S01] [Caché ODBC][State : 08S01][Native Code 461]
    [D:\Fontes\_Novo\TotalSales\Administrador\Admin\bin\Admin.vshost.exe]
    InterSystems Caché ODBC Error 461.
    ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the ODBC behavior version requested by the application (see SQLSetEnvAttr)

    This is the Connection String I'm using:

    DRIVER={InterSystems ODBC};SERVER=192.0.2.94;PORT=56774;DATABASE=DESENVOLVIMENTO;UID=ROGEFACIL;PWD=rogefacil;

    Could it be a driver version problem? How do I solve it?

    I've tried to create the connection from ODCB directly and test it, and the return was:

    "Invalid Host/Port; Caché Not Running; Network Down"

    I also know the Server is a Unix, and does not responds to ICMP or Telnet, but in the client's server, the application is running well.

    Any idea?
    Friday, November 27, 2009 7:36 PM