ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject Re: Insert/update issues
Date Fri, 24 Mar 2006 18:00:01 GMT

<br><font size=2 face="Courier New">Sybase has an option: </font>
<br><font size=3>You can tell jConnect to ignore the doneinprocs via a
connection<br>
property &quot;IGNORE_DONE_IN_PROC&quot; = 'true'.</font>
<br>
<br><font size=2 face="Courier New">This allowed the exception to be raised
as listed below. The only issue I have with this is at first glance the
exception appears to be related to the SQLMap rather than an error from
the database. </font>
<br>
<br><font size=2 face="Courier New">&nbsp;Loading XML bean definitions
from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]</font>
<br><font size=2 face="Courier New">09:55:38,301 &nbsp;INFO [http-8080-Processor24]
- SQLErrorCodes loaded: [DB2, HSQL, MS-SQL, MySQL, Oracle, Informix, PostgreSQL,
Sybase]</font>
<br><font size=2 face="Courier New">09:55:38,551 ERROR [http-8080-Processor24]
- {CustomerServiceAction} </font><font size=2 color=#000080 face="Courier New"><u>org.springframework.jdbc.UncategorizedSQLException</u></font><font
size=2 face="Courier New">:
SqlMapClient operation; uncategorized </font><font size=2 color=#000080 face="Courier
New"><u>SQLException</u></font><font size=2 face="Courier New">
for SQL []; SQL state [null]; error code [90003]; &nbsp; </font>
<br><font size=2 face="Courier New">--- The error occurred in com/sybase/cosmos/dao/maps/BillTo.xml.
&nbsp;</font>
<br><font size=2 face="Courier New">--- The error occurred while applying
a parameter map. &nbsp;</font>
<br><font size=2 face="Courier New">--- Check the BillTo-insert-InlineParameterMap.
&nbsp;</font>
<br><font size=2 face="Courier New">--- Check the statement (update failed).
&nbsp;</font>
<br><font size=2 face="Courier New">--- Cause: </font><font size=2 color=#000080
face="Courier New"><u>com.sybase.jdbc3.jdbc.SybSQLException</u></font><font
size=2 face="Courier New">:
The County being inserted is not valid for the Country</font>
<br><font size=2 face="Courier New">and State being inserted. &nbsp;Go
to OEVALID to view/insert valid counties.; nested exception is </font><font size=2
color=#000080 face="Courier New"><u>com.ibatis.common.jdbc.exception.NestedSQLException</u></font><font
size=2 face="Courier New">:
&nbsp; </font>
<br><font size=2 face="Courier New">--- The error occurred in com/sybase/cosmos/dao/maps/BillTo.xml.
&nbsp;</font>
<br><font size=2 face="Courier New">--- The error occurred while applying
a parameter map. &nbsp;</font>
<br><font size=2 face="Courier New">--- Check the BillTo-insert-InlineParameterMap.
&nbsp;</font>
<br><font size=2 face="Courier New">--- Check the statement (update failed).
&nbsp;</font>
<br><font size=2 face="Courier New">--- Cause: </font><font size=2 color=#000080
face="Courier New"><u>com.sybase.jdbc3.jdbc.SybSQLException</u></font><font
size=2 face="Courier New">:
The County being inserted is not valid for the Country</font>
<br><font size=2 face="Courier New">and State being inserted. &nbsp;Go
to OEVALID to view/insert valid counties.</font>
<br><font size=2 face="sans-serif"><br>
Chris Mathrusse<br>
christopher.mathrusse@sybase.com<br>
Sybase, Inc<br>
One Sybase Drive<br>
Dublin, CA 94568<br>
(925) 236-5553</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>&quot;Jeff Butler&quot;
&lt;jeffgbutler@gmail.com&gt;</b> </font>
<p><font size=1 face="sans-serif">03/24/2006 09:47 AM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
user-java@ibatis.apache.org</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">user-java@ibatis.apache.org</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Re: Insert/update issues</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=3>iBATIS does not support multiple result sets. &nbsp;There
are several open JIRA issues related to stored procedures, and some talk
about changing this. &nbsp;But it's a big job.</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>If you can't change the way Sybase works in this cse (i.e.
raising an actual error rather than sending another result set), then you
are stuck.</font>
<br><font size=3>&nbsp;</font>
<br><font size=3>Jeff Butler<br>
<br>
 </font>
<br><font size=3>On 3/24/06, </font><a href=mailto:Christopher.Mathrusse@sybase.com><font
size=3 color=blue><b><u>Christopher.Mathrusse@sybase.com</u></b></font></a><font
size=3>
&lt;</font><a href=mailto:Christopher.Mathrusse@sybase.com><font size=3
color=blue><u>Christopher.Mathrusse@sybase.com
</u></font></a><font size=3>&gt; wrote: </font>
<br><font size=2 face="sans-serif"><br>
I'm working with Sybase ASE 12 using JConnect 6.0 JDBC driver. The problem
that I am having is when I perform an insert or an update into a table
that has a trigger, and the trigger calls RaiseError, the error does not
get converted into an SQLException. &nbsp;It appears that this information
will be sent back to the calling application in the form of a resultSet.
Seeing as a call to execute() could return multiple ResultSets, I'm told
the proper way to access this information is to retrieve all resultSet
returned by the PreparedStatement. </font><font size=3><br>
</font><font size=2 face="sans-serif"><br>
The JDBC API docs do make reference to this:</font><font size=3> <br>
The </font><font size=3><tt>execute</tt></font><font size=3>
method returns
a </font><font size=3><tt>boolean</tt></font><font size=3>
to indicate
the form of the first result. You must call either the method </font><font size=3><tt>getResultSet</tt></font><font
size=3>
or </font><font size=3><tt>getUpdateCount </tt></font><font
size=3>to retrieve
the result; you must call </font><font size=3><tt>getMoreResults</tt></font><font
size=3>
to move to any subsequent result(s). <br>
</font><font size=2 face="sans-serif"><br>
I'm told the following: </font><font size=3><br>
<br>
Some methods only handle a single result and anything but the single result
will be an exception. When you consider stored procedures in particular
there is practically anything that can be returned. e.g.<br>
<br>
create proc xx as<br>
 &nbsp;select * from table &nbsp; &nbsp;==&gt; this only throw exception
if something like the table has been dropped etc. <br>
 &nbsp;raiserror xxx<br>
 &nbsp;select 1 <br>
 &nbsp;etc. <br>
<br>
Any method of query that only expects a single result is never going to
see the raiserror. &nbsp;Because it does not read the results far enough
to get to the error. <br>
<br>
<br>
result from server = &nbsp;|1. results set rows | 2. &nbsp;results message
| 3. results set rows | end of results |<br>
<br>
So consider results consisting of 3 different result sets if only result
#1 was read by the method and the program went on then the #2 results message
would <br>
not be read unless you used a method like &lt;statement&gt;.execute() and
process all results. &nbsp;Trigger output is like this. <br>
<br>
If let's say there were something wrong with the first select and there
was not a row result but a message, then you would see the SQLException
in the simple method like &lt;statement&gt;.executeQuery() . <br>
<br>
<br>
<br>
</font><font size=2 face="sans-serif"><br>
So what is my work around? How can I configure iBatis so I can receive
the error raised by the trigger?</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Thanks... <br>
<br>
Chris Mathrusse</font><font size=2 color=blue face="sans-serif"><u><br>
</u></font><a href=mailto:christopher.mathrusse@sybase.com target=_blank><font
size=2 color=blue face="sans-serif"><u>christopher.mathrusse@sybase.com
</u></font></a><font size=2 face="sans-serif"><br>
Sybase, Inc<br>
One Sybase Drive<br>
Dublin, CA 94568<br>
(925) 236-5553</font><font size=3> </font>
<br>
<br>

Mime
View raw message