JDBC connection to version 5.x Informix engine?
Posted in 2004
Topics: Connectivity: ODBC / JDBC / .NET, Security, Permissions & Auditing, Networking & sqlhosts Configuration, Java & JDBC Development
I have been trying to use JDBC (with the Informix 2.21.JC5 jdbc driver) to connect to a version 5.10 database engine running on the same RS/6000 machine as where my java program is running. If I try to connect to a version 9.x engine (without the USEV5SERVER attribute in the URL), it works just fine. Whenever I add the USEV5SERVER attribute, I get the error shown below - even when I try using it with a version 9.x instance, but with a "0" value for the attribute. I have added the "USEV5SERVER=1" attribute to the connection URL that my program is using for the connection, but I get this error(along with my debugging messages showing the URL and a stacktrace): After loading Informix jdbc driver... URL: "jdbc:informix-sqli://devel:4002/money_mgr:INFORMIXSERVER=generic_bank;USEV5SERVER=1;" Error: java.lang.ClassCastException: java.lang.NoSuchMethodError java.lang.NoSu chMethodError java.lang.ClassCastException: java.lang.NoSuchMethodError at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:247) at java.sql.DriverManager.getConnection(DriverManager.java:543) at java.sql.DriverManager.getConnection(DriverManager.java:216) at AIXJdbcConnection.<init>(AIXJdbcConnection.java:31) at TestProg.saveData(TestProg.java:574) at TestProg.processFile(TestProg.java:80) at TestProg.main(TestProg.java:53) We have the "generic_bank" DBSERVERNAME set up in the sqlhosts file to match the line in the tbconfig file, and the 4002 port set up for it as a tcp connection port in the /etc/services file, and can access it from other Informix instances on the machine through I-Star with the "money_mgr@generic_bank:<table_name> syntax in isql, so I believe that the engine is set up correctly with the sqlexecd daemon running for it. To me, the error seems to be suggesting that the getConnection() method is trying to call a method to deal with the USEV5SERVER attribute, based upon the attribute name, but that it does not exist... Am I trying to use a version of the Informix JDBC driver that does not actually support the attribute (even though the accompanying documentation says it does)? Also, I tried using the "demo1" demo program that comes with the JDBC driver to connect to both a version 9.x and a version 5.10 engine (adding the USEV5SERVER=1 attribute for the 5.1 instance) with the same results - the 9.x version works, and the 5.1 attempt fails. The "user" and "password" tokens are not necessary on this instance, since we have granted "connect" access to public on this system - when I connect to the version 9.x instance it works with or without the user and password attributes. I have also tried leaving off the trailing ";" after the USEV5SERVER=1 attribute, but get the same result. Has anyone had this problem and found a solution yet - I expect that it's something very small that I'm missing here... Thanks in advance, -mark-