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 Randall Svancara <rs...@wsu.edu> on 2008/01/22 22:37:59 UTC

Problems with returning a result set.

I have used Ibatis for numerous projects and never had a problems with
returning back a result set.  I have other files configured in a similar
manner and they seem to work just fine. 

First of all, i have this sql configuration file:

Contents of Blast_Program.xml
*************************************
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="BlastProgram">


    <typeAlias alias="BlastProgram"
type="edu.wsu.bioinfo.webblast.domain.BlastProgram" />
    <typeAlias alias="QtypeDtypeParamClass"
type="edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass" />
    
    <resultMap id="blastProgramResultMap" class="BlastProgram">
     <result property="programid" column="program_id" />  
     <result property="programname" column="program_name" />
     <result property="environment" column="environment" />
     <result property="programpath" column="program_path" />
     <result property="dtype" column="db" />
     <result property="qtype" column="seq" />
    </resultMap>
    
    <parameterMap id="blastparams" class="QtypeDtypeParamClass">
        <parameter property="qtype" jdbcType="VARCHAR" nullValue="n"/>
        <parameter property="dtype" jdbcType="VARCHAR" nullValue="n"/>
    </parameterMap>
    <!--
edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass
-->
    <select id="getAllBlastProgramsQT"
resultMap="blastProgramResultMap">
        SELECT program_id, program_name, environment, program_path, seq,
db from blast_prog where seq='n' and db='n'
    </select>


</sqlMap>
*********************************************************************


Here is the table stored in an Oracle Database:

*********************************************************************
PROGRAM_ID
NOT NULL NUMBER(8)
 PROGRAM_NAME
VARCHAR2(100)
 ENVIRONMENT
VARCHAR2(2000)
 PROGRAM_PATH
VARCHAR2(1000)
 SEQ
CHAR(1)
 DB
CHAR(1)

*********************************************************************

The above SQL located in Blast_Program.sql works just fine on this table
and returns results when  put into SQL Plus.  


Below is the debugging output from IBATIS:
*********************************************************************
2008-01-22 13:28:39,216 DEBUG
(edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:176) -
Opened SqlMapSession
[com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl@6481eb] for iBATIS
operation
2008-01-22 13:28:39,218 DEBUG
(org.springframework.jdbc.datasource.DataSourceUtils:112) - Fetching
JDBC Connection from DataSource
2008-01-22 13:28:39,218 DEBUG
(org.springframework.jdbc.datasource.DataSourceUtils:112) - Fetching
JDBC Connection from DataSource
2008-01-22 13:28:39,220 DEBUG (java.sql.Connection:27) - {conn-100006}
Connection
2008-01-22 13:28:39,221 DEBUG
(edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:185) -
Obtained JDBC Connection
[jdbc:oracle:thin:@mldb3.bioinfo.wsu.edu:1521:maindev,
UserName=RANDALLS, Oracle JDBC driver] for iBATIS operation
2008-01-22 13:28:39,222 DEBUG (java.sql.Connection:27) - {conn-100006}
Preparing Statement:          SELECT program_id, program_name,
environment, program_path, seq, db from blast_prog where seq='n' and
db='n'     
2008-01-22 13:28:39,223 DEBUG (java.sql.PreparedStatement:27) -
{pstm-100007} Executing Statement:          SELECT program_id,
program_name, environment, program_path, seq, db from blast_prog where
seq='n' and db='n'     
2008-01-22 13:28:39,224 DEBUG (java.sql.PreparedStatement:27) -
{pstm-100007} Parameters: []
2008-01-22 13:28:39,225 DEBUG (java.sql.PreparedStatement:27) -
{pstm-100007} Types: []
2008-01-22 13:28:39,229 DEBUG (java.sql.ResultSet:27) - {rset-100008}
ResultSet
2008-01-22 13:28:39,230 DEBUG
(org.springframework.jdbc.datasource.DataSourceUtils:312) - Returning
JDBC Connection to DataSource
2008-01-22 13:28:39,231 DEBUG
(org.springframework.jdbc.datasource.DataSourceUtils:312) - Returning
JDBC Connection to DataSource
*****************************************************************************

I have tried changing the names of the columns in the table in the
database, creating resultMaps in various incarnations.  I am using
Struts2, Spring and IBATIS.  

If anyone has a chance, and can offer me any advice or assistance I
would appreciate it.  

Thanks,

Randall





Re: Problems with returning a result set.

Posted by Nathan Maves <na...@gmail.com>.
I am sure this is not part of the problem but you might want to upgrade your
dtd's to point to the the new apache url.

I would also want to see the api call that you are making to be sure you are
not calling update.

On Jan 22, 2008 2:37 PM, Randall Svancara <rs...@wsu.edu> wrote:

> I have used Ibatis for numerous projects and never had a problems with
> returning back a result set.  I have other files configured in a similar
> manner and they seem to work just fine.
>
> First of all, i have this sql configuration file:
>
> Contents of Blast_Program.xml
> *************************************
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-2.dtd">
> <sqlMap namespace="BlastProgram">
>
>
>    <typeAlias alias="BlastProgram"
> type="edu.wsu.bioinfo.webblast.domain.BlastProgram" />
>    <typeAlias alias="QtypeDtypeParamClass"
> type="
> edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass" />
>
>    <resultMap id="blastProgramResultMap" class="BlastProgram">
>     <result property="programid" column="program_id" />
>     <result property="programname" column="program_name" />
>     <result property="environment" column="environment" />
>     <result property="programpath" column="program_path" />
>     <result property="dtype" column="db" />
>     <result property="qtype" column="seq" />
>    </resultMap>
>
>    <parameterMap id="blastparams" class="QtypeDtypeParamClass">
>        <parameter property="qtype" jdbcType="VARCHAR" nullValue="n"/>
>        <parameter property="dtype" jdbcType="VARCHAR" nullValue="n"/>
>    </parameterMap>
>    <!--
> edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass
> -->
>    <select id="getAllBlastProgramsQT"
> resultMap="blastProgramResultMap">
>        SELECT program_id, program_name, environment, program_path, seq,
> db from blast_prog where seq='n' and db='n'
>    </select>
>
>
> </sqlMap>
> *********************************************************************
>
>
> Here is the table stored in an Oracle Database:
>
> *********************************************************************
> PROGRAM_ID
> NOT NULL NUMBER(8)
>  PROGRAM_NAME
> VARCHAR2(100)
>  ENVIRONMENT
> VARCHAR2(2000)
>  PROGRAM_PATH
> VARCHAR2(1000)
>  SEQ
> CHAR(1)
>  DB
> CHAR(1)
>
> *********************************************************************
>
> The above SQL located in Blast_Program.sql works just fine on this table
> and returns results when  put into SQL Plus.
>
>
> Below is the debugging output from IBATIS:
> *********************************************************************
> 2008-01-22 13:28:39,216 DEBUG
> (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:176) -
> Opened SqlMapSession
> [com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl@6481eb] for iBATIS
> operation
> 2008-01-22 13:28:39,218 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:112) - Fetching
> JDBC Connection from DataSource
> 2008-01-22 13:28:39,218 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:112) - Fetching
> JDBC Connection from DataSource
> 2008-01-22 13:28:39,220 DEBUG (java.sql.Connection:27) - {conn-100006}
> Connection
> 2008-01-22 13:28:39,221 DEBUG
> (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:185) -
> Obtained JDBC Connection
> [jdbc:oracle:thin:@mldb3.bioinfo.wsu.edu:1521:maindev,
> UserName=RANDALLS, Oracle JDBC driver] for iBATIS operation
> 2008-01-22 13:28:39,222 DEBUG (java.sql.Connection:27) - {conn-100006}
> Preparing Statement:          SELECT program_id, program_name,
> environment, program_path, seq, db from blast_prog where seq='n' and
> db='n'
> 2008-01-22 13:28:39,223 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Executing Statement:          SELECT program_id,
> program_name, environment, program_path, seq, db from blast_prog where
> seq='n' and db='n'
> 2008-01-22 13:28:39,224 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Parameters: []
> 2008-01-22 13:28:39,225 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Types: []
> 2008-01-22 13:28:39,229 DEBUG (java.sql.ResultSet:27) - {rset-100008}
> ResultSet
> 2008-01-22 13:28:39,230 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:312) - Returning
> JDBC Connection to DataSource
> 2008-01-22 13:28:39,231 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:312) - Returning
> JDBC Connection to DataSource
>
> *****************************************************************************
>
> I have tried changing the names of the columns in the table in the
> database, creating resultMaps in various incarnations.  I am using
> Struts2, Spring and IBATIS.
>
> If anyone has a chance, and can offer me any advice or assistance I
> would appreciate it.
>
> Thanks,
>
> Randall
>
>
>
>
>

Re: Problems with returning a result set.

Posted by Randall Svancara <rs...@wsu.edu>.
Stephen,

Thanks for the reply.  The table is in only one schema.

I have confirmed this by doing a:

SELECT table_name, owner from all_tables where table_name='BLAST_PROG' 

as the sysdba user.

Thanks

-  
Randall Svancara
Systems Administrator


On Tue, 2008-01-22 at 18:14 -0500, Stephen Boyd wrote:
> Do you have the same table in multiple schemas?  If so, make sure
> ibatis is reading from the correct schema.
> 
> On Jan 22, 2008 4:37 PM, Randall Svancara <rs...@wsu.edu> wrote:
>         I have used Ibatis for numerous projects and never had a
>         problems with 
>         returning back a result set.  I have other files configured in
>         a similar
>         manner and they seem to work just fine.
>         
>         First of all, i have this sql configuration file:
>         
>         Contents of Blast_Program.xml
>         ************************************* 
>         <?xml version="1.0" encoding="UTF-8"?>
>         <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
>         "http://www.ibatis.com/dtd/sql-map-2.dtd">
>         <sqlMap namespace="BlastProgram">
>         
>         
>            <typeAlias alias="BlastProgram"
>         type="edu.wsu.bioinfo.webblast.domain.BlastProgram " />
>            <typeAlias alias="QtypeDtypeParamClass"
>         type="edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass" />
>         
>            <resultMap id="blastProgramResultMap"
>         class="BlastProgram"> 
>             <result property="programid" column="program_id" />
>             <result property="programname" column="program_name" />
>             <result property="environment" column="environment" /> 
>             <result property="programpath" column="program_path" />
>             <result property="dtype" column="db" />
>             <result property="qtype" column="seq" /> 
>            </resultMap>
>         
>            <parameterMap id="blastparams"
>         class="QtypeDtypeParamClass">
>                <parameter property="qtype" jdbcType="VARCHAR"
>         nullValue="n"/> 
>                <parameter property="dtype" jdbcType="VARCHAR"
>         nullValue="n"/>
>            </parameterMap>
>            <!--
>         edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass 
>         -->
>            <select id="getAllBlastProgramsQT"
>         resultMap="blastProgramResultMap">
>                SELECT program_id, program_name, environment,
>         program_path, seq,
>         db from blast_prog where seq='n' and db='n' 
>            </select>
>         
>         
>         </sqlMap>
>         *********************************************************************
>         
>         
>         Here is the table stored in an Oracle Database:
>         
>         ********************************************************************* 
>         PROGRAM_ID
>         NOT NULL NUMBER(8)
>          PROGRAM_NAME
>         VARCHAR2(100)
>          ENVIRONMENT
>         VARCHAR2(2000)
>          PROGRAM_PATH
>         VARCHAR2(1000)
>          SEQ
>         CHAR(1)
>          DB
>         CHAR(1)
>         
>         ********************************************************************* 
>         
>         The above SQL located in Blast_Program.sql works just fine on
>         this table
>         and returns results when  put into SQL Plus.
>         
>         
>         Below is the debugging output from IBATIS:
>         ********************************************************************* 
>         2008-01-22 13:28:39,216 DEBUG
>         (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:176) -
>         Opened SqlMapSession
>         [com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl@6481eb] for
>         iBATIS
>         operation
>         2008-01-22 13:28:39,218 DEBUG 
>         (org.springframework.jdbc.datasource.DataSourceUtils:112) -
>         Fetching
>         JDBC Connection from DataSource
>         2008-01-22 13:28:39,218 DEBUG
>         (org.springframework.jdbc.datasource.DataSourceUtils:112) -
>         Fetching
>         JDBC Connection from DataSource 
>         2008-01-22 13:28:39,220 DEBUG (java.sql.Connection:27) -
>         {conn-100006}
>         Connection
>         2008-01-22 13:28:39,221 DEBUG
>         (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:185) -
>         Obtained JDBC Connection
>         [jdbc:oracle:thin:@mldb3.bioinfo.wsu.edu:1521:maindev,
>         UserName=RANDALLS, Oracle JDBC driver] for iBATIS operation
>         2008-01-22 13:28:39,222 DEBUG ( java.sql.Connection:27) -
>         {conn-100006}
>         Preparing Statement:          SELECT program_id, program_name,
>         environment, program_path, seq, db from blast_prog where
>         seq='n' and
>         db='n'
>         2008-01-22 13:28:39,223 DEBUG ( java.sql.PreparedStatement:27)
>         -
>         {pstm-100007} Executing Statement:          SELECT program_id,
>         program_name, environment, program_path, seq, db from
>         blast_prog where
>         seq='n' and db='n'
>         2008-01-22 13:28:39,224 DEBUG ( java.sql.PreparedStatement:27)
>         -
>         {pstm-100007} Parameters: []
>         2008-01-22 13:28:39,225 DEBUG (java.sql.PreparedStatement:27)
>         -
>         {pstm-100007} Types: []
>         2008-01-22 13:28:39,229 DEBUG (java.sql.ResultSet:27) -
>         {rset-100008} 
>         ResultSet
>         2008-01-22 13:28:39,230 DEBUG
>         (org.springframework.jdbc.datasource.DataSourceUtils:312) -
>         Returning
>         JDBC Connection to DataSource
>         2008-01-22 13:28:39,231 DEBUG
>         (org.springframework.jdbc.datasource.DataSourceUtils :312) -
>         Returning
>         JDBC Connection to DataSource
>         *****************************************************************************
>         
>         I have tried changing the names of the columns in the table in
>         the
>         database, creating resultMaps in various incarnations.  I am
>         using 
>         Struts2, Spring and IBATIS.
>         
>         If anyone has a chance, and can offer me any advice or
>         assistance I
>         would appreciate it.
>         
>         Thanks,
>         
>         Randall
>         
>         
>         
>         
> 

Re: Problems with returning a result set.

Posted by Stephen Boyd <sw...@gmail.com>.
Do you have the same table in multiple schemas?  If so, make sure ibatis is
reading from the correct schema.

On Jan 22, 2008 4:37 PM, Randall Svancara <rs...@wsu.edu> wrote:

> I have used Ibatis for numerous projects and never had a problems with
> returning back a result set.  I have other files configured in a similar
> manner and they seem to work just fine.
>
> First of all, i have this sql configuration file:
>
> Contents of Blast_Program.xml
> *************************************
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-2.dtd">
> <sqlMap namespace="BlastProgram">
>
>
>    <typeAlias alias="BlastProgram"
> type="edu.wsu.bioinfo.webblast.domain.BlastProgram" />
>    <typeAlias alias="QtypeDtypeParamClass"
> type="
> edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass" />
>
>    <resultMap id="blastProgramResultMap" class="BlastProgram">
>     <result property="programid" column="program_id" />
>     <result property="programname" column="program_name" />
>     <result property="environment" column="environment" />
>     <result property="programpath" column="program_path" />
>     <result property="dtype" column="db" />
>     <result property="qtype" column="seq" />
>    </resultMap>
>
>    <parameterMap id="blastparams" class="QtypeDtypeParamClass">
>        <parameter property="qtype" jdbcType="VARCHAR" nullValue="n"/>
>        <parameter property="dtype" jdbcType="VARCHAR" nullValue="n"/>
>    </parameterMap>
>    <!--
> edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass
> -->
>    <select id="getAllBlastProgramsQT"
> resultMap="blastProgramResultMap">
>        SELECT program_id, program_name, environment, program_path, seq,
> db from blast_prog where seq='n' and db='n'
>    </select>
>
>
> </sqlMap>
> *********************************************************************
>
>
> Here is the table stored in an Oracle Database:
>
> *********************************************************************
> PROGRAM_ID
> NOT NULL NUMBER(8)
>  PROGRAM_NAME
> VARCHAR2(100)
>  ENVIRONMENT
> VARCHAR2(2000)
>  PROGRAM_PATH
> VARCHAR2(1000)
>  SEQ
> CHAR(1)
>  DB
> CHAR(1)
>
> *********************************************************************
>
> The above SQL located in Blast_Program.sql works just fine on this table
> and returns results when  put into SQL Plus.
>
>
> Below is the debugging output from IBATIS:
> *********************************************************************
> 2008-01-22 13:28:39,216 DEBUG
> (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:176) -
> Opened SqlMapSession
> [com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl@6481eb] for iBATIS
> operation
> 2008-01-22 13:28:39,218 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:112) - Fetching
> JDBC Connection from DataSource
> 2008-01-22 13:28:39,218 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:112) - Fetching
> JDBC Connection from DataSource
> 2008-01-22 13:28:39,220 DEBUG (java.sql.Connection:27) - {conn-100006}
> Connection
> 2008-01-22 13:28:39,221 DEBUG
> (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:185) -
> Obtained JDBC Connection
> [jdbc:oracle:thin:@mldb3.bioinfo.wsu.edu:1521:maindev,
> UserName=RANDALLS, Oracle JDBC driver] for iBATIS operation
> 2008-01-22 13:28:39,222 DEBUG (java.sql.Connection:27) - {conn-100006}
> Preparing Statement:          SELECT program_id, program_name,
> environment, program_path, seq, db from blast_prog where seq='n' and
> db='n'
> 2008-01-22 13:28:39,223 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Executing Statement:          SELECT program_id,
> program_name, environment, program_path, seq, db from blast_prog where
> seq='n' and db='n'
> 2008-01-22 13:28:39,224 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Parameters: []
> 2008-01-22 13:28:39,225 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Types: []
> 2008-01-22 13:28:39,229 DEBUG (java.sql.ResultSet:27) - {rset-100008}
> ResultSet
> 2008-01-22 13:28:39,230 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:312) - Returning
> JDBC Connection to DataSource
> 2008-01-22 13:28:39,231 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:312) - Returning
> JDBC Connection to DataSource
>
> *****************************************************************************
>
> I have tried changing the names of the columns in the table in the
> database, creating resultMaps in various incarnations.  I am using
> Struts2, Spring and IBATIS.
>
> If anyone has a chance, and can offer me any advice or assistance I
> would appreciate it.
>
> Thanks,
>
> Randall
>
>
>
>
>

Re: Problems with returning a result set.

Posted by Randall Svancara <rs...@wsu.edu>.
I did not use the parameter object because I wanted to ensure that the
parameters in the where clause were valid.  

I have confirmed that the database, in this case called maindev has a
table named blast_prog.  It also has data in the table.

I actually just got this to work my setting the following in my in my
sqlMapConfig.xml file.

        enhancementEnabled="true"
        useStatementNamespaces="true" 
        cacheModelsEnabled="false"
        lazyLoadingEnabled="true"


I wonder if it has to do with caching?

Thanks,


-  
Randall Svancara
Systems Administrator
509-335-7093


On Tue, 2008-01-22 at 15:40 -0700, Nathan Maves wrote:
> Just a heads up that you are sending a parameter object and not using
> it :)
> 
> Are you positive that you are running the sql in SqlPlus against the
> same DB.  I can't tell you how many times I get a config messed up and
> run my test against an empty DB. 
> 
> Nathan
> 
> On Jan 22, 2008 2:37 PM, Randall Svancara <rs...@wsu.edu> wrote:
>         I have used Ibatis for numerous projects and never had a
>         problems with
>         returning back a result set.  I have other files configured in
>         a similar
>         manner and they seem to work just fine.
>         
>         First of all, i have this sql configuration file: 
>         
>         Contents of Blast_Program.xml
>         *************************************
>         <?xml version="1.0" encoding="UTF-8"?>
>         <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" 
>         "http://www.ibatis.com/dtd/sql-map-2.dtd">
>         <sqlMap namespace="BlastProgram">
>         
>         
>            <typeAlias alias="BlastProgram" 
>         type="edu.wsu.bioinfo.webblast.domain.BlastProgram" />
>            <typeAlias alias="QtypeDtypeParamClass"
>         type="edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass" /> 
>         
>            <resultMap id="blastProgramResultMap" class="BlastProgram">
>             <result property="programid" column="program_id" />
>             <result property="programname" column="program_name" /> 
>             <result property="environment" column="environment" />
>             <result property="programpath" column="program_path" />
>             <result property="dtype" column="db" /> 
>             <result property="qtype" column="seq" />
>            </resultMap>
>         
>            <parameterMap id="blastparams"
>         class="QtypeDtypeParamClass">
>                <parameter property="qtype" jdbcType="VARCHAR"
>         nullValue="n"/> 
>                <parameter property="dtype" jdbcType="VARCHAR"
>         nullValue="n"/>
>            </parameterMap>
>            <!--
>         edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass 
>         -->
>            <select id="getAllBlastProgramsQT"
>         resultMap="blastProgramResultMap">
>                SELECT program_id, program_name, environment,
>         program_path, seq,
>         db from blast_prog where seq='n' and db='n' 
>            </select>
>         
>         
>         </sqlMap>
>         *********************************************************************
>         
>         
>         Here is the table stored in an Oracle Database:
>         
>         ********************************************************************* 
>         PROGRAM_ID
>         NOT NULL NUMBER(8)
>          PROGRAM_NAME
>         VARCHAR2(100)
>          ENVIRONMENT
>         VARCHAR2(2000)
>          PROGRAM_PATH
>         VARCHAR2(1000)
>          SEQ
>         CHAR(1)
>          DB
>         CHAR(1)
>         
>         ********************************************************************* 
>         
>         The above SQL located in Blast_Program.sql works just fine on
>         this table
>         and returns results when  put into SQL Plus.
>         
>         
>         Below is the debugging output from IBATIS:
>         ********************************************************************* 
>         2008-01-22 13:28:39,216 DEBUG
>         (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:176) -
>         Opened SqlMapSession
>         [com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl@6481eb] for
>         iBATIS
>         operation
>         2008-01-22 13:28:39,218 DEBUG 
>         (org.springframework.jdbc.datasource.DataSourceUtils:112) -
>         Fetching
>         JDBC Connection from DataSource
>         2008-01-22 13:28:39,218 DEBUG
>         (org.springframework.jdbc.datasource.DataSourceUtils:112) -
>         Fetching
>         JDBC Connection from DataSource 
>         2008-01-22 13:28:39,220 DEBUG (java.sql.Connection:27) -
>         {conn-100006}
>         Connection
>         2008-01-22 13:28:39,221 DEBUG
>         (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:185) -
>         Obtained JDBC Connection
>         [jdbc:oracle:thin:@mldb3.bioinfo.wsu.edu:1521:maindev,
>         UserName=RANDALLS, Oracle JDBC driver] for iBATIS operation
>         2008-01-22 13:28:39,222 DEBUG ( java.sql.Connection:27) -
>         {conn-100006}
>         Preparing Statement:          SELECT program_id, program_name,
>         environment, program_path, seq, db from blast_prog where
>         seq='n' and
>         db='n'
>         2008-01-22 13:28:39,223 DEBUG ( java.sql.PreparedStatement:27)
>         -
>         {pstm-100007} Executing Statement:          SELECT program_id,
>         program_name, environment, program_path, seq, db from
>         blast_prog where
>         seq='n' and db='n'
>         2008-01-22 13:28:39,224 DEBUG ( java.sql.PreparedStatement:27)
>         -
>         {pstm-100007} Parameters: []
>         2008-01-22 13:28:39,225 DEBUG (java.sql.PreparedStatement:27)
>         -
>         {pstm-100007} Types: []
>         2008-01-22 13:28:39,229 DEBUG (java.sql.ResultSet:27) -
>         {rset-100008} 
>         ResultSet
>         2008-01-22 13:28:39,230 DEBUG
>         (org.springframework.jdbc.datasource.DataSourceUtils:312) -
>         Returning
>         JDBC Connection to DataSource
>         2008-01-22 13:28:39,231 DEBUG
>         (org.springframework.jdbc.datasource.DataSourceUtils :312) -
>         Returning
>         JDBC Connection to DataSource
>         *****************************************************************************
>         
>         I have tried changing the names of the columns in the table in
>         the
>         database, creating resultMaps in various incarnations.  I am
>         using 
>         Struts2, Spring and IBATIS.
>         
>         If anyone has a chance, and can offer me any advice or
>         assistance I
>         would appreciate it.
>         
>         Thanks,
>         
>         Randall
>         
>         
>         
>         
> 

Re: Problems with returning a result set.

Posted by Nathan Maves <na...@gmail.com>.
Just a heads up that you are sending a parameter object and not using it :)

Are you positive that you are running the sql in SqlPlus against the same
DB.  I can't tell you how many times I get a config messed up and run my
test against an empty DB.

Nathan

On Jan 22, 2008 2:37 PM, Randall Svancara <rs...@wsu.edu> wrote:

> I have used Ibatis for numerous projects and never had a problems with
> returning back a result set.  I have other files configured in a similar
> manner and they seem to work just fine.
>
> First of all, i have this sql configuration file:
>
> Contents of Blast_Program.xml
> *************************************
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-2.dtd">
> <sqlMap namespace="BlastProgram">
>
>
>    <typeAlias alias="BlastProgram"
> type="edu.wsu.bioinfo.webblast.domain.BlastProgram" />
>    <typeAlias alias="QtypeDtypeParamClass"
> type="
> edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass" />
>
>    <resultMap id="blastProgramResultMap" class="BlastProgram">
>     <result property="programid" column="program_id" />
>     <result property="programname" column="program_name" />
>     <result property="environment" column="environment" />
>     <result property="programpath" column="program_path" />
>     <result property="dtype" column="db" />
>     <result property="qtype" column="seq" />
>    </resultMap>
>
>    <parameterMap id="blastparams" class="QtypeDtypeParamClass">
>        <parameter property="qtype" jdbcType="VARCHAR" nullValue="n"/>
>        <parameter property="dtype" jdbcType="VARCHAR" nullValue="n"/>
>    </parameterMap>
>    <!--
> edu.wsu.bioinfo.webblast.persistance.paramclasses.QtypeDtypeParamClass
> -->
>    <select id="getAllBlastProgramsQT"
> resultMap="blastProgramResultMap">
>        SELECT program_id, program_name, environment, program_path, seq,
> db from blast_prog where seq='n' and db='n'
>    </select>
>
>
> </sqlMap>
> *********************************************************************
>
>
> Here is the table stored in an Oracle Database:
>
> *********************************************************************
> PROGRAM_ID
> NOT NULL NUMBER(8)
>  PROGRAM_NAME
> VARCHAR2(100)
>  ENVIRONMENT
> VARCHAR2(2000)
>  PROGRAM_PATH
> VARCHAR2(1000)
>  SEQ
> CHAR(1)
>  DB
> CHAR(1)
>
> *********************************************************************
>
> The above SQL located in Blast_Program.sql works just fine on this table
> and returns results when  put into SQL Plus.
>
>
> Below is the debugging output from IBATIS:
> *********************************************************************
> 2008-01-22 13:28:39,216 DEBUG
> (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:176) -
> Opened SqlMapSession
> [com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl@6481eb] for iBATIS
> operation
> 2008-01-22 13:28:39,218 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:112) - Fetching
> JDBC Connection from DataSource
> 2008-01-22 13:28:39,218 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:112) - Fetching
> JDBC Connection from DataSource
> 2008-01-22 13:28:39,220 DEBUG (java.sql.Connection:27) - {conn-100006}
> Connection
> 2008-01-22 13:28:39,221 DEBUG
> (edu.wsu.bioinfo.webblast.persistance.BlastProgramSQLMapDao:185) -
> Obtained JDBC Connection
> [jdbc:oracle:thin:@mldb3.bioinfo.wsu.edu:1521:maindev,
> UserName=RANDALLS, Oracle JDBC driver] for iBATIS operation
> 2008-01-22 13:28:39,222 DEBUG (java.sql.Connection:27) - {conn-100006}
> Preparing Statement:          SELECT program_id, program_name,
> environment, program_path, seq, db from blast_prog where seq='n' and
> db='n'
> 2008-01-22 13:28:39,223 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Executing Statement:          SELECT program_id,
> program_name, environment, program_path, seq, db from blast_prog where
> seq='n' and db='n'
> 2008-01-22 13:28:39,224 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Parameters: []
> 2008-01-22 13:28:39,225 DEBUG (java.sql.PreparedStatement:27) -
> {pstm-100007} Types: []
> 2008-01-22 13:28:39,229 DEBUG (java.sql.ResultSet:27) - {rset-100008}
> ResultSet
> 2008-01-22 13:28:39,230 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:312) - Returning
> JDBC Connection to DataSource
> 2008-01-22 13:28:39,231 DEBUG
> (org.springframework.jdbc.datasource.DataSourceUtils:312) - Returning
> JDBC Connection to DataSource
>
> *****************************************************************************
>
> I have tried changing the names of the columns in the table in the
> database, creating resultMaps in various incarnations.  I am using
> Struts2, Spring and IBATIS.
>
> If anyone has a chance, and can offer me any advice or assistance I
> would appreciate it.
>
> Thanks,
>
> Randall
>
>
>
>
>