HI there!

I have just migrated to my application from hsqldb to SQLite-2.8 using
the jdbc-driver from christian werner.
However I have a problem with the following statement which is used very
oftern to increment indexes.
I know this is not a cool way to archieve this, however I must be 100%
fully SQL conform so I simply "synchronized" the method so that no
multithreding problems can occur.

I use the following code:

select max("+keyName+") from "+tableName+"
rs.next();
return rs.getInt(keyName);

This worked with HSQLDB, whith SQLite I get the following error:

java.sql.SQLException: column CALKEY not found
   at
SQLite.JDBC2x.JDBCResultSetMetaData.findColByName(JDBCResultSetMetaData.java:189)
   at SQLite.JDBC2x.JDBCResultSet.findColumn(JDBCResultSet.java:52)
   at SQLite.JDBC2x.JDBCResultSet.getInt(JDBCResultSet.java:145)
   at
palme.communication.logicElements.GeneralLogic.getMaxID(GeneralLogic.java:69)
   at
palme.communication.logicElements.Division.replyInsertDivision(Division.java:84)
   at
palme.communication.ClientRepresentation.readRequest(ClientRepresentation.java:136)
   at
palme.communication.PalmeSocketInstance.run(PalmeSocketInstance.java:47)
   at java.lang.Thread.run(Thread.java:534)

any ideas how the same thing could be done using 100% standard-SQL?

Thanks a lot, lg Clemens



Reply via email to