locked
creating an ODBC connection to informix RRS feed

  • Question

  • User692055318 posted

    What I need to do is use webmatrix to connect to informix via an odbc connection. I have not found anything to help. There is a website out there about connection strings but nothing about using it with webmatrix and cshtml files.

    Does anyone have any idea how to do this?

    Thanks

    Laura

    Thursday, January 22, 2015 3:37 PM

Answers

  • User692055318 posted

    Ended up writing this in classic asp since the razor syntax didn't seem to allow it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 30, 2015 8:56 AM

All replies

  • User-821857111 posted

    You need to add a connection string to your web.config file. Place it in the <config> section:

    <connectionStrings>
        <add name="Choose_A_Name" connectionString="Your_connection_String" providerName="System.Data.Odbc />
    </connectionStrings>

    You can get the format of the actual connectionString from here: https://www.connectionstrings.com/ibm-informix-odbc-driver/

    The name that you provide your connection sting is the value that you use in the Database.Open method:

    var db = Database.Open("Choose_A_Name");



    Thursday, January 22, 2015 4:10 PM
  • User692055318 posted

    Thanks Mike,

    I tried that and got the error:

    ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    
    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 [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    Do I have to add something else to the webconfig?

    Friday, January 23, 2015 9:24 AM
  • User-821857111 posted

    Did you install the Informix ODBC driver?

    Friday, January 23, 2015 9:45 AM
  • User692055318 posted

    Yes. I can connect to it vs odbc in the connect test demo included in the SDK. However I can't connect to it in webmatrix using the same DSN connection. I even added the IBM driver to the bin directory.

    Friday, January 23, 2015 10:40 AM
  • User692055318 posted

    Ended up writing this in classic asp since the razor syntax didn't seem to allow it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 30, 2015 8:56 AM