Menu

@@IDENTITY to retrive the last identity inserted on a specific connection

Help
2014-08-06
2014-09-11
  • Robert Horton II

    SQL Server supports the following query:

    SELECT @@IDENTITY
    

    to get the primary key of the last record inserted on the current connection. The old JDBC_ODBC java driver also allowed it on an access database. Is there a way to use it with UCanAccess? I am on version 2.0.8.

     

    Last edit: Robert Horton II 2014-08-06
  • Marco Amadei

    Marco Amadei - 2014-08-07

    I've some problems to answer now, I should be able to do it next monday.

     
  • Robert Horton II

    Thank you. We recently switched to using UCanAccess withthe advent of Java 8. We were previously using the JDBC-ODBC bridge. We use the @@IDENTITY functionality quite frequently.

     
  • Marco Amadei

    Marco Amadei - 2014-08-08

    Using a bit of connectivity that I have finally got in this holiday location:
    this feature isn't currently supported but I think it's feasible.
    I'm going to confirm it next monday, in this forum thread.
    Cheers Marco

     
  • Gord Thompson

    Gord Thompson - 2014-08-10

    As luck would have it, I just logged in to make the same request. I tried both

    SELECT @@IDENTITY

    and

    PreparedStatement#getGeneratedKeys()

    Having them both work would be ideal, but either one would be okay with me.

     
  • Marco Amadei

    Marco Amadei - 2014-08-12

    Hi Gord and Robert,
    I should be able to implement both SELECT @@IDENTITY and
    PreparedStatement#getGeneratedKeys() in the next UCanAccess version,
    that I'm going to release before the end of August.
    Cheers Marco

     
  • Marco Amadei

    Marco Amadei - 2014-09-01

    SELECT @@IDENTITY and PreparedStatement#getGeneratedKeys() or Statement#getGeneratedKeys() implemented on svn trunk.
    I'm going to release the 2.0.9 during this week.

     
  • Marco Amadei

    Marco Amadei - 2014-09-11

    Added support to SELECT @@IDENTITY and PreparedStatement#getGeneratedKeys() or Statement#getGeneratedKeys() in the 2.0.9.

     

Log in to post a comment.