Since you have to cast your Statement to the MySQL specific statement class 
to use that method, you've now tied your code to a database.  Don't use 
driver specific functionality unless you always want to use that particular 
database product.

Dave


>From: "Edwin van Nuil" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: Auto Increment with JDBC and MySQL stopped working ?
>Date: Tue, 13 Aug 2002 14:55:11 +0200
>
>I have a application where I use the statement :
>
>last_id = ((org.gjt.mm.mysql.Statement) pstmt).getLastInsertID();
>
>with struts 1.1b1 and mm.mysql driver (most recent) it works good. But
>now I have upgraded to a newer version of struts (and mysql) and it
>stopped working. I get the following error :
>
>java.lang.ClassCastException:
>org.apache.commons.dbcp.DelegatingPreparedStatement
>       at
>nl.linuxonline.shop.product.PictureJdbcBean.insert(PictureJdbcBean.java:
>67)
>       at
>nl.linuxonline.shop.product.CreatePictureAction.execute(CreatePictureAct
>ion.java:100)
>       at
>org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr
>ocessor.java:446)
>.....
>
>I replaced the code with a max(id) and now it works again, but does
>anybody know why this doesn't work anymore ??
>
>Or is there a better way to use autoincrement ??
>
>Regards,
>
>Edwin
>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to