You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Dwight Galloway <ds...@utah.gov> on 2005/05/06 01:34:26 UTC
not sure if this right forum
Not sure if this right forum but I have a problem that I have been
working on for almost a week, I am new to Ibatis and am just trying to
hook up to my database and am getting the following error (in red).....
I know that I am close but just cant seem to see it, I ask that you
please take a look at this, if this is the wrong way to get my questions
answered please just let me know what I need to do to properly submit my
questions... thank you in advance for any advice you can provide, I have
included my xml document and where I read from too. .
[5/5/05 17:26:29:641 MDT] 6b6bd603 SystemOut O =DEBUG
[Servlet.Engine.Transports : 1] May/05 17:26:29 |
(BSController.class:195) Map =
{providerAction=gov.utah.dhs.dsamh.bs.actions.ProviderAction,
serverAction=gov.utah.dhs.dsamh.bs.actions.ServerAction,
trainerAction=gov.utah.dhs.dsamh.bs.actions.TrainerAction}
=DEBUG [Servlet.Engine.Transports : 1] May/05 17:26:29 |
(BSController.class:64) Inside of controller do process
=DEBUG [Servlet.Engine.Transports : 1] May/05 17:26:29 |
(BSController.class:80) Inside of key if serverAction
inside of the bss mapper
[5/5/05 17:26:30:062 MDT] 6b6bd603 ConnectionFac I J2CA0122I: Resource
reference jdbc/bss could not be located, so default values of the
following are used: [Resource-ref settings]
res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined)
[Other attributes]
isCMP1_x: false (not CMP1.x)
isJMS: false (not JMS)
[5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O ServerAction -
inside of the process request
[5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O Action received:
First Name = Joe
[5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O Action received:
Last Name = Buckwheat
[5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O Action received:
Middle Name = Dee
[5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O Action received: SSN
= 1234
[5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in gov/utah/dhs/dsamh/bs/dao/Server.xml.
--- The error occurred while applying a parameter map.
--- Check the getServer-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: com.sybase.jdbc2.jdbc.SybSQLException: ASA Error -131:
Syntax error near 'id' on line 1
Caused by: com.sybase.jdbc2.jdbc.SybSQLException: ASA Error -131:
Syntax error near 'id' on line 1
[5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:181)
[5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)
[5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)
[5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
my xml document looks like the following
<?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="Server">
<select id="getServer"
resultClass="gov.utah.dhs.dsamh.bs.beans.ServerBean"
parameterClass="int">
SELECT *
id as id,
first_name as firstName,
middle_name as middleName,
last_name as lastName,
ssn_four as ssn,
SYSTEM_USER_ID as systemUser,
FROM dba.tbl_server
WHERE id = #value#
</select>
<insert id="insertServer"
parameterClass="gov.utah.dhs.dsamh.bs.beans.ServerBean">
INSERT INTO
server (id, first_name, middle_name,
last_name, ssn_four, system_user_id)
VALUES (#id#, #firstName#, #middleName#, #lastName#,
#ssn#, #systemUser#, )
</insert>
<update id="updateServer"
parameterClass="gov.utah.dhs.dsamh.bs.beans.ServerBean">
UPDATE server
SET first_name = #firstName#,
middle_name = #middleName#,
last_name = #lastName#,
ssn_four = #ssn#,
WHERE id = #id#
</update>
<delete id="deleteServer"
parameterClass="gov.utah.dhs.dsamh.bs.beans.ServerBean">
DELETE server
WHERE id = #id#
</delete>
</sqlMap>
and where I read the objects from the database looks like the
following
private ServerBean setParameters()
{
// SqlMapClient sqlMap =
BSSqlMapConfig.getSqlMapInstance();
Integer id=new Integer(1);
ServerBean sb = null;
try {
sb = (ServerBean)
sqlMap.queryForObject("getServer", id);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return sb;
/* sb.server1 =
(Server)sqlMap.queryForObject("getServer",id);
return sb;
ServerBean sb = new ServerBean();
sb.setCreateDate("2005-01-01");
sb.setSystemUser("dsgallow");
sb.setFirstName("John");
sb.setLastName("Lennon");
sb.setMiddleName("L");
sb.setSsn("1234");
return sb;
*/
}
}
Dwight S. Galloway
(801) 538-4234
dsgallow@utah.gov
Office of Technology
Department of Human Services
MAKE IT A GREAT DAY!
Re: not sure if this right forum
Posted by Brandon Goodin <br...@gmail.com>.
You should post to the ibatis-user-java list in the future. Move your
email over to that mailing list and also provide your sqlmapconfig.xml
as well as your BSSqlMapConfig source.
Brandon
On 5/5/05, Dwight Galloway <ds...@utah.gov> wrote:
> Not sure if this right forum but I have a problem that I have been
> working on for almost a week, I am new to Ibatis and am just trying to
> hook up to my database and am getting the following error (in red).....
> I know that I am close but just cant seem to see it, I ask that you
> please take a look at this, if this is the wrong way to get my questions
> answered please just let me know what I need to do to properly submit my
> questions... thank you in advance for any advice you can provide, I have
> included my xml document and where I read from too. .
>
> [5/5/05 17:26:29:641 MDT] 6b6bd603 SystemOut O =DEBUG
> [Servlet.Engine.Transports : 1] May/05 17:26:29 |
> (BSController.class:195) Map =
> {providerAction=gov.utah.dhs.dsamh.bs.actions.ProviderAction,
> serverAction=gov.utah.dhs.dsamh.bs.actions.ServerAction,
> trainerAction=gov.utah.dhs.dsamh.bs.actions.TrainerAction}
> =DEBUG [Servlet.Engine.Transports : 1] May/05 17:26:29 |
> (BSController.class:64) Inside of controller do process
> =DEBUG [Servlet.Engine.Transports : 1] May/05 17:26:29 |
> (BSController.class:80) Inside of key if serverAction
> inside of the bss mapper
> [5/5/05 17:26:30:062 MDT] 6b6bd603 ConnectionFac I J2CA0122I: Resource
> reference jdbc/bss could not be located, so default values of the
> following are used: [Resource-ref settings]
>
> res-auth: 1 (APPLICATION)
> res-isolation-level: 0 (TRANSACTION_NONE)
> res-sharing-scope: true (SHAREABLE)
> res-resolution-control: 999 (undefined)
> [Other attributes]
>
> isCMP1_x: false (not CMP1.x)
> isJMS: false (not JMS)
>
> [5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O ServerAction -
> inside of the process request
> [5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O Action received:
> First Name = Joe
> [5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O Action received:
> Last Name = Buckwheat
> [5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O Action received:
> Middle Name = Dee
> [5/5/05 17:26:30:219 MDT] 6b6bd603 SystemOut O Action received: SSN
> = 1234
> [5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in gov/utah/dhs/dsamh/bs/dao/Server.xml.
> --- The error occurred while applying a parameter map.
> --- Check the getServer-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: com.sybase.jdbc2.jdbc.SybSQLException: ASA Error -131:
> Syntax error near 'id' on line 1
> Caused by: com.sybase.jdbc2.jdbc.SybSQLException: ASA Error -131:
> Syntax error near 'id' on line 1
> [5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:181)
> [5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:100)
> [5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)
> [5/5/05 17:26:30:250 MDT] 6b6bd603 SystemErr R at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
>
> my xml document looks like the following
>
> <?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="Server">
>
> <select id="getServer"
> resultClass="gov.utah.dhs.dsamh.bs.beans.ServerBean"
> parameterClass="int">
> SELECT *
> id as id,
> first_name as firstName,
> middle_name as middleName,
> last_name as lastName,
> ssn_four as ssn,
> SYSTEM_USER_ID as systemUser,
> FROM dba.tbl_server
> WHERE id = #value#
> </select>
>
> <insert id="insertServer"
> parameterClass="gov.utah.dhs.dsamh.bs.beans.ServerBean">
> INSERT INTO
> server (id, first_name, middle_name,
> last_name, ssn_four, system_user_id)
> VALUES (#id#, #firstName#, #middleName#, #lastName#,
> #ssn#, #systemUser#, )
> </insert>
>
> <update id="updateServer"
> parameterClass="gov.utah.dhs.dsamh.bs.beans.ServerBean">
> UPDATE server
> SET first_name = #firstName#,
> middle_name = #middleName#,
> last_name = #lastName#,
> ssn_four = #ssn#,
> WHERE id = #id#
> </update>
>
> <delete id="deleteServer"
> parameterClass="gov.utah.dhs.dsamh.bs.beans.ServerBean">
> DELETE server
> WHERE id = #id#
> </delete>
> </sqlMap>
>
> and where I read the objects from the database looks like the
> following
>
> private ServerBean setParameters()
> {
> // SqlMapClient sqlMap =
> BSSqlMapConfig.getSqlMapInstance();
> Integer id=new Integer(1);
> ServerBean sb = null;
> try {
> sb = (ServerBean)
> sqlMap.queryForObject("getServer", id);
> } catch (SQLException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> return sb;
> /* sb.server1 =
> (Server)sqlMap.queryForObject("getServer",id);
> return sb;
> ServerBean sb = new ServerBean();
> sb.setCreateDate("2005-01-01");
> sb.setSystemUser("dsgallow");
> sb.setFirstName("John");
> sb.setLastName("Lennon");
> sb.setMiddleName("L");
> sb.setSsn("1234");
> return sb;
> */
> }
> }
>
> Dwight S. Galloway
> (801) 538-4234
> dsgallow@utah.gov
> Office of Technology
> Department of Human Services
> MAKE IT A GREAT DAY!
>