Question

What steps do I need to take to allow my Informix JDBC driver to be a supported database in korma? Informix has a jdbc driver, and I have tested with the driver's demo Java programs. My connection parameters work.

I've gone ahead and started a Clojure project, but I'm stuck on what to try even to get an error, so I can move forward from there, let alone connecting.

My Informix JDBC driver 3.50 is in maven

mvn install:install-file \
-DgroupId=com.informix \
-DartifactId=ifxjdbc \
-Dversion=3.50 \
-Dfile=/opt/IBM/Informix_JDBC_Driver/lib/ifxjdbc.jar \
-Dpackaging=jar \
-DgeneratePom=true

The following example is for postgres. I want to do this for Informix. I am wondering what I have to do so that I can create a connection for the Informix database using something similar to

(defdb prod (postgres {:db "korma"
                       :user "korma"
                       :password "kormapass"
                       ;; optional keys
                       :host "myhost"
                       :port "4567"
                       :delimiters ""}))

I am pretty sure I cannot just use "informix" in place of postgres in the example above, and magic will happen. I am just puzzled as to what defintions to create. Any help or pointers to examples would be appreciated.

Was it helpful?

Solution

Try using classname and subprotocol attributes:

(def db-config {:classname "com.informix.jdbc.IfxDriver"
                :subprotocol "informix-sqli"
                :subname (format "//%s:1533/%s" 
                                 "123.45.67.89"
                                 "testDB:INFORMIXSERVER=myserver")
                :user "user"
                :password "password"})

(defdb db db-config)

Take a look at the different definitions in the source code, postgres is just a shorthand for those attributes. Even if there's no informix predefined function you can roll your own.

According to this doc driver name is com.informix.jdbc.IfxDriver, you can also check there for database URIs:

The following example shows a database URL that connects 
to a database called testDB:

jdbc:informix-sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver;
user=rdtest;password-test

Also remember to add the proper dependency information to your project.clj file:

 :dependencies [...
                [com.informix.jdbc/com.springsource.com.informix.jdbc "3.0.0.JC3"]
                ...

And the springsource repositories for that dependency to be found:

  :repositories [["springsource-release" "http://repository.springsource.com/maven/bundles/release"]
                 ["springsource-external" "http://repository.springsource.com/maven/bundles/external"]]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top