Sequence Numbers

Steve <[email protected]>
Newsgroups gmane.comp.db.mysql.java
Message-ID <[email protected]>
I have a requirement where I need to use MySQl to store the last used 
number for various uses in another system. My only access to MySQL is 
Java, therefore JDBC. Using the MySQL connector, and the standard logic 
for sequence numbers, i.e.:

update ids set id_value = last_insert_id(id_value + 1) where id_name = 
"SOMEKEY";

Works great using the MySQL client program, but, when used as a 
statement in JDBC, it chokes on the last_insert_id, it says:

java.lang.Exception: com.fourd.jdbc.SQLParser::parseUPDATEList: 
Unexpected value - last_insert_id

It appears JDBC does not allow the use of the last_insert_id information 
function where used in this manner.

So, if that is the case, what is the best way to handle retrieving 
sequential numbers? I do NOT want to insert records and use the ol auto 
increment as I am not storing any data in MySQL among other reasons.

So, using JDBC, what is the most efficient way of handling this?

Steve

-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.