db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kirill Volgin (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3416) Syntax error on executing "ROLLBACK" statement
Date Thu, 14 Feb 2008 14:49:11 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568950#action_12568950
] 

Kirill Volgin commented on DERBY-3416:
--------------------------------------

Sorry, but all I can see in 4.35.7 is that :
The following SQL-statements are preparable:
— All SQL-schema statements.
— All SQL-transaction statements.
— All SQL-session statements.
— The following SQL-data statements:
• <delete statement: searched>.
• <dynamic select statement>.
• <dynamic single row select statement>.
• <insert statement>.
• <update statement: searched>.
• <merge statement>
...

The following are the SQL-transaction statements:
— <start transaction statement>.
— <set transaction statement>.
— <set constraints mode statement>.
— <commit statement>.
— <rollback statement>.
— <savepoint statement>.
— <release savepoint statement>.

So I don't see why I can use <insert statement> in prepared statement, but can't use
<rollback statement>. As I understand, Derby supports ROLLBACK TO SAVEPOINT, but doesn't
ROLLBACK, that is a reason. And it doesn't violate the spec (see chapter 16.7):

It is implementation-defined whether the <SQL routine body> shall not contain an <SQL
connection statement>, an <SQL schema statement>, an <SQL dynamic statement>,
or
an <SQL transaction statement> other than a <savepoint statement>, <release
savepoint
statement>, or a <rollback statement> that specifies a <savepoint clause>.
NOTE 313 - Conforming SQL language shall not contain an <SQL connection statement> or
an
<SQL transaction statement> other than a <savepoint statement>, a <release
savepoint statement>,
or a <rollback statement> that specifies a <savepoint clause>, but an implementation
is not required
to treat this as a syntax error.

So, according to spec Derby MAY not treat "ROLLBACK" as Syntax error.  And it would be a nice
feature if Derby supports it.

> Syntax error on executing "ROLLBACK" statement
> ----------------------------------------------
>
>                 Key: DERBY-3416
>                 URL: https://issues.apache.org/jira/browse/DERBY-3416
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>            Reporter: Kirill Volgin
>             Fix For: 10.3.1.4
>
>
> Trying to execute the following code :
>        Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
>         Properties properties = new Properties();
>         properties.setProperty("user","");
>         properties.setProperty("password", "");
>         Connection con = DriverManager.getConnection("jdbc:derby:sample", properties);
>         con.createStatement().execute("ROLLBACK");
> I got the following error:
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "<EOF>" at line 1,
column 8.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:91)
> 	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:202)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:1572)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:585)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:528)
> 	at scriptella.driver.derby.DerbyScriptTest.test(DerbyScriptTest.java:54)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> Caused by: java.sql.SQLException: Syntax error: Encountered "<EOF>" at line 1,
column 8.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:135)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 29 more
> Caused by: ERROR 42X01: Syntax error: Encountered "<EOF>" at line 1, column 8.
> 	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:290)
> 	at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(ParserImpl.java:155)
> 	at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:280)
> 	at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
> 	at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:753)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:579)
> 	... 23 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message