List:MySQL and Java« Previous MessageNext Message »
From:Steve Forsyth Date:July 16 2002 3:58am
Subject:Re: returning identity field from a select statement
View as plain text  
I found this on the web... it is from a jsp and they use tags but it looks 
like you just need to call identity()

Haven't used it myself but this looks pretty straight forward.


<%!
   String id=null;   // used to get database insert identity
%>

<%-- get the identity of last insert record --%>
<sql:query>
call  identity()
</sql:query>
<sql:resultSet id="rset2">
<%
id=rset2.getString(1);
%>
</sql:resultSet>



>From: MHall@stripped
>To: java@stripped
>Subject: returning identity field from a select statement
>Date: Tue, 16 Jul 2002 12:28:36 +1000
>
>MYSQL already has a function mysql_insert_id() for use in the C API but
>this does not work in java.
>
>Is there an equivalent function that I can use in my Java servlet to return
>the identity field after an insert ?
>
>I am using the version 1.4 JDK and the version 2.0.14 MM.MYSQL JDBC Driver
>for mySQL .
>
>I am using version 3.23.36 of mySQL.
>
>Can anyone help ?
>
>
>
>Michael Hall
>Email: MHall@stripped
>
>
>
>---------------------------------------------------------------------
>Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
>posting. To request this thread, e-mail java-thread4005@stripped
>
>To unsubscribe, send a message to the address shown in the
>List-Unsubscribe header of this message. If you cannot see it,
>e-mail java-unsubscribe@stripped instead.




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

Thread
returning identity field from a select statementMHall16 Jul
  • Re: returning identity field from a select statementJeff Kilbride16 Jul
    • RE: returning identity field from a select statementJon Frisby19 Jul
      • Re: returning identity field from a select statementMark Matthews19 Jul
        • RE: returning identity field from a select statementJon Frisby19 Jul
  • Re: returning identity field from a select statementTim Endres16 Jul
  • Re: returning identity field from a select statementJavier BolaƱos Molina(MCIC)16 Jul
    • Re: returning identity field from a select statementAndrew Houghton16 Jul
Re: returning identity field from a select statementMark Matthews16 Jul
Re: returning identity field from a select statementSteve Forsyth16 Jul
Re: returning identity field from a select statementSteve Forsyth16 Jul
  • Re: returning identity field from a select statementMark Matthews16 Jul