ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prabhat, Pranay" <Pranay.Prab...@fidelity.co.in>
Subject Problem with executing a Sybase Stored Procedure: output is null
Date Wed, 13 Jun 2007 11:52:26 GMT
> Hi Everyone, 
> I am trying to execute a sybase stored procedure but all my output values
> in the result set are coming as zero or blank. However when I execute my
> SP through sqladv , I get a proper output.
> I have used columnIndex property in my resultMap to populate my output
> properties, but it seems that my resultset doesn't gets populated at all.
> However I am sure that my column indexes correspond to the output from the
> stored procedure because if I change any index value in the resultMap to
> 19, I get index out of range error because my stored procedure returns 18
> values at a time.
> In the below java code, variable m_list is giving an object named Pranay
> but all the properties within the object are showing their initialized
> values and not the proper output values.
> Please advice what is going wrong here. 
> My Java code is : 
> String resource = null; 
> Reader reader; 
> SqlMapClient sqlMap; 
> resource = "com/pranay/persistence/springjdbc/SqlMap-Config.xml"; 
> reader = Resources.getResourceAsReader (resource); 
> sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); 
> DataSource dataSource = sqlMap.getDataSource(); 
> Connection connection = dataSource.getConnection(); 
> connection.setAutoCommit(true); 
> sqlMap.setUserConnection(connection); 
> Map l_Params = new HashMap(4); 
> l_Params.put(FOO_ID, a_Id); 
> l_Params.put(DATE1, a_Date1.getTime()); 
> l_Params.put(DATE2, a_Date2.getTime()); 
> l_Params.put(PAGE, new Integer(0)); 
> List m_list = sqlMap.queryForList("PranayTest",l_Params); 
> My SqlMap is : 
> <?xml version="1.0" encoding="UTF-8"?> 
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" 
> "c:/docs/sql-map-2.dtd"> 
> <sqlMap namespace ="Pranay"> 
> <resultMap id="get-result" class="PranayTest"> 
> <result property="Pranay1" columnIndex="1"/> 
> <result property="Pranay2" columnIndex="2"/> 
> <result property="Pranay3" columnIndex="3"/> 
> <result property="Pranay4" columnIndex="4"/> 
> <result property="Pranay5" columnIndex="6"/> 
> <result property="Pranay6" columnIndex="6"/> 
> <result property="Pranay7" columnIndex="7"/> 
> <result property="Pranay8" columnIndex="8"/> 
> <result property="Pranay9" columnIndex="9"/> 
> </resultMap> 
> <parameterMap id="put-input" class="map" > 
> <parameter property="FOO_ID" jdbcType="INTEGER"
> javaType="java.lang.Integer" mode="IN"/> 
> <parameter property="DATE1" jdbcType="DATE" javaType="java.util.Calendar"
> mode="IN"/> 
> <parameter property="DATE2" jdbcType="DATE" javaType="java.util.Calendar"
> mode="IN"/> 
> <parameter property="PAGE" jdbcType="INTEGER" javaType="java.lang.Integer"
> mode="IN"/> 
> </parameterMap> 
> <procedure id="PranayTest" parameterMap="put-input"
> resultMap="get-result"> 
> {call PranayTest(?,?,?,?)} 
> </procedure> 
> </sqlMap> 
> My SqlMapConfig file is : 
> <?xml version="1.0" encoding="UTF-8"?> 
> <!DOCTYPE sqlMapConfig 
> PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" 
> "c:/docs/sql-map-config-2.dtd"> 
> <sqlMapConfig> 
> <transactionManager type="JDBC"> 
> <dataSource type = "SIMPLE"> 
> <property name="JDBC.Driver" value="com.sybase.jdbc2.jdbc.SybDriver"/> 
> <property name="JDBC.ConnectionURL" 
> value="myurl"/> 
> <property name="JDBC.Username" value="login"/> 
> <property name="JDBC.Password" value="password"/> 
> <property name="JDBC.DefaultAutoCommit" value="true"/> 
> </dataSource> 
> </transactionManager> 
> 
> <sqlMap url="file:///c:/sqlMap.xml"/> 
> 
> </sqlMapConfig> 
> 
> Important : Any comments or statements made in this email are not
> necessarily those of Fidelity Business Services India Pvt. Ltd. or any of
> the Fidelity group companies. The information transmitted is intended only
> for the person or entity to which it is addressed and may contain
> confidential and/or privileged material. if you have received this in
> error, please contact the sender and delete the material from any
> computer. All e-mails sent from or to Fidelity Business Services India
> Pvt. Ltd. may be subject to our monitoring procedures.
> 
> 

Mime
View raw message