JDBC For Update Of - IBM AS400

This is a discussion on JDBC For Update Of - IBM AS400 ; I have a simple SELECT field1, field2 FROM library.table ORDER BY field1 FOR READ ONLY statement. This statement works fine on a Windows Apache server and using the "com.ibm.as400.access.AS400JDBCDriver" JDBC driver. We want to run our web application on a ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: JDBC For Update Of

  1. JDBC For Update Of

    I have a simple SELECT field1, field2 FROM library.table ORDER BY
    field1 FOR READ ONLY statement.

    This statement works fine on a Windows Apache server and using the
    "com.ibm.as400.access.AS400JDBCDriver" JDBC driver.

    We want to run our web application on a WebSphere 6.1 server on an
    iSeries. Now that same select statement with the
    "com.ibm.db2.jdbc.app.DB2Driver" as JDBC driver throws a SQL0511
    error, which says "FOR UPDATE OF" not allowed.

    If I change my statement to exclude the FOR READ ONLY, then I get a
    slighty different message about missing column names for the UPDATE
    clause.

    Next step was to include "jt400.jar" as library for my application and
    on the iSeries use the "com.ibm.as400.access.AS400JDBCDriver" JDBC
    driver as well. This time no problems at all.

    Where is the FOR UPDATE OF coming from ? Is there some property I need
    to set on my JDBC connection ? Is there some WebSphere configuration I
    need to set ?

    The iSeries is on V5R4 and has been installed with all the latest
    PTF's just two weeks ago.

  2. Re: JDBC For Update Of

    il 21/04/2008 18.11, Scrive Mark 38309320:
    > I have a simple SELECT field1, field2 FROM library.table ORDER BY
    > field1 FOR READ ONLY statement.
    >
    > This statement works fine on a Windows Apache server and using the
    > "com.ibm.as400.access.AS400JDBCDriver" JDBC driver.
    >
    > We want to run our web application on a WebSphere 6.1 server on an
    > iSeries. Now that same select statement with the
    > "com.ibm.db2.jdbc.app.DB2Driver" as JDBC driver throws a SQL0511
    > error, which says "FOR UPDATE OF" not allowed.
    >
    > If I change my statement to exclude the FOR READ ONLY, then I get a
    > slighty different message about missing column names for the UPDATE
    > clause.
    >
    > Next step was to include "jt400.jar" as library for my application and
    > on the iSeries use the "com.ibm.as400.access.AS400JDBCDriver" JDBC
    > driver as well. This time no problems at all.
    >
    > Where is the FOR UPDATE OF coming from ? Is there some property I need
    > to set on my JDBC connection ? Is there some WebSphere configuration I
    > need to set ?
    >
    > The iSeries is on V5R4 and has been installed with all the latest
    > PTF's just two weeks ago.

    In my opinion it's something to do with resultset type and resulset
    concurrency in creating the statement object.
    For example:
    connection.prepareStatement(select, ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    will allow to update the cursor, not otherwise.
    --
    Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñe joAlcoolInside
    Spaccamaroni andate a cagare/Spammers not welcome/Spammers vão à merda
    Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
    schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

  3. Re: JDBC For Update Of

    On 21 apr, 18:59, "Dr.UgoGagliardelli"
    wrote:
    > In my opinion it's something to do with resultset type and resulset
    > concurrency in creating the statement object.
    > For example:
    > connection.prepareStatement(select, ResultSet.TYPE_SCROLL_SENSITIVE,
    > ResultSet.CONCUR_UPDATABLE);
    > will allow to update the cursor, not otherwise.


    I will check the code tomorrow. But I don't think I am using a
    prepared statement, but use a direct query. Thanks for the pointer.

  4. Re: JDBC For Update Of

    On 22 apr, 00:04, Mark wrote:
    > On 21 apr, 18:59, "Dr.UgoGagliardelli"
    >
    > wrote:
    > > In my opinion it's something to do with resultset type and resulset
    > > concurrency in creating the statement object.
    > > For example:
    > > connection.prepareStatement(select, ResultSet.TYPE_SCROLL_SENSITIVE,
    > > ResultSet.CONCUR_UPDATABLE);
    > > will allow to update the cursor, not otherwise.

    >
    > I will check the code tomorrow. But I don't think I am using a
    > prepared statement, but use a direct query. Thanks for the pointer.


    I couldn't wait to check it out. You were right. CONCUR_UPDATABLE was
    the one messing things up. It was hidden somewhere in our framework...

  5. Re: JDBC For Update Of

    il 22/04/2008 0.04, Scrive Mark 40659424:
    > On 21 apr, 18:59, "Dr.UgoGagliardelli"
    > wrote:
    >> In my opinion it's something to do with resultset type and resulset
    >> concurrency in creating the statement object.
    >> For example:
    >> connection.prepareStatement(select, ResultSet.TYPE_SCROLL_SENSITIVE,
    >> ResultSet.CONCUR_UPDATABLE);
    >> will allow to update the cursor, not otherwise.

    >
    > I will check the code tomorrow. But I don't think I am using a
    > prepared statement, but use a direct query. Thanks for the pointer.

    prepared statement was just an example, Connection methods
    createStatement prepareStatement and prepareCall can have int, int
    arguments to set cursor concurrency.

    --
    Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñe joAlcoolInside
    Spaccamaroni andate a cagare/Spammers not welcome/Spammers vão à merda
    Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
    schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

+ Reply to Thread