2nd try: embedded newlines in SQL in Java/JDBC v8 changed things?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • allenj@ndr.com

    2nd try: embedded newlines in SQL in Java/JDBC v8 changed things?

    Maybe I'm just being dense, but this seems like a legitimate question.
    Here's my 2nd try. Can someone please comment? Blair? Serge?
    -----------------------------------------------------
    Under DB2 v7, while writing JDBC/Java/SQL code to query the database,
    I could embed newlines in my SQL, ala:

    ResultSet rs = stmt.executeQue ry("select blah \n"
    +"from blahblah") ;
    This worked fine.

    However, if I try this under DB2 v8, I get:

    SQL Error Code -7, SQL State 42601, The character "
    " following "select blah " is not valid.

    Why is this?

    And before anyone asks: the reason I embed newlines in SQL is so that
    the offending SQL printed in errors/exceptions is across multiple
    lines and is easier to read.

    And along the same lines: many of my developers, while writing
    JDBC/Java/SQL code to query the database (see above), would append a
    semi-colon to the end of SQL statements. In DB2 v7 this worked fine.
    Under v8 you get:
    SQL Error Code -104, SQL State 42601, An unexpected token ""
    was found following "". Expected tokens may include: "lah from
    blah". Why?

    TIA

    Allen
Working...