Hi,
Just a gues: try to check your result set mapping. If you have not
compatible types, it won't work.
Also, I never used columnIndex, but used column instead like:
<result property="propertyId" column="property_id"/>
and it worked fine for me.
Also, make sure that you pass security of the data base. Try, for example,
to create a table (using your sqladv) something like this:
CREATE TABLE myparams(
name CHAR(20),
number NUMERIC(9),
date DATETIME
)
Initialize it with default values like:
INSERT INTO myparams VALUES("FOO_ID", -1, "12/12/2012")
INSERT INTO myparams VALUES("DATE1", -1, "12/12/2012")
INSERT INTO myparams VALUES("DATE2", -1, "12/12/2012")
INSERT INTO myparams VALUES("PAGE", -1, "12/12/2012")
And in your stored procedure populate it with data from parameters you pass,
so you can
make sure that you reach you stored proc.
Let's say:
UPDATE myparams SET number = @page WHERE name = "PAGE"
And after you run your java, use sqladv again to see if the table was
changed.
Hope it'd help.
Prabhat, Pranay wrote:
>
>> 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.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Problem-with-executing-a-Sybase-Stored-Procedure%3A-output-is-null-tf3914149.html#a11176488
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.