Informix database connection in Play framework

150 views Asked by At

I want to connect Informix and Play framework but I have a problem. My application.conf contains the following code:

db.default.driver = com.informix.jdbc.IfxDriver
db.default.url = "jdbc:informix-sqli://localhost:9088/test:INFORMIXSERVER=ol_ids_1150_1"
db.default.user = "informix"
db.default.password = "123456"

and the error is :

Driver not found : [ com.informix.jdbc.IfxDriver ]

and my build.sbt file is like this:

name := "percobaan"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  "com.informix"%"informix"%"ifxjdbc"
)    

play.Project.playJavaSettings

What might be the cause of the problem?

1

There are 1 answers

12
Peanut On BEST ANSWER

This error appears if your JDBC-driver was not found. It means you have to add the driver somehow to your project. Usually by either adding a jar-file containing the driver to your lib-folder or by adding a dependency to your build-file (usually build.sbt).

Make sure that either the jar-file containing the driver is in your lib-folder or the appropriate dependency has been added to the build.sbt-file.

[edit] I did a bit further research for you and it is probably the best solution to copy the jar-file containing the driver into the lib-directory. Have a look at the documentation of Play, regarding unmanaged dependencies: https://www.playframework.com/documentation/2.3.x/SBTDependencies