[ 
https://issues.apache.org/jira/browse/TUSCANY-1353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513873
 ] 

Ron Gavlin commented on TUSCANY-1353:
-------------------------------------

The problem appears to be a DataDirect JDBC bug that is triggered when 
STATEMENT.RETURN_GENERATED_KEYS is true and setAutoCommit is false. In many DAS 
deployments, this will be a common situation. 

Obviously, providing a convenient, externalized mechanism for controlling the 
useGetGeneratedKeys flag is desired. Hibernate allows this setting to be 
controlled via a property named hibernate.jdbc.use_get_generated_keys which can 
be set as a system property or in the hibernate configuration file. In the 
absence of this property, hibernate uses the database metadata 
supportsGetGeneratedKeys. This seems like the right approach to me. 

As Amita suggested on the mailing list, how about adding an optional <Config> 
attribute named databaseGeneratedKeys (or useGetGeneratedKeys). If absent, the 
value is derived from the database metadata supportsGetGeneratedKeys. If 
present, the supplied value is used. I personally don't think add'l 
bulletproofing is required. For folks with multiple DAS config files, a JVM 
property which overrides the <Config> databaseGeneratedKeys attribute might be 
convenient. However, since DAS doesn't currently support configuration by JVM 
properties, I don't think it makes sense to introduce this configurable as a 
JVM property. 

Thoughts?

- Ron

> Exception attempting to insert rows using DAS w/DataDirect JDBC driver
> ----------------------------------------------------------------------
>
>                 Key: TUSCANY-1353
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1353
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java DAS RDB
>    Affects Versions: Java-DAS-M2
>         Environment: Windows XP, WebLogic 8.1SP6, Sybase 12.5, DataDirect 
> Sybase JDBC driver (embedded within BEA WebLogic)
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Greetings,
> I am having problems inserting rows with Tuscany DAS M2 using the BEA 
> WebLogic Sybase JDBC driver (DataDirect Connect for JDBC 3.6 June 2007)) 
> which is an embedded version of the popular DataDirect JDBC driver. Although 
> I have not tested it, I suspect this problem appears in non-Sybase versions 
> of the driver as well. The code below generates the listed stacktrace. Note: 
> BEA apparently renames the DataDirect Connect for JDBC classes as part of its 
> embedding process.
> ...
> Command insert = das.createCommand("insert into Test (testCol1, testCol2) 
> values (?, ?)");
> insert.setParameter(1, "str1");
> insert.setParameter(2, "str2");
> insert.execute();
> Stacktrace:
> Caused by: java.sql.SQLException: [BEA][Sybase JDBC Driver]No rows affected.
>     at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
>     at weblogic.jdbc.base.BaseException.getException(Unknown Source)
>     at weblogic.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
>     at weblogic.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
>     at 
> weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:159)
>     at 
> org.apache.tusany.das.rdb.impl.Statement.executeUpdate(Statement.java:173)
>     at 
> org.apache.tusany.das.rdb.impl.Statement.executeUpdate(Statement.java:133)
>     at 
> org.apache.tusany.das.rdb.impl.InsertCommandImpl.execute(InsertCommandImpl.java:44)
> While interactively debugging 
> org.apache.tuscany.das.rdb.impl.ConnectionImpl.prepareStatement(String 
> queryString, String[] returnKeys), I noticed if I manually change the boolean 
> member variable useGetGeneratedKeys to false, no exception is generated and 
> the insert works as designed. 
> The DataDirect Connect for JDBC drivers are either supported or embedded into 
> numerous commercial application servers, including IBM WebSphere 6.1, jBoss 
> 4.x, and BEA WebSphere. Folks using these platforms are likely to quickly hit 
> this problem if they attempt to use the DAS. 
> - Ron

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to