ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cuong PN <pncuon...@yahoo.com>
Subject iBatis configuration problem
Date Wed, 28 May 2008 15:57:28 GMT

Hi guys

I've been looking at this, searching the Internet, trying this and that but
nothing works yet. I'd greatly appreciate any help to resolve this. Thanks
so so much!

When I run, I got this error:

com.ibatis.sqlmap.client.SqlMapException: There is no statement named
TTS_USER.countUsers in this SqlMap.

Even though after searching thru the net, I think my configuration looks
right, at least the namespace part. Or am I wrong? Funny thing is even if I
messed up the xml format of sqlmap file (like doing "</sqlMap----- #>"
instead of a correct closing tag "</sqlMap>), nothing is complained about.
Looks like SQLMaps isn't even reading that sqlmap file. Please kindly see
details below:

---- sqlMapConfig.xml ------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config


<properties resource="appSqlMapConfig.properties" />


<transactionManager type="JDBC" >
    <dataSource type="JNDI">
        <property name="DataSource" value="${appJNDI}"/>

<sqlMap resource="sqlMapCollection.xml" />

----  End of sqlMapConfig.xml ------

---- sqlMapCollection.xml ------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config

    <sqlMap resource="sqlmap/sql/tts_user.xml" />

---- End of sqlMapCollection.xml ------

---- tts_user.xml ----
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"

<sqlMap namespace="TTS_USER"> 
    <select id="countUsers" resultClass="Integer">
        select count(*) from users
---- End of tts_user.xml ----

And here's how I configure SQLMaps from java file:

            private static Reader reader;
            private static String sqlMapConfigResource =

            reader = Resources.getResourceAsReader(sqlMapConfigResource);
            sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader);
            List resultList = sqlMapper.queryForList("TTS_USER.countUsers");

Hope to hear from your reply soon! Thanks again!
View this message in context: http://www.nabble.com/iBatis-configuration-problem-tp17516022p17516022.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message