ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Maves" <nathan.ma...@gmail.com>
Subject Re: Problems with returning a result set.
Date Tue, 22 Jan 2008 22:40:02 GMT
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 <rsvancara@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
>
>
>
>
>

Mime
View raw message