tags:

views:

75

answers:

1

The scenario is like that. User will specify a database table name and the system will retrieve and display all the data stored in the specified informix database table.

Class.forName("com.informix.jdbc.IfxDriver");

Connection conn = DriverManager.getConnection(connUrl)
Statement stmt = conn.createStatement();

ResultSet rs = stmt.executeQuery("select * from an_ifx_table");

The an_ifx_table is any table name specified by user. The problem is there is a column defined with BigSerial data type. So, the code will always throw an exception:

java.sql.SQLException: bigserial
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3204)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3518)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2353)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2269)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1428)
    at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1401)
    at com.informix.jdbc.IfxResultSet.a(IfxResultSet.java:204)

As which table the system is retrieving the data from is going to be specified by user, we can't skip or cast the column with BigSerial data type.

Any suggestion to handle this scenario?

+1  A: 

I have just created table with SERIAL8 column, filled it with some data and I can read all data from ResultSet.

Maybe your JDBC driver is old?

I use JDBC driver from JDBC.3.50.JC5.tar. You can also try JDBC-ODBC bridge. Install Informix ClientSDK, create ODBC source and then as driver use:

sun.jdbc.odbc.JdbcOdbcDriver

and as connUrl:

jdbc:odbc:[ODBC_source_name]

On my Windows machine I use clientsdk.3.50.TC5.WIN.zip, and on Linux I use clientsdk.3.50.UC5.LINUX.tar

Michał Niklas
Thanks friend! I just checked. My Informix JDBC Driver is obsolete. Just downloaded JDBC.3.50.JC5.tar and tested it. Everything works fine now.
poh