You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by mfs <fa...@gmail.com> on 2008/05/07 05:18:41 UTC

Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Guys,

I just started using iBatis, and i think its a great framework, and would
want to employ the same in our company for the persistance layer...Also
"iBatis in Action" is a very well written book, great job Clinton, Larry and
Brandon...

Anyways coming to the problem...So am facing this "protocol voilation" error
when using oraclecursors (have followed the example on wiki) propogated on
SimpleDataSource.pushConnection() with the stack trace below...using selects
just works fine its just when using oraclecursors i face this problem

Also after the stack trace i have posted by sqlmap-config and sqlmapping
itself and the client.. 

would appreciate any input..

Exception in thread "main" java.sql.SQLException: Protocol violation
	at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:166)
	at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:217)
	at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:1377)
	at oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:132)
	at oracle.jdbc.driver.T4CConnection.do_rollback(T4CConnection.java:530)
	at
oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:1291)
	at
com.ibatis.common.jdbc.SimpleDataSource.pushConnection(SimpleDataSource.java:527)
	at
com.ibatis.common.jdbc.SimpleDataSource.access$100(SimpleDataSource.java:52)
	at
com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:954)
	at $Proxy0.close(Unknown Source)
	at
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.close(JdbcTransaction.java:81)
	at
com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:111)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:782)
	at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176)
	at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:154)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:883)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:622)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
	at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
	at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)


<-- XYZCertificate.xml -->

<sqlMap namespace="Certificate">

  <typeAlias alias="certificate" type="company.xyzcore.domain.Certificate"/>

  <resultMap id="certificateResult" class="exemptionCertificate">
    <result property="certificateId" column="CERT_ID"/>
    <result property="name" column="NAME"/>
    </resultMap>

  <parameterMap id="outCursorParamMap" class="map">
  		<parameter property="criteriaParam" jdbcType="int"
javaType="java.lang.Integer" mode="IN"/>
		<parameter property="outputCursorParam" jdbcType="ORACLECURSOR" mode="OUT"
resultMap="certificateResult" />
  </parameterMap>

  <procedure id="getCertificateByCertificateId"
parameterMap="outCursorParamMap">
         { call test.concept_test_api.get_cert_id(?, ?) }
  </procedure>

</sqlMap>



<!-- SQL MAP CONFIG -->

<sqlMapConfig>

<transactionManager type="JDBC" commitRequired="false">
		<dataSource type="SIMPLE">
			<property name="JDBC.Driver" value="oracle.jdbc.OracleDriver" />
			<!--property name="JDBC.ConnectionURL"
value="jdbc:oracle:thin:@192.168.111.212:1521:somedb" /-->
			<property name="JDBC.ConnectionURL"
value="jdbc:oracle:thin:@//192.168.111.106:1521/mydb" />
			<property name="JDBC.Username" value="myusername" />
			<property name="JDBC.Password" value="mypassword" />
		</dataSource>
</transactionManager>

  <sqlMap resource="company/xyz/core/persistence/XYZCertificate.xml"/>

</sqlMapConfig>

Caller code
-------------------

        String resource;
        Reader reader;
        SqlMapClient sqlMap;
        resource = "company/xyz/core/persistence/sql-map-config.xml";
        reader = Resources.getResourceAsReader(resource);
        sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);

     
        HashMap params = new HashMap();
        params.put("criteriaParam", new Integer(11));
        List list = sqlMap.queryForList("getCertificateByCertificateId",
params); 


Thanks in advance..

-- 
View this message in context: http://www.nabble.com/Protocol-Error---SimpleDataSource.pushConnection%28%29-when-using-oraclecursors-tp17093837p17093837.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by mfs <fa...@gmail.com>.
So turns out it was jdbc driver version issue, though initially i was using
the jdbc driver version as my database version but i had to upgrade to the
next rather the latest version in the 10 series i.e. 10.2.0.4.0 to get the
problem fixed..


Thanks anyways..



mfs wrote:
> 
> Guys,
> 
> I just started using iBatis, and i think its a great framework, and would
> want to employ the same in our company for the persistance layer...Also
> "iBatis in Action" is a very well written book, great job Clinton, Larry
> and Brandon...
> 
> Anyways coming to the problem...So am facing this "protocol voilation"
> error when using oraclecursors (have followed the example on wiki)
> propogated on SimpleDataSource.pushConnection() with the stack trace
> below...using selects just works fine its just when using oraclecursors i
> face this problem
> 
> Also after the stack trace i have posted by sqlmap-config and sqlmapping
> itself and the client.. 
> 
> would appreciate any input..
> 
> Exception in thread "main" java.sql.SQLException: Protocol violation
> 	at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:166)
> 	at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:217)
> 	at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:1377)
> 	at oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:132)
> 	at oracle.jdbc.driver.T4CConnection.do_rollback(T4CConnection.java:530)
> 	at
> oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:1291)
> 	at
> com.ibatis.common.jdbc.SimpleDataSource.pushConnection(SimpleDataSource.java:527)
> 	at
> com.ibatis.common.jdbc.SimpleDataSource.access$100(SimpleDataSource.java:52)
> 	at
> com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:954)
> 	at $Proxy0.close(Unknown Source)
> 	at
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.close(JdbcTransaction.java:81)
> 	at
> com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:111)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:782)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:154)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:883)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:622)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)
> 
> 
> <-- XYZCertificate.xml -->
> 
> <sqlMap namespace="Certificate">
> 
>   <typeAlias alias="certificate"
> type="company.xyzcore.domain.Certificate"/>
> 
>   <resultMap id="certificateResult" class="exemptionCertificate">
>     <result property="certificateId" column="CERT_ID"/>
>     <result property="name" column="NAME"/>
>     </resultMap>
> 
>   <parameterMap id="outCursorParamMap" class="map">
>   		<parameter property="criteriaParam" jdbcType="int"
> javaType="java.lang.Integer" mode="IN"/>
> 		<parameter property="outputCursorParam" jdbcType="ORACLECURSOR"
> mode="OUT" resultMap="certificateResult" />
>   </parameterMap>
> 
>   <procedure id="getCertificateByCertificateId"
> parameterMap="outCursorParamMap">
>          { call test.concept_test_api.get_cert_id(?, ?) }
>   </procedure>
> 
> </sqlMap>
> 
> 
> 
> <!-- SQL MAP CONFIG -->
> 
> <sqlMapConfig>
> 
> <transactionManager type="JDBC" commitRequired="false">
> 		<dataSource type="SIMPLE">
> 			<property name="JDBC.Driver" value="oracle.jdbc.OracleDriver" />
> 			<!--property name="JDBC.ConnectionURL"
> value="jdbc:oracle:thin:@192.168.111.212:1521:somedb" /-->
> 			<property name="JDBC.ConnectionURL"
> value="jdbc:oracle:thin:@//192.168.111.106:1521/mydb" />
> 			<property name="JDBC.Username" value="myusername" />
> 			<property name="JDBC.Password" value="mypassword" />
> 		</dataSource>
> </transactionManager>
> 
>   <sqlMap resource="company/xyz/core/persistence/XYZCertificate.xml"/>
> 
> </sqlMapConfig>
> 
> Caller code
> -------------------
> 
>         String resource;
>         Reader reader;
>         SqlMapClient sqlMap;
>         resource = "company/xyz/core/persistence/sql-map-config.xml";
>         reader = Resources.getResourceAsReader(resource);
>         sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
> 
>      
>         HashMap params = new HashMap();
>         params.put("criteriaParam", new Integer(11));
>         List list = sqlMap.queryForList("getCertificateByCertificateId",
> params); 
> 
> 
> Thanks in advance..
> 
> 

-- 
View this message in context: http://www.nabble.com/Protocol-Error---SimpleDataSource.pushConnection%28%29-when-using-oraclecursors-tp17093837p17097949.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by BalaKishore Pamarti <bp...@yahoo.com>.
Yup works perfectly.
   
  sqlMap.queryForObject("getRefs", map);
System.out.println(map.get("o"));

  The above system.out statement prints "ResultSet". I was wanting a collection of java beans. queryForList() doesnt work, it returns am empty List
   
  

Larry Meadors <la...@gmail.com> wrote:
  http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=5653

Works perfectly.

Larry


On Wed, May 7, 2008 at 12:12 PM, BalaKishore Pamarti wrote:
> I was just concerned when you said "Its working now" and your code says you
> are getting the List (of beans) directly.
>
> If anyone can show me the code for getting the "List of beans" directly
> instead of "ResultSet" while using oracle stored procedures with REF CURSOR
> as OUT parameter I would appreciate. :)
>
> Cheers!
>
>
> "Peace is found not in what surrounds us, but in what we hold within."
>
> ________________________________
>
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.



"Peace is found not in what surrounds us, but in what we hold within."


       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by Larry Meadors <la...@gmail.com>.
http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=5653

Works perfectly.

Larry


On Wed, May 7, 2008 at 12:12 PM, BalaKishore Pamarti <bp...@yahoo.com> wrote:
> I was just concerned when you said "Its working now" and your code says you
> are getting the List (of beans) directly.
>
> If anyone can show me the code for getting the "List of beans" directly
> instead of "ResultSet" while using oracle stored procedures with REF CURSOR
> as OUT parameter I would appreciate. :)
>
> Cheers!
>
>
> "Peace is found not in what surrounds us, but in what we hold within."
>
>  ________________________________
>
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.

Re: How to get the generated key from insert with Oracle

Posted by Larry Meadors <la...@gmail.com>.
On Fri, May 9, 2008 at 8:12 AM, Chris O'Connell
<oc...@gorillachicago.com> wrote:
> Thanks.  I had never heard this before.  Just to make sure we are talking
> about the same thing, I'm not concerned about the sequence returning the
> same value to two different people when the trigger is calling 'nextval'.

I can say this with a great deal of certainty: That will not happen.

I have used oracle for about 8 years, in a few pretty big systems, and
it's never happened, not even once.

I wouldn't bet my life on it, but I'd bet a day's pay without hesitation. ;-)

Larry

Re: How to get the generated key from insert with Oracle

Posted by Sundar Sankar <fa...@gmail.com>.
Hi,
     When using Hibernate, I have tested the same using rolling back one
session and committing the second one and vice versa. If you observe, The
value u get after the transaction is over will be greater than both the
sequence Id's. That is, if first ones id is X and seconds is X+1, no matter
which transaction got rolled back, a third person accessing would always get
back X+2, even if X or X+1 was available. I am not sure if this is something
hibernate does, but it would be a good way to test The concurrency issue in
the application.

My $0.002

-Sundar

On Fri, May 9, 2008 at 8:08 AM, Chris O'Connell <oc...@gorillachicago.com>
wrote:

> Argh... sometimes it is that easy.
>
> Yep, two different sql plus sessions, the first will always get *it's*
> correct value of sequence.currval, regardless of how many times another
> session calls sequence.nextval.
>
> Thanks,
> Chris
>
> -----Original Message-----
> From: Clinton Begin [mailto:clinton.begin@gmail.com]
> Sent: Friday, May 09, 2008 9:43 AM
> To: user-java@ibatis.apache.org
> Subject: Re: How to get the generated key from insert with Oracle
>
> Easy enough to test... open two sqlplus sessions and step through an
> example...
>
>
> Clinton
>
> On Fri, May 9, 2008 at 8:12 AM, Chris O'Connell
> <oc...@gorillachicago.com> wrote:
> > Thanks.  I had never heard this before.  Just to make sure we are talking
> > about the same thing, I'm not concerned about the sequence returning the
> > same value to two different people when the trigger is calling 'nextval'.
> > I'm worried about the fact that two inserts could happen before my code
> that
> > tries to call "sequence.currvalue" can execute for the first insert and I
> > end up with two difference insert actions that get the same value for
> > "sequence.currvalue".
> >
> > It isn't that I don't believe you :) but this is counter to what I
> *thought*
> > I knew, so I'm trying to get a full understanding of what is going on.
> >
> > Thanks,
> > Chris
> >
> > -----Original Message-----
> > From: Larry Meadors [mailto:larry.meadors@gmail.com]
> > Sent: Thursday, May 08, 2008 5:38 PM
> > To: user-java@ibatis.apache.org
> > Subject: Re: How to get the generated key from insert with Oracle
> >
> > Not with a sequence, I've been told that they are 'session' aware, so
> > if you get id 123 in your session, no one else ever will.
> >
> > Larry
> >
> >
> > On Thu, May 8, 2008 at 4:21 PM, Chris O'Connell
> > <oc...@gorillachicago.com> wrote:
> >> Even if I am executing all of this inside a transaction, don't I still
> > have
> >>  concurrency issues with this approach?
> >>
> >>
> >>
> >>  -----Original Message-----
> >>  From: Larry Meadors [mailto:larry.meadors@gmail.com]
> >>  Sent: Thursday, May 08, 2008 5:12 PM
> >>  To: user-java@ibatis.apache.org
> >>  Subject: Re: How to get the generated key from insert with Oracle
> >>
> >>  I think this would be the preferred SQL for that:
> >>
> >>  select ids.currval from dual
> >>
> >>  ...where ids is your sequence's name.
> >>
> >>  Larry
> >>  No virus found in this incoming message.
> >>  Checked by AVG.
> >>  Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date:
> > 5/7/2008
> >>  5:23 PM
> >>
> >>
> > No virus found in this incoming message.
> > Checked by AVG.
> > Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date:
> 5/7/2008
> > 5:23 PM
> >
> >
> No virus found in this incoming message.
> Checked by AVG.
> Version: 8.0.100 / Virus Database: 269.23.14/1425 - Release Date: 5/9/2008
> 12:38 PM
>
>

RE: How to get the generated key from insert with Oracle

Posted by Chris O'Connell <oc...@gorillachicago.com>.
Argh... sometimes it is that easy.

Yep, two different sql plus sessions, the first will always get *it's*
correct value of sequence.currval, regardless of how many times another
session calls sequence.nextval.

Thanks,
Chris

-----Original Message-----
From: Clinton Begin [mailto:clinton.begin@gmail.com] 
Sent: Friday, May 09, 2008 9:43 AM
To: user-java@ibatis.apache.org
Subject: Re: How to get the generated key from insert with Oracle

Easy enough to test... open two sqlplus sessions and step through an
example...


Clinton

On Fri, May 9, 2008 at 8:12 AM, Chris O'Connell
<oc...@gorillachicago.com> wrote:
> Thanks.  I had never heard this before.  Just to make sure we are talking
> about the same thing, I'm not concerned about the sequence returning the
> same value to two different people when the trigger is calling 'nextval'.
> I'm worried about the fact that two inserts could happen before my code
that
> tries to call "sequence.currvalue" can execute for the first insert and I
> end up with two difference insert actions that get the same value for
> "sequence.currvalue".
>
> It isn't that I don't believe you :) but this is counter to what I
*thought*
> I knew, so I'm trying to get a full understanding of what is going on.
>
> Thanks,
> Chris
>
> -----Original Message-----
> From: Larry Meadors [mailto:larry.meadors@gmail.com]
> Sent: Thursday, May 08, 2008 5:38 PM
> To: user-java@ibatis.apache.org
> Subject: Re: How to get the generated key from insert with Oracle
>
> Not with a sequence, I've been told that they are 'session' aware, so
> if you get id 123 in your session, no one else ever will.
>
> Larry
>
>
> On Thu, May 8, 2008 at 4:21 PM, Chris O'Connell
> <oc...@gorillachicago.com> wrote:
>> Even if I am executing all of this inside a transaction, don't I still
> have
>>  concurrency issues with this approach?
>>
>>
>>
>>  -----Original Message-----
>>  From: Larry Meadors [mailto:larry.meadors@gmail.com]
>>  Sent: Thursday, May 08, 2008 5:12 PM
>>  To: user-java@ibatis.apache.org
>>  Subject: Re: How to get the generated key from insert with Oracle
>>
>>  I think this would be the preferred SQL for that:
>>
>>  select ids.currval from dual
>>
>>  ...where ids is your sequence's name.
>>
>>  Larry
>>  No virus found in this incoming message.
>>  Checked by AVG.
>>  Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date:
> 5/7/2008
>>  5:23 PM
>>
>>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date: 5/7/2008
> 5:23 PM
>
>
No virus found in this incoming message.
Checked by AVG. 
Version: 8.0.100 / Virus Database: 269.23.14/1425 - Release Date: 5/9/2008
12:38 PM


Re: How to get the generated key from insert with Oracle

Posted by Clinton Begin <cl...@gmail.com>.
Easy enough to test... open two sqlplus sessions and step through an example...


Clinton

On Fri, May 9, 2008 at 8:12 AM, Chris O'Connell
<oc...@gorillachicago.com> wrote:
> Thanks.  I had never heard this before.  Just to make sure we are talking
> about the same thing, I'm not concerned about the sequence returning the
> same value to two different people when the trigger is calling 'nextval'.
> I'm worried about the fact that two inserts could happen before my code that
> tries to call "sequence.currvalue" can execute for the first insert and I
> end up with two difference insert actions that get the same value for
> "sequence.currvalue".
>
> It isn't that I don't believe you :) but this is counter to what I *thought*
> I knew, so I'm trying to get a full understanding of what is going on.
>
> Thanks,
> Chris
>
> -----Original Message-----
> From: Larry Meadors [mailto:larry.meadors@gmail.com]
> Sent: Thursday, May 08, 2008 5:38 PM
> To: user-java@ibatis.apache.org
> Subject: Re: How to get the generated key from insert with Oracle
>
> Not with a sequence, I've been told that they are 'session' aware, so
> if you get id 123 in your session, no one else ever will.
>
> Larry
>
>
> On Thu, May 8, 2008 at 4:21 PM, Chris O'Connell
> <oc...@gorillachicago.com> wrote:
>> Even if I am executing all of this inside a transaction, don't I still
> have
>>  concurrency issues with this approach?
>>
>>
>>
>>  -----Original Message-----
>>  From: Larry Meadors [mailto:larry.meadors@gmail.com]
>>  Sent: Thursday, May 08, 2008 5:12 PM
>>  To: user-java@ibatis.apache.org
>>  Subject: Re: How to get the generated key from insert with Oracle
>>
>>  I think this would be the preferred SQL for that:
>>
>>  select ids.currval from dual
>>
>>  ...where ids is your sequence's name.
>>
>>  Larry
>>  No virus found in this incoming message.
>>  Checked by AVG.
>>  Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date:
> 5/7/2008
>>  5:23 PM
>>
>>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date: 5/7/2008
> 5:23 PM
>
>

RE: How to get the generated key from insert with Oracle

Posted by Chris O'Connell <oc...@gorillachicago.com>.
Thanks.  I had never heard this before.  Just to make sure we are talking
about the same thing, I'm not concerned about the sequence returning the
same value to two different people when the trigger is calling 'nextval'.
I'm worried about the fact that two inserts could happen before my code that
tries to call "sequence.currvalue" can execute for the first insert and I
end up with two difference insert actions that get the same value for
"sequence.currvalue".

It isn't that I don't believe you :) but this is counter to what I *thought*
I knew, so I'm trying to get a full understanding of what is going on.

Thanks,
Chris

-----Original Message-----
From: Larry Meadors [mailto:larry.meadors@gmail.com] 
Sent: Thursday, May 08, 2008 5:38 PM
To: user-java@ibatis.apache.org
Subject: Re: How to get the generated key from insert with Oracle

Not with a sequence, I've been told that they are 'session' aware, so
if you get id 123 in your session, no one else ever will.

Larry


On Thu, May 8, 2008 at 4:21 PM, Chris O'Connell
<oc...@gorillachicago.com> wrote:
> Even if I am executing all of this inside a transaction, don't I still
have
>  concurrency issues with this approach?
>
>
>
>  -----Original Message-----
>  From: Larry Meadors [mailto:larry.meadors@gmail.com]
>  Sent: Thursday, May 08, 2008 5:12 PM
>  To: user-java@ibatis.apache.org
>  Subject: Re: How to get the generated key from insert with Oracle
>
>  I think this would be the preferred SQL for that:
>
>  select ids.currval from dual
>
>  ...where ids is your sequence's name.
>
>  Larry
>  No virus found in this incoming message.
>  Checked by AVG.
>  Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date:
5/7/2008
>  5:23 PM
>
>
No virus found in this incoming message.
Checked by AVG. 
Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date: 5/7/2008
5:23 PM


Re: How to get the generated key from insert with Oracle

Posted by Larry Meadors <la...@gmail.com>.
Not with a sequence, I've been told that they are 'session' aware, so
if you get id 123 in your session, no one else ever will.

Larry


On Thu, May 8, 2008 at 4:21 PM, Chris O'Connell
<oc...@gorillachicago.com> wrote:
> Even if I am executing all of this inside a transaction, don't I still have
>  concurrency issues with this approach?
>
>
>
>  -----Original Message-----
>  From: Larry Meadors [mailto:larry.meadors@gmail.com]
>  Sent: Thursday, May 08, 2008 5:12 PM
>  To: user-java@ibatis.apache.org
>  Subject: Re: How to get the generated key from insert with Oracle
>
>  I think this would be the preferred SQL for that:
>
>  select ids.currval from dual
>
>  ...where ids is your sequence's name.
>
>  Larry
>  No virus found in this incoming message.
>  Checked by AVG.
>  Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date: 5/7/2008
>  5:23 PM
>
>

RE: How to get the generated key from insert with Oracle

Posted by Chris O'Connell <oc...@gorillachicago.com>.
Even if I am executing all of this inside a transaction, don't I still have
concurrency issues with this approach?

-----Original Message-----
From: Larry Meadors [mailto:larry.meadors@gmail.com] 
Sent: Thursday, May 08, 2008 5:12 PM
To: user-java@ibatis.apache.org
Subject: Re: How to get the generated key from insert with Oracle

I think this would be the preferred SQL for that:

select ids.currval from dual

...where ids is your sequence's name.

Larry
No virus found in this incoming message.
Checked by AVG. 
Version: 8.0.100 / Virus Database: 269.23.10/1421 - Release Date: 5/7/2008
5:23 PM


Re: How to get the generated key from insert with Oracle

Posted by Larry Meadors <la...@gmail.com>.
I think this would be the preferred SQL for that:

select ids.currval from dual

...where ids is your sequence's name.

Larry

How to get the generated key from insert with Oracle

Posted by Chris O'Connell <oc...@gorillachicago.com>.
So, I need to insert a User record.  I cannot change the database tables, so
I am stuck with the current behavior of my database.  On insert, there is a
trigger that selects a value from a SEQUENCE and updates the key with that
value.  I would like to return that value from the insert statement to my
java code.  I'm looking at the iBatis in Action book, and trying to figure
out how to do that.  I will include the parameter map I am using and the
<insert> statement below. To explain what you see below, the EMAIL field in
the database is unique, so if I create a new user with the provided email
address, I feel safe selecting that userID back out of the database based on
the email address.

However, this just feels clunky to me.  Is this the right way to do it?  Is
there a better way to get the new ID from the row I just created (given my
current constraint of not being able to change the database)?

Thanks,
Chris

<parameterMap id="UserParameterMap" class="com.gorilla.domain.users.User">
        <parameter property="pass" jdbcType="VARCHAR" />
        <parameter property="firstName" jdbcType="VARCHAR" />
        <parameter property="lastName" jdbcType="VARCHAR" />
        <parameter property="title" jdbcType="VARCHAR" />
        <parameter property="company" jdbcType="VARCHAR" />
        <parameter property="email" jdbcType="VARCHAR" />
        <parameter property="description" jdbcType="VARCHAR" />
        <parameter property="uuid" jdbcType="VARCHAR" />
        <parameter property="screenName" jdbcType="VARCHAR" />
        <parameter property="tradePortalId" jdbcType="VARCHAR" />
    </parameterMap>

<insert id="insertNewUser" parameterMap="UserParameterMap">
        INSERT INTO USER_USERS
            (PASS,
            FIRST_NAME,
            LAST_NAME,
            TITLE,
            COMPANY,
            EMAIL,
            DESCRIPTION,
            LOGIN_DATE,
            USER_UUID,
            MODIFY_DATE,
            SCREEN_NAME,
            TRADE_PORTAL_ID)
        VALUES
            (?,?,?,?,?,?,?,sysdate,?,sysdate,?,?)
        <selectKey resultClass="java.math.BigDecimal">
            select USER_ID from USER_USERS where EMAIL = #email#
        </selectKey>
    </insert> 


Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by mfs <fa...@gmail.com>.
Sure..!

bpamarti wrote:
> 
> Perfect!!
>    
>   Thanks a bunch!
> 
> mfs <fa...@gmail.com> wrote:
>   
> Actually i dont work on the List of beans (and i thought thats what u
> meant
> earlier)..i dont work on the resultset type at all, thats what i would
> expect the ibatis framework to take care of transform the resultset 
> entries into a list of bean as i configured in sql-map config file..
> 
> Here is my test client..
> 
> String resource;
> Reader reader;
> SqlMapClient sqlMap;
> resource = "company/xyz/core/persistence/sql-map-config.xml";
> reader = Resources.getResourceAsReader(resource);
> sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
> MyCertificate myCertificate = null;
> 
> HashMap params = new HashMap();
> // input criteria of type mode="IN"
> params.put("criteriaParam", new String("Int"));
> 
> sqlMap.queryForObject(
> "getMyCertificateByName", params);
> // mode="out" cursorparam part of the parameterMap, in which i ex
> List list = (List) params.get("outputCursorParam");
> 
> Iterator iterator = list.iterator();
> /* END */
> 
> while (iterator.hasNext())
> {
> myCertificate = (MyCertificate) iterator.next();
> System.out.println("--------------------");
> System.out.println(myCertificate.getName());
> System.out.println(myCertificate.getDate());
> System.out.println("--------------------");
> }
> 
> ----
> mapping file.xml
> 
> 
> 
> 
> javaType="java.lang.String" mode="IN"/>
> 
> jdbcType="ORACLECURSOR" mode="OUT" resultMap="resultMap[which is
> MyCertificate bean mapping]"/>
> 
> 
> 
> 
> 
> { call
> vcert.concept_test_clerk_ui_api.get_certs_by_business_name(?, ?) }
> 
> 
> 
> 
> Let me know if it helps..
> 
> 
> 
> bpamarti wrote:
>> 
>> I was just concerned when you said "Its working now" and your code says
>> you are getting the List (of beans) directly.
>> 
>> If anyone can show me the code for getting the "List of beans" directly
>> instead of "ResultSet" while using oracle stored procedures with REF
>> CURSOR as OUT parameter I would appreciate. :)
>> 
>> Cheers!
>> 
>> 
>> "Peace is found not in what surrounds us, but in what we hold within."
>> 
>> 
>> 
>> ---------------------------------
>> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
>> now.
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Protocol-Error---SimpleDataSource.pushConnection%28%29-when-using-oraclecursors-tp17093837p17111540.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 
> 
> 
> "Peace is found not in what surrounds us, but in what we hold within."
> 
> 
>        
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it
> now.
> 

-- 
View this message in context: http://www.nabble.com/Protocol-Error---SimpleDataSource.pushConnection%28%29-when-using-oraclecursors-tp17093837p17115481.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by BalaKishore Pamarti <bp...@yahoo.com>.
Perfect!!
   
  Thanks a bunch!

mfs <fa...@gmail.com> wrote:
  
Actually i dont work on the List of beans (and i thought thats what u meant
earlier)..i dont work on the resultset type at all, thats what i would
expect the ibatis framework to take care of transform the resultset 
entries into a list of bean as i configured in sql-map config file..

Here is my test client..

String resource;
Reader reader;
SqlMapClient sqlMap;
resource = "company/xyz/core/persistence/sql-map-config.xml";
reader = Resources.getResourceAsReader(resource);
sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
MyCertificate myCertificate = null;

HashMap params = new HashMap();
// input criteria of type mode="IN"
params.put("criteriaParam", new String("Int"));

sqlMap.queryForObject(
"getMyCertificateByName", params);
// mode="out" cursorparam part of the parameterMap, in which i ex
List list = (List) params.get("outputCursorParam");

Iterator iterator = list.iterator();
/* END */

while (iterator.hasNext())
{
myCertificate = (MyCertificate) iterator.next();
System.out.println("--------------------");
System.out.println(myCertificate.getName());
System.out.println(myCertificate.getDate());
System.out.println("--------------------");
}

----
mapping file.xml




javaType="java.lang.String" mode="IN"/>

jdbcType="ORACLECURSOR" mode="OUT" resultMap="resultMap[which is
MyCertificate bean mapping]"/>





{ call
vcert.concept_test_clerk_ui_api.get_certs_by_business_name(?, ?) }




Let me know if it helps..



bpamarti wrote:
> 
> I was just concerned when you said "Its working now" and your code says
> you are getting the List (of beans) directly.
> 
> If anyone can show me the code for getting the "List of beans" directly
> instead of "ResultSet" while using oracle stored procedures with REF
> CURSOR as OUT parameter I would appreciate. :)
> 
> Cheers!
> 
> 
> "Peace is found not in what surrounds us, but in what we hold within."
> 
> 
> 
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.
> 

-- 
View this message in context: http://www.nabble.com/Protocol-Error---SimpleDataSource.pushConnection%28%29-when-using-oraclecursors-tp17093837p17111540.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.




"Peace is found not in what surrounds us, but in what we hold within."


       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by mfs <fa...@gmail.com>.
Actually i dont work on the List of beans (and i thought thats what u meant
earlier)..i dont work on the resultset type at all, thats what i would
expect the ibatis framework to take care of transform the resultset 
entries into a list of bean as i configured in sql-map config file..

Here is my test client..

        String resource;
        Reader reader;
        SqlMapClient sqlMap;
        resource = "company/xyz/core/persistence/sql-map-config.xml";
        reader = Resources.getResourceAsReader(resource);
        sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
        MyCertificate myCertificate = null;
        
        HashMap params = new HashMap();
        // input criteria of type mode="IN"
        params.put("criteriaParam", new String("Int"));

        sqlMap.queryForObject(
                        "getMyCertificateByName", params);
        // mode="out" cursorparam part of the parameterMap, in which i ex
        List list = (List) params.get("outputCursorParam");

        Iterator iterator = list.iterator();
        /* END */
        
        while (iterator.hasNext())
        {
            myCertificate = (MyCertificate) iterator.next();
            System.out.println("--------------------");
            System.out.println(myCertificate.getName());
            System.out.println(myCertificate.getDate());
            System.out.println("--------------------");
        }

----
mapping file.xml

  <parameterMap id="paramMap" class="map">
  		<parameter property="criteriaParam" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN"/>
		<parameter property="outputCursorParam" javaType="java.sql.ResultSet"
jdbcType="ORACLECURSOR" mode="OUT" resultMap="resultMap[which is
MyCertificate bean mapping]"/>
  </parameterMap>

  <procedure id="getMyCertificateByName" parameterMap="paramMap" >
         { call
vcert.concept_test_clerk_ui_api.get_certs_by_business_name(?, ?) }
  </procedure>


Let me know if it helps..



bpamarti wrote:
> 
> I was just concerned when you said "Its working now" and your code says
> you are getting the List (of beans) directly.
>    
>   If anyone can show me the code for getting the "List of beans" directly
> instead of "ResultSet" while using oracle stored procedures with REF
> CURSOR as OUT parameter I would appreciate. :)
>    
>   Cheers!
> 
> 
> "Peace is found not in what surrounds us, but in what we hold within."
> 
> 
>        
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it
> now.
> 

-- 
View this message in context: http://www.nabble.com/Protocol-Error---SimpleDataSource.pushConnection%28%29-when-using-oraclecursors-tp17093837p17111540.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by BalaKishore Pamarti <bp...@yahoo.com>.
I was just concerned when you said "Its working now" and your code says you are getting the List (of beans) directly.
   
  If anyone can show me the code for getting the "List of beans" directly instead of "ResultSet" while using oracle stored procedures with REF CURSOR as OUT parameter I would appreciate. :)
   
  Cheers!


"Peace is found not in what surrounds us, but in what we hold within."


       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by mfs <fa...@gmail.com>.
You are right..i had to iterate through the list to get the results, didnt
put that properly too, but i didnt know this problem earlier, since i was
stuck in a totally another issue which never let the control reach here..

Let me know if u want me to paste the code.. 

bpamarti wrote:
> 
> Hi,
> 
> Are you able to get the data in the "List"? 
> 
> My understanding is that Oracle Cursor returns a resultset and we need to
> iterate through the resultset and populate a List with the beans.
> 
>          String resource;
>          Reader reader;
>          SqlMapClient sqlMap;
>          resource = "company/xyz/core/persistence/sql-map-config.xml";
>          reader = Resources.getResourceAsReader(resource);
>          sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>  
>       
>          HashMap params = new HashMap();
>          params.put("criteriaParam", new Integer(11));
> 
>         // This returns an empty list for me
>         // List list =
> sqlMap.queryForList("getCertificateByCertificateId", params); 
> 
>         // I am doing something like this right now
>          sqlMap.update("getCertificateByCertificateId", params);
>          ResultSet rset = (ResultSet) map.get("outputCursorParam");
> 
> 
> 
> mfs wrote:
>> 
>> Guys,
>> 
>> I just started using iBatis, and i think its a great framework, and would
>> want to employ the same in our company for the persistance layer...Also
>> "iBatis in Action" is a very well written book, great job Clinton, Larry
>> and Brandon...
>> 
>> Anyways coming to the problem...So am facing this "protocol voilation"
>> error when using oraclecursors (have followed the example on wiki)
>> propogated on SimpleDataSource.pushConnection() with the stack trace
>> below...using selects just works fine its just when using oraclecursors i
>> face this problem
>> 
>> Also after the stack trace i have posted by sqlmap-config and sqlmapping
>> itself and the client.. 
>> 
>> would appreciate any input..
>> 
>> Exception in thread "main" java.sql.SQLException: Protocol violation
>> 	at
>> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:166)
>> 	at
>> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:217)
>> 	at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:1377)
>> 	at oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:132)
>> 	at oracle.jdbc.driver.T4CConnection.do_rollback(T4CConnection.java:530)
>> 	at
>> oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:1291)
>> 	at
>> com.ibatis.common.jdbc.SimpleDataSource.pushConnection(SimpleDataSource.java:527)
>> 	at
>> com.ibatis.common.jdbc.SimpleDataSource.access$100(SimpleDataSource.java:52)
>> 	at
>> com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:954)
>> 	at $Proxy0.close(Unknown Source)
>> 	at
>> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.close(JdbcTransaction.java:81)
>> 	at
>> com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:111)
>> 	at
>> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:782)
>> 	at
>> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176)
>> 	at
>> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:154)
>> 	at
>> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:883)
>> 	at
>> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:622)
>> 	at
>> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
>> 	at
>> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
>> 	at
>> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)
>> 
>> 
>> <-- XYZCertificate.xml -->
>> 
>> <sqlMap namespace="Certificate">
>> 
>>   <typeAlias alias="certificate"
>> type="company.xyzcore.domain.Certificate"/>
>> 
>>   <resultMap id="certificateResult" class="exemptionCertificate">
>>     <result property="certificateId" column="CERT_ID"/>
>>     <result property="name" column="NAME"/>
>>     </resultMap>
>> 
>>   <parameterMap id="outCursorParamMap" class="map">
>>   		<parameter property="criteriaParam" jdbcType="int"
>> javaType="java.lang.Integer" mode="IN"/>
>> 		<parameter property="outputCursorParam" jdbcType="ORACLECURSOR"
>> mode="OUT" resultMap="certificateResult" />
>>   </parameterMap>
>> 
>>   <procedure id="getCertificateByCertificateId"
>> parameterMap="outCursorParamMap">
>>          { call test.concept_test_api.get_cert_id(?, ?) }
>>   </procedure>
>> 
>> </sqlMap>
>> 
>> 
>> 
>> <!-- SQL MAP CONFIG -->
>> 
>> <sqlMapConfig>
>> 
>> <transactionManager type="JDBC" commitRequired="false">
>> 		<dataSource type="SIMPLE">
>> 			<property name="JDBC.Driver" value="oracle.jdbc.OracleDriver" />
>> 			<!--property name="JDBC.ConnectionURL"
>> value="jdbc:oracle:thin:@192.168.111.212:1521:somedb" /-->
>> 			<property name="JDBC.ConnectionURL"
>> value="jdbc:oracle:thin:@//192.168.111.106:1521/mydb" />
>> 			<property name="JDBC.Username" value="myusername" />
>> 			<property name="JDBC.Password" value="mypassword" />
>> 		</dataSource>
>> </transactionManager>
>> 
>>   <sqlMap resource="company/xyz/core/persistence/XYZCertificate.xml"/>
>> 
>> </sqlMapConfig>
>> 
>> Caller code
>> -------------------
>> 
>>         String resource;
>>         Reader reader;
>>         SqlMapClient sqlMap;
>>         resource = "company/xyz/core/persistence/sql-map-config.xml";
>>         reader = Resources.getResourceAsReader(resource);
>>         sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>> 
>>      
>>         HashMap params = new HashMap();
>>         params.put("criteriaParam", new Integer(11));
>>         List list = sqlMap.queryForList("getCertificateByCertificateId",
>> params); 
>> 
>> 
>> Thanks in advance..
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Protocol-Error---SimpleDataSource.pushConnection%28%29-when-using-oraclecursors-tp17093837p17110744.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors

Posted by bpamarti <bp...@yahoo.com>.
Hi,

Are you able to get the data in the "List"? 

My understanding is that Oracle Cursor returns a resultset and we need to
iterate through the resultset and populate a List with the beans.

         String resource;
         Reader reader;
         SqlMapClient sqlMap;
         resource = "company/xyz/core/persistence/sql-map-config.xml";
         reader = Resources.getResourceAsReader(resource);
         sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
 
      
         HashMap params = new HashMap();
         params.put("criteriaParam", new Integer(11));

        // This returns an empty list for me
        // List list = sqlMap.queryForList("getCertificateByCertificateId",
params); 

        // I am doing something like this right now
         sqlMap.update("getCertificateByCertificateId", params);
         ResultSet rset = (ResultSet) map.get("outputCursorParam");



mfs wrote:
> 
> Guys,
> 
> I just started using iBatis, and i think its a great framework, and would
> want to employ the same in our company for the persistance layer...Also
> "iBatis in Action" is a very well written book, great job Clinton, Larry
> and Brandon...
> 
> Anyways coming to the problem...So am facing this "protocol voilation"
> error when using oraclecursors (have followed the example on wiki)
> propogated on SimpleDataSource.pushConnection() with the stack trace
> below...using selects just works fine its just when using oraclecursors i
> face this problem
> 
> Also after the stack trace i have posted by sqlmap-config and sqlmapping
> itself and the client.. 
> 
> would appreciate any input..
> 
> Exception in thread "main" java.sql.SQLException: Protocol violation
> 	at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:166)
> 	at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:217)
> 	at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:1377)
> 	at oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:132)
> 	at oracle.jdbc.driver.T4CConnection.do_rollback(T4CConnection.java:530)
> 	at
> oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:1291)
> 	at
> com.ibatis.common.jdbc.SimpleDataSource.pushConnection(SimpleDataSource.java:527)
> 	at
> com.ibatis.common.jdbc.SimpleDataSource.access$100(SimpleDataSource.java:52)
> 	at
> com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:954)
> 	at $Proxy0.close(Unknown Source)
> 	at
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.close(JdbcTransaction.java:81)
> 	at
> com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:111)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:782)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:154)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:883)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:622)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
> 	at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)
> 
> 
> <-- XYZCertificate.xml -->
> 
> <sqlMap namespace="Certificate">
> 
>   <typeAlias alias="certificate"
> type="company.xyzcore.domain.Certificate"/>
> 
>   <resultMap id="certificateResult" class="exemptionCertificate">
>     <result property="certificateId" column="CERT_ID"/>
>     <result property="name" column="NAME"/>
>     </resultMap>
> 
>   <parameterMap id="outCursorParamMap" class="map">
>   		<parameter property="criteriaParam" jdbcType="int"
> javaType="java.lang.Integer" mode="IN"/>
> 		<parameter property="outputCursorParam" jdbcType="ORACLECURSOR"
> mode="OUT" resultMap="certificateResult" />
>   </parameterMap>
> 
>   <procedure id="getCertificateByCertificateId"
> parameterMap="outCursorParamMap">
>          { call test.concept_test_api.get_cert_id(?, ?) }
>   </procedure>
> 
> </sqlMap>
> 
> 
> 
> <!-- SQL MAP CONFIG -->
> 
> <sqlMapConfig>
> 
> <transactionManager type="JDBC" commitRequired="false">
> 		<dataSource type="SIMPLE">
> 			<property name="JDBC.Driver" value="oracle.jdbc.OracleDriver" />
> 			<!--property name="JDBC.ConnectionURL"
> value="jdbc:oracle:thin:@192.168.111.212:1521:somedb" /-->
> 			<property name="JDBC.ConnectionURL"
> value="jdbc:oracle:thin:@//192.168.111.106:1521/mydb" />
> 			<property name="JDBC.Username" value="myusername" />
> 			<property name="JDBC.Password" value="mypassword" />
> 		</dataSource>
> </transactionManager>
> 
>   <sqlMap resource="company/xyz/core/persistence/XYZCertificate.xml"/>
> 
> </sqlMapConfig>
> 
> Caller code
> -------------------
> 
>         String resource;
>         Reader reader;
>         SqlMapClient sqlMap;
>         resource = "company/xyz/core/persistence/sql-map-config.xml";
>         reader = Resources.getResourceAsReader(resource);
>         sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
> 
>      
>         HashMap params = new HashMap();
>         params.put("criteriaParam", new Integer(11));
>         List list = sqlMap.queryForList("getCertificateByCertificateId",
> params); 
> 
> 
> Thanks in advance..
> 
> 

-- 
View this message in context: http://www.nabble.com/Protocol-Error---SimpleDataSource.pushConnection%28%29-when-using-oraclecursors-tp17093837p17106214.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.