ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfs <farhan.sar...@gmail.com>
Subject Re: Protocol Error - SimpleDataSource.pushConnection() when using oraclecursors
Date Wed, 07 May 2008 17:57:30 GMT

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.


Mime
View raw message