Search code examples
c#.netdb2informixfluent-migrator

Unable to connect to Informix db2


Unable to connect to Informix db2 from Fluent Migrator (.net/c#) on the local instance. (Windows 10 running on AWS EC2)

Getting this after invoking the migrator executable:

[+] Beginning Transaction

!!! ERROR [HY011] [IBM] CLI0126E Operation invalid at this time. SQLSTATE=HY011

I am able to connect to the db instance via the dbaccess cli utility. I also tried to remove all the actual migration sql statements and scripts from the migration solution and the same error happens if trying to run a totally empty migration, so the issue is likely a connection or transaction issue.

Any ideas will be appreciated. Thanks.

__

More detials as requested from responses:

The connection info is this:

<add 
    name="Integration" 
    connectionString="Database=int_db; 
                      Server=service_144345.int.cloud:49005; 
                      User ID=int_db_user; 
                      Password=xxxxxxxx;" 
    providerName="IBM.Data.DB2"
/>

Both the database and the application that connects to it are located on the same machine, which is hosted on AWS. So the connection it's trying to make is to the DB on the same box.


Solution

  • After putting extensive logging inside the calling application the problem was narrowed down to the BeginTaansaction call. The error was caused by the absence of transaction logging on the database.

    The issue was fixed by adding transaction logging to DB definition e.g.

    CREATE DATABASE %database% WITH BUFFERED LOG;