Cannot convert from SQL type 0 to C type 4.

Posted by Admin on 03-Sep-2009 16:08

My Code below displays an error as such:

Error:- Exception: [JDBC Progress Driver]:Unable to convert column 1. Cannot convert from SQL type 0 to C type 4.

Can anyone explain me the reason? How to overcome this error?

I had this program working on 9.1E, but running the same on 10.1C displays an error?

Is there any change in the SQL syntax or change in the results format for progress10.1C driver?

try{
           Connection con=null;
           Statement stmt;
           Class.forName("com.progress.sql.jdbc.JdbcProgressDriver");
           con=DriverManager.getConnection("jdbc:JdbcProgress:T:10.180.161.140:15500:prodproxy","test","test");
           stmt=con.createStatement();
                                 
            ResultSet rs = stmt.executeQuery("SELECT count(*) FROM pub.ctry_mstr");
            while (rs.next()) {
            int numberOfRows = rs.getInt(1);  *// ERROR in THIS LINE*
           System.out.println("Number of Rows : " +numberOfRows);
}
    } catch(Exception ex) {
                                       System.out.print("Exception: ");
                                       System.out.println(ex.getMessage());
                                  }
         

All Replies

Posted by ChUIMonster on 04-Sep-2009 06:47

This is just a wild guess (I don't mess with SQL in Java) but... many integer values went from 32 bits to 64 bits in the v9 to oe10 transition.

Posted by Admin on 10-Sep-2009 15:05

Well, upon investigating I found out that the query "Select count(*) from table_name" is returning . So the question now lies is how to get the row count from Progress 10.1C database using the JDBCProgress driver bridge.

As the previous version(9.1E) successfully parsed this query and returned an Integer, the drivers supplied for 9.1E(progress.jar) successsfully converted my SQL-92 queries to appropriate 4GL which Progress can understand. Now, 10.1C comes with two drivers(openedge.jar, progress.jar) to connect database, and these drivers are finding difficulty/failing to recognize Count() query. Or there might be a bug in Progress drivers.

Any suggestions?

This thread is closed