db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Burk Mayer <burk.ma...@gmail.com>
Subject precompile statement with result offset and fetch first clauses
Date Thu, 04 Feb 2010 12:23:52 GMT
hi,

i'm getting an error while precompiling a prepared statement with offset and
fetch first clauses.

the documentation (
http://db.apache.org/derby/docs/dev/ref/rrefsqljoffsetfetch.html#rrefsqljoffsetfetch)<http://db.apache.org/derby/docs/dev/ref/rrefsqljoffsetfetch.html#rrefsqljoffsetfetch>,
provides following example*:
*

*SELECT * FROM T ORDER BY I OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY*

the prepared statement looks like:

*Connection con = datasource.getConnection();
PreparedStatement p = con.prepareStatement("**SELECT * FROM T ORDER BY
I OFFSET ? ROWS FETCH NEXT ? ROWS ONLY**");
***

but an SQLException is thrown: Syntax error: Encountered "?" at line 1,
column 60.

i'm using following version of derby:
Bundle-Name: Apache Derby 10.5
Bundle-Version: 10.5.3000000.802917

the connection is created from a container-managed connection-pool
datasource:

     <Resource
       name="jdbc/prototype"
       auth="Container"
       type="javax.sql.DataSource"
       driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
       url="jdbc:derby:memory:prototype;create=true"
       username=""
       password=""
       maxActive="10"
       maxIdle="5"
       maxWait="10000"
     />

thank you for your support,
burk

Mime
View raw message