Skip to content

In the market for JDBC properties

It has been a while since my last post; head down updating the packages on the BI appliance, but that’s another story.

Java and JDBC applications seem to be the plat du jour and trying to peel away the layers getting to the JDBC settings and queries being executed in some of the frameworks can be a challenge.  Enabling JDBC tracing using a properties files requires the file being located within the CLASSPATH according to http://docs.ingres.com/Ingres/9.2/Connectivity%20Guide/jdbcdriverinterface.htm#o1237.  Many of the frameworks create the CLASSPATH environment based on files with specific extensions in specific directories, so what seems to be a valid directory in which to create iijdbc.properties can be a bit hit and miss.

Recently for me it has been necessary to set the system property ingres.jdbc.property_file as a parameter to the Java runtime.

A simple iijdbc.properties file enables logging and sets a couple of other properties created in for example, /tmp.
ingres.jdbc.lob.cache.enabled=true
ingres.jdbc.trace.log=/tmp/iijdbc.log
ingres.jdbc.trace.timestamp=true
ingres.jdbc.trace.drv=5
ingres.jdbc.property.timezone=NA-PACIFIC

The following passes the system property specifying the property file as an argument to the runtime environment executing a the class JdbcInfo and testing the connection to the imadb database.
cd $II_SYSTEM/ingres.lib
java -cp .:iijdbc.jar -Dingres.jdbc.property_file=/tmp/iijdbc.properties JdbcInfo jdbc:ingres://localhost:I17/imadb
Error establishing connection:
Communications error while establishing connection.

The connection failed and the log output from the command:
2009-04-24 13:25:03.788: Ingres Corporation - JDBC Driver [3.4.3]: Fri Apr 24 13:25:03 EDT 2009
2009-04-24 13:25:03.797: Ingres-Driver: registered
2009-04-24 13:25:03.805: Ingres-Driver.connect()
2009-04-24 13:25:03.812: Conn: lob.cache.enabled=true
2009-04-24 13:25:03.813: Conn: Connecting to server: localhost:I17
2009-04-24 13:25:03.853: MsgIo[0]: connection error - all addresses failed
2009-04-24 13:25:03.856: Ingres-Driver.connect(): error establishing connection
2009-04-24 13:25:03.856: Exception: 08001, 0xc4001
2009-04-24 13:25:03.856: Message: Communications error while establishing connection.
2009-04-24 13:25:03.857: Exception: null, 0x0
2009-04-24 13:25:03.857: Message: Connection refused

Although easily enough to spot from the command line the connection URL is incorrect in this case and the instance identifier should be II, but the log contains more detail.

Here’s the output from the successfully executed command after the instance identifier has been corrected:
java -cp .:iijdbc.jar -Dingres.jdbc.property_file=/tmp/iijdbc.properties JdbcInfo jdbc:ingres://localhost:II7/imadb
Ingres Corporation - JDBC Driver [3.4.3]: (JDBC 3.0)
INGRES [9.2]: II 9.2.0 (int.rpl/143)

Related posts