ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From IBATIS <venkatesh.madha...@wipro.com>
Subject Re: Please help - Using IBatis in RAD 7.0
Date Tue, 23 Oct 2007 09:48:11 GMT

Hi Abhigyan,

Thank you very much for your detailed response. Even now there is no luck
for me. I am using the IBatis for the first time. I am calling my DAO from a
stateless session bean of Container managed persistence. This DAO uses
SQLMapper to call the stored procedure.

And I am not using any timeout explicitly. Also please note that when I
invoke the same SP from an ordinary Java Programme with CallableStatement,
it is getting executed. 

For more detail please see the below sqlmapconfig.xml entry as below.

<!DOCTYPE sqlMapConfig      
    PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"      
    "sql-map-config-2.dtd"> (I copied sql-map-config-2.dtd from the website
and referring it locally. Is this how we need to do? )

<sqlMapConfig>

	<properties
	
resource="com/nwa/safetrac/domain/common/dao/sqlmap/SqlMapConfig.properties"
/>
	<!-- 
		<transactionManager type="JDBC">
		<dataSource type="JNDI">
		<property name="DataSource" value="jdbc/SafetracDatasource" />			
		</dataSource>		
		</transactionManager>
	-->


Is there anything wrong with the below transaction manager description. Do I
need to add / modify anything additionally.
	<transactionManager type="JDBC">
		<dataSource type="SIMPLE">
			<property name="JDBC.Driver" value="${driver}" />
			<property name="JDBC.ConnectionURL" value="${url}" />
			<property name="JDBC.Username" value="${username}" />
			<property name="JDBC.Password" value="${password}" />
		</dataSource>
	</transactionManager>

	<sqlMap resource="com/nwa/safetrac/domain/common/dao/sql/Bags.xml" />

</sqlMapConfig>

Abhigyan : - It would be of great help if you could find out the problem. if
you could find some clue and based on the above or if the information is not
enough please let me know. I shall send you the required things.

Could you please check whether the .jar files what I am using is the correct
one or I need to use something else?

Thanks
Venkat


Abhigyan Agrawal1 wrote:
> 
> Hi Venkat,
>         The first error you are getting is definitely because of wrong 
> jdbc type. 
> I tried the code you have given and it gives the same error (register 
> output parameters failed) until I change it to VARCHAR instead of 
> VARCHAR2. After doing the change, the code is running through iBATIS 
> displaying expected results.  Which database are you using? 
>         One more thing, you can remove resultClass from procedure as you 
> are already giving parameterClass of the same map.
>         As far as the transaction is getting timed out is concerned, are 
> you providing some timeout values yourself? because I am not and the 
> procedure is executing without problem.
>  
> Cheers,
> Abhigyan Agrawal 
> 
> 
> 
> 
> IBATIS <venkatesh.madhavan@wipro.com> 
> 20/10/2007 16:45
> Please respond to
> user-java@ibatis.apache.org
> 
> 
> To
> user-java@ibatis.apache.org
> cc
> 
> Subject
> Re: Please help - Using IBatis in RAD 7.0
> 
> 
> 
> 
> 
> 
> 
> Larry,
> 
> Sorry for not being clear with my queries. I have refined my query as 
> below.
> Please help me out.
> 
> I have a stored procedure as below.
> 
> CREATE OR REPLACE procedure mytest
>                  (
>                  In_Bag_ID      in     varchar,
>                  In_Station     in     varchar,
>                  In_Crtn_Dtm    in     varchar,
>                  Out_Bag_Data          out varchar2,
>                  Out_Return_Cde        out number)
> is
> Begin
>                  Out_Bag_Data := 'success';
>                  Out_Return_Cde := 0;
> End mytest;
> /
> 
> 
> My .xml resource file entry is as below
> 
>                  <procedure id="retrieveBagTagInfoSP" 
> parameterClass="java.util.HashMap"
> resultClass="java.util.HashMap">
>                  {call mytest 
> (#bagid,javaType=java.lang.String,jdbcType=VARCHAR,mode=IN#,
> #apcde,javaType=java.lang.String,jdbcType=VARCHAR,mode=IN#,
> #crtndtm,javaType=java.lang.String,jdbcType=VARCHAR,mode=IN#,
> #bagdata,javaType=java.lang.String,jdbcType=VARCHAR2,mode=OUT#,
> #returncode,javaType=java.lang.Integer,jdbcType=INTEGER,mode=OUT#)}
>                  </procedure>
> 
> My Calling java programme is as below.
> 
> hshBagTag.put("bagid","");
> hshBagTag.put("apcde","");
> hshBagTag.put("crtndtm","");
> hshBagTag.put("bagdata",new String(""));
> hshBagTag.put("returncode", new Integer(0));  
> 
> SqlMapperClient.queryForObject("retrieveBagTagInfoSP", 
> hshBagTag,hshBagTag);
> 
> While I invoke the stored procedure, I am getting the following error
> 
> --- The error occurred in com/nwa/safetrac/domain/common/dao/sql/Bags.xml. 
>  
> --- The error occurred while executing query procedure. 
> --- Check the {call mytest (?, ?, ?, ?, ?)}. 
> --- Check the output parameters (register output parameters failed). 
> --- Cause: java.sql.SQLException: Invalid column type
> 
> 
> In the same above I changed the 
> 
> #bagdata,javaType=java.lang.String,jdbcType=VARCHAR2,mode=OUT#, 
> to
> #bagdata,javaType=java.lang.String,jdbcType=VARCHAR,mode=OUT#, 
> 
> and
> #returncode,javaType=java.lang.Integer,jdbcType=INTEGER,mode=OUT#
> to
> #returncode,javaType=java.lang.Double,jdbcType=DECIMAL,mode=OUT#)
> 
> Now, the above error was not occurring but the transaction is getting 
> timed
> out. 
> 
> Could you please tell me where I am going wrong,  I am badly in need of a
> help.
> 
> My Environment is as below.
> 
> Development Environment  -  RAD 7.0 (Websphere Application server 6.0)
> Ibatis jar files - ibatis-common-2.jar / ibatis-sqlmap-2.jar (i got it 
> from
> jpetstore example package)
> 
> Regards
> Venkat
> 
> 
> Larry Meadors-2 wrote:
>> 
>> I know both work, but without seeing any code...it's impossible for us
>> to see what your specific issue is.
>> 
>> Larry
>> 
>> 
>> On 10/19/07, IBATIS <venkatesh.madhavan@wipro.com> wrote:
>>>
>>> Hi There,
>>>
>>> I am facing issues while I invoke a sql / stored procedure in RAD 7.0
>>> using
>>> Ibatis.
>>>
>>> Do I need add any .jars or others to make it work with RAD.
>>>
>>> Please look into the issues as below.
>>>
>>> 1. while I invoke a plain sql I am not getting the result.
>>> 2. While I invoke a stored procedure, the transaction is getting timed
>>> out.
>>>
>>> when i invoke the above using ordinary java.sql.connection ( I get this
>>> connection object from SqlMapClient.getDataSource().getConnection()) it
>>> is
>>> working fine for both points 1&2.
>>>
>>> Your help will be highly appreciated.
>>>
>>> Regards
>>> Venkat
>>> --
>>> View this message in context:
>>> 
> http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tf4652521.html#a13292529
> 
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tf4652521.html#a13308959
> 
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Please-help---Using-IBatis-in-RAD-7.0-tf4652521.html#a13360597
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message