Search code examples
javadockerjdbcinformixdbeaver

Trying to connect to IBM's Informix docker edition with JDBC


I'm trying to write some Java tests for Informix. I have the docker running from here:

https://hub.docker.com/r/ibmcom/informix-developer-database/

I cannot find any example of the JDBC connection string to use to connect to it.

I used this to run it: docker run -it --name ifx -h ifx --privileged -p 9089088 -p 9089:9089 -p 27017:27017 -p 27018:27018 -p 27883:27883 -e LICENSE=accept ibmcom/informix-developer-database:latest

I'm trying this jdbc:informix-sqli://localhost:9088/sysmaster:INFORMIXSERVER=ifx with their default username and password but I'm getting "INFORMIXSERVER does not match either DBSERVERNAME or DBSERVERALIASES."

I also tried with INFORMIXSERVER=dev - same error.

Anyone know what the jdbc url would be for this docker image?


Solution

  • You can use the following JDBC URL string:

    jdbc:informix-sqli://localhost:9088/sysmaster:INFORMIXSERVER=informix
    

    You can check the correct value to use for the INFORMIXSERVER parameter as follows:

    1. Connect to your Docker instance as follows:
    docker exec -it ifx bash
    
    1. At the command line, check the contents of the sqlhosts file:
    cat $INFORMIXDIR/etc/sqlhosts
    

    You will see something similar to this (assuming a vanilla Docker installation):

    ############################################################
    ### DO NOT MODIFY THIS COMMENT SECTION
    ### HOST NAME = 6b4943a932ab
    ############################################################
    informix        onsoctcp        *6b4943a932ab         9088
    informix_dr     drsoctcp        *6b4943a932ab         9089
    

    The entry for port 9088 has the name informix.