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 "Angso, Tony" <To...@medco.com> on 2008/03/05 21:23:09 UTC

Need Help in iBatis Configuration


Am running in RAD6 and getting the following error

[3/5/08 14:24:50:692 EST] 00000025 SystemErr R
java.lang.RuntimeException: Error occurred. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
java.lang.RuntimeException: Error parsing XPath
'/sqlMapConfig/transactionManager/dataSource/end()'. Cause:
com.ibatis.sqlmap.client.SqlMapException: Error initializing DataSource.
Could not instantiate DataSourceFactory. Cause:
java.lang.RuntimeException: SimpleDataSource: Error while loading
properties. Cause: java.lang.RuntimeException: SimpleDataSource: Some
properties were not set.

my db.properties

driver=oracle.jdbc.driver.OracleDriver
jdbc.url.alpha=jdbc:oracle:thin:@//mcfl1uaq:1535/MCDBI03
username.alpha=user
password.alpha=password

my sqlmapconfig.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config
2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
    <properties resource="db.properties"/>
    <settings cacheModelsEnabled="true" enhancementEnabled="true"
lazyLoadingEnabled="true" maxRequests="1024" maxSessions="128"
maxTransactions="32" useStatementNamespaces="false"/>
    <transactionManager type="JDBC">
        <dataSource type="SIMPLE">
            <property name="JDBC.Driver" value="${driver}"/>
            <property name="JDBC.ConnectionURL"
value="${jdbc.url.alpha}"/>
            <property name="JDBC.Username" value="${username.alpha}"/>
            <property name="JDBC.Password" value="${password.alpha}"/>
        </dataSource>
    </transactionManager>
    <sqlMap resource="xml/uv_sqlmap.xml"/>
</sqlMapConfig>

Am getting error in 

String resource = "sqlmapconfig.xml";
Reader reader = Resources.getResourceAsReader(resource);
alphaSqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);  // <--
error on this statement

Appreciate any help! Thanks
Tony


RE: Need Help on Complex WHERE CLAUSE

Posted by Jason Kratz <ja...@firm58.com>.
The answer it would seem is in the exception. That table isn't viewable
either because it doesn't exist or, more likely, that the user executing the
query in Oracle doesn't have permissions on that table.  Is the table being
queried in a different schema?

Jason

-----Original Message-----
From: Angso, Tony [mailto:Tony_Angso@medco.com] 
Sent: Thursday, March 06, 2008 1:43 PM
To: user-java@ibatis.apache.org
Subject: Need Help on Complex WHERE CLAUSE

Am trying to pass a complex WHERE CLAUSE

sqlMap is 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap>
	
	<parameterMap id="rxlocParam" class="map">
		<parameter property="rx" jdbcType="VARCHAR"
javaType="java.lang.String" />
		<parameter property="loc" jdbcType="VARCHAR"
javaType="java.lang.String" />
	</parameterMap>
	<select id="getEISPolyScript" parameterMap="rxlocParam"
resultClass="java.util.HashMap">
		SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
F_LIBRARY_ID
		FROM IM_RX
		WHERE RXNUM_TXT =   #rx#
		   AND LOCATION_CDE = #loc#
	</select>
</sqlMap>

Java code is
		Map map = new HashMap();
		map.put("rx", "0101402722");
		map.put("loc","03");
		
		list = sqlMap.queryForList("getEISPolyScript", map);
// <-- error here
		System.out.println("Selected " + list.size() + "
records.");



Getting this error
[3/6/08 14:25:17:541 EST] 00000026 SystemErr     R
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in WEB-INF/config/uv_sqlmap.xml.  
--- The error occurred while applying a parameter map.  
--- Check the getEISPolyScript-InlineParameterMap.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: ORA-00942: table or view does not
exist


Thanks for any help.

Tony


RE: Need Help in iBatis Configuration

Posted by "Angso, Tony" <To...@medco.com>.
I got the driver...
 
now am getting this error...
Cause: org.xml.sax.SAXParseException: Document root element "select",
must match DOCTYPE root "null".

I have the doc type as

<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config
2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

and my sql map is simple...

<select id="getDocId"
parameterClass="int"
resultClass=" java.util.HashMap">

SELECT FILENET_DOC_ID AS id,DOC_SIDE_CDE AS page FROM IMAGE

WHERE FILENET_DOC_ID = #id#

</select>

Thanks for any help..

Tony

 

	-----Original Message-----
	From: Nathan Maves [mailto:nathan.maves@gmail.com] 
	Sent: Wednesday, March 05, 2008 5:20 PM
	To: user-java@ibatis.apache.org
	Subject: Re: Need Help in iBatis Configuration
	
	
	my first guess would be hmmmm Oracle!
	
	if that one missed you, one might try 
	
	http://www.google.com/search?q=oracle+driver+for+java
	
	
	
	
	On Wed, Mar 5, 2008 at 3:15 PM, Angso, Tony
<To...@medco.com> wrote:
	

		Am getting this now
		
		 Error while loading properties. Cause:
		
		java.lang.ClassNotFoundException:
oracle.jdbc.driver.OracleDriver
		
		Where can I get the Oracle Driver?
		

		-----Original Message-----
		From: Clinton Begin [mailto:clinton.begin@gmail.com]
		Sent: Wednesday, March 05, 2008 3:40 PM
		To: user-java@ibatis.apache.org
		
		Subject: RE: Need Help in iBatis Configuration
		
		
		Wow, sorry for such a horribly unhelpful error!  That
exception is
		thrown if any of these keys are missing, not simply
null, but completely
		missing.
		
		           <property name="JDBC.Driver"
value="${driver}"/>
		           <property name="JDBC.ConnectionURL"
		value="${jdbc.url.alpha}"/>
		           <property name="JDBC.Username"
value="${username.alpha}"/>
		           <property name="JDBC.Password"
value="${password.alpha}"/>
		
		But they are indeed there... so I'm confused too, as it
should
		succeed...?
		
		Is there any chance this is the wrong XML configuration
file that's
		being loaded?
		
		Clinton
		
		
		-----Original Message-----
		From: Angso, Tony [mailto:Tony_Angso@medco.com]
		Sent: March-05-08 1:23 PM
		To: user-java@ibatis.apache.org
		Subject: Need Help in iBatis Configuration
		
		
		
		Am running in RAD6 and getting the following error
		
		[3/5/08 14:24:50:692 EST] 00000025 SystemErr R
		java.lang.RuntimeException: Error occurred. Cause:
		com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause:
		java.lang.RuntimeException: Error parsing XPath
		'/sqlMapConfig/transactionManager/dataSource/end()'.
Cause:
		com.ibatis.sqlmap.client.SqlMapException: Error
initializing DataSource.
		Could not instantiate DataSourceFactory. Cause:
		java.lang.RuntimeException: SimpleDataSource: Error
while loading
		properties. Cause: java.lang.RuntimeException:
SimpleDataSource: Some
		properties were not set.
		
		my db.properties
		
		driver=oracle.jdbc.driver.OracleDriver
		jdbc.url.alpha=jdbc:oracle:thin:@//mcfl1uaq:1535/MCDBI03
		username.alpha=user
		password.alpha=password
		
		my sqlmapconfig.xml
		
		<?xml version="1.0" encoding="UTF-8"?>
		<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL
Map Config
		2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
		<sqlMapConfig>
		   <properties resource="db.properties"/>
		   <settings cacheModelsEnabled="true"
enhancementEnabled="true"
		lazyLoadingEnabled="true" maxRequests="1024"
maxSessions="128"
		maxTransactions="32" useStatementNamespaces="false"/>
		   <transactionManager type="JDBC">
		       <dataSource type="SIMPLE">
		           <property name="JDBC.Driver"
value="${driver}"/>
		           <property name="JDBC.ConnectionURL"
		value="${jdbc.url.alpha}"/>
		           <property name="JDBC.Username"
value="${username.alpha}"/>
		           <property name="JDBC.Password"
value="${password.alpha}"/>
		       </dataSource>
		   </transactionManager>
		   <sqlMap resource="xml/uv_sqlmap.xml"/>
		</sqlMapConfig>
		
		Am getting error in
		
		String resource = "sqlmapconfig.xml";
		Reader reader = Resources.getResourceAsReader(resource);
		alphaSqlMap =
SqlMapClientBuilder.buildSqlMapClient(reader);  // <--
		error on this statement
		
		Appreciate any help! Thanks
		Tony
		
		
		
		-----------------------------------------
		This e-mail message and any attachments contain
confidential
		information from Medco. If you are not the intended
recipient, you
		are hereby notified that disclosure, printing, copying,
		distribution, or the taking of any action in reliance on
the
		contents of this electronic information is strictly
prohibited. If
		you have received this e-mail message in error, please
immediately
		notify the sender by reply message and then delete the
electronic
		message and any attachments.
		



Re: Need Help in iBatis Configuration

Posted by Nathan Maves <na...@gmail.com>.
my first guess would be hmmmm Oracle!

if that one missed you, one might try

http://www.google.com/search?q=oracle+driver+for+java



On Wed, Mar 5, 2008 at 3:15 PM, Angso, Tony <To...@medco.com> wrote:

> Am getting this now
>  Error while loading properties. Cause:
> java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
>
> Where can I get the Oracle Driver?
>
> -----Original Message-----
> From: Clinton Begin [mailto:clinton.begin@gmail.com]
> Sent: Wednesday, March 05, 2008 3:40 PM
> To: user-java@ibatis.apache.org
> Subject: RE: Need Help in iBatis Configuration
>
>
> Wow, sorry for such a horribly unhelpful error!  That exception is
> thrown if any of these keys are missing, not simply null, but completely
> missing.
>
>            <property name="JDBC.Driver" value="${driver}"/>
>            <property name="JDBC.ConnectionURL"
> value="${jdbc.url.alpha}"/>
>            <property name="JDBC.Username" value="${username.alpha}"/>
>            <property name="JDBC.Password" value="${password.alpha}"/>
>
> But they are indeed there... so I'm confused too, as it should
> succeed...?
>
> Is there any chance this is the wrong XML configuration file that's
> being loaded?
>
> Clinton
>
>
> -----Original Message-----
> From: Angso, Tony [mailto:Tony_Angso@medco.com]
> Sent: March-05-08 1:23 PM
> To: user-java@ibatis.apache.org
> Subject: Need Help in iBatis Configuration
>
>
>
> Am running in RAD6 and getting the following error
>
> [3/5/08 14:24:50:692 EST] 00000025 SystemErr R
> java.lang.RuntimeException: Error occurred. Cause:
> com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
> java.lang.RuntimeException: Error parsing XPath
> '/sqlMapConfig/transactionManager/dataSource/end()'. Cause:
> com.ibatis.sqlmap.client.SqlMapException: Error initializing DataSource.
> Could not instantiate DataSourceFactory. Cause:
> java.lang.RuntimeException: SimpleDataSource: Error while loading
> properties. Cause: java.lang.RuntimeException: SimpleDataSource: Some
> properties were not set.
>
> my db.properties
>
> driver=oracle.jdbc.driver.OracleDriver
> jdbc.url.alpha=jdbc:oracle:thin:@//mcfl1uaq:1535/MCDBI03
> username.alpha=user
> password.alpha=password
>
> my sqlmapconfig.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config
> 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
> <sqlMapConfig>
>    <properties resource="db.properties"/>
>    <settings cacheModelsEnabled="true" enhancementEnabled="true"
> lazyLoadingEnabled="true" maxRequests="1024" maxSessions="128"
> maxTransactions="32" useStatementNamespaces="false"/>
>    <transactionManager type="JDBC">
>        <dataSource type="SIMPLE">
>            <property name="JDBC.Driver" value="${driver}"/>
>            <property name="JDBC.ConnectionURL"
> value="${jdbc.url.alpha}"/>
>            <property name="JDBC.Username" value="${username.alpha}"/>
>            <property name="JDBC.Password" value="${password.alpha}"/>
>        </dataSource>
>    </transactionManager>
>    <sqlMap resource="xml/uv_sqlmap.xml"/>
> </sqlMapConfig>
>
> Am getting error in
>
> String resource = "sqlmapconfig.xml";
> Reader reader = Resources.getResourceAsReader(resource);
> alphaSqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);  // <--
> error on this statement
>
> Appreciate any help! Thanks
> Tony
>
>
> -----------------------------------------
> This e-mail message and any attachments contain confidential
> information from Medco. If you are not the intended recipient, you
> are hereby notified that disclosure, printing, copying,
> distribution, or the taking of any action in reliance on the
> contents of this electronic information is strictly prohibited. If
> you have received this e-mail message in error, please immediately
> notify the sender by reply message and then delete the electronic
> message and any attachments.
>

RE: Need Help in iBatis Configuration

Posted by "Angso, Tony" <To...@medco.com>.
I just stop and restart WebSphere... Now it is working... ;-P


-----Original Message-----
From: Angso, Tony 
Sent: Monday, March 10, 2008 9:45 AM
To: 'user-java@ibatis.apache.org'
Subject: RE: Need Help in iBatis Configuration



When using the SQLMap and Java code below, am getting an empty result,
(I mean not null).  The parameter values are correct and when queried
directly, it return 1 row. However doing it through iBatis, return an
empty but initialized rxBean...

Any help is much appreciated.


My SQLMap is
	<parameterMap id="rxlocParam" class="map">
		<parameter property="rx" jdbcType="VARCHAR"
javaType="java.lang.String"/>
		<parameter property="loc" jdbcType="VARCHAR"
javaType="java.lang.String"/>
	</parameterMap>
	<resultMap id="ImRxBean"
class="com.medco.imaging.app.alpha.ImRxBean">
		<result property="docId" column="F_DOCNUMBER_ID"/>
		<result property="tiffDocId" column="TIFF_DOC_ID"/>
		<result property="docCommittalDate"
column="DOC_COMMITTAL_DTE"/>
		<result property="libraryName" column="F_LIBRARY_NAME"/>
		<result property="rx" column="RXNUM_TXT"/>
		<result property="loc" column="LOCATION_CDE"/>
		<result property="deleteDate" column="F_DELETE_DTE"/>
	</resultMap>
	<select id="getEISPolyScript" parameterMap="rxlocParam"
resultMap="ImRxBean" >
		SELECT F_DOCNUMBER_ID, 
			TIFF_DOC_ID, 
			DOC_COMMITTAL_DTE, 
			F_LIBRARY_NAME,
			RXNUM_TXT,
			LOCATION_CDE,
			F_DELETE_DTE
		FROM IM_RX rx, IM_FILENET_LIBRARY lib
		WHERE rx.F_LIBRARY_ID = lib.F_LIBRARY_ID 
		   AND RXNUM_TXT =   ?
		   AND LOCATION_CDE = ?
	</select>

My Java Code is

		Map map = new HashMap();
		map.put("rx", "0101402722");
		map.put("loc","03");

ImRxBean rxBean = (ImRxBean) sqlMap.queryForObject("getEISPolyScript",
map);

rxBean.getDocId returns zero??? Did it find any record?, if it did why
zero?

Thanks

Tony

-----------------------------------------
This e-mail message and any attachments contain confidential
information from Medco. If you are not the intended recipient, you
are hereby notified that disclosure, printing, copying,
distribution, or the taking of any action in reliance on the
contents of this electronic information is strictly prohibited. If
you have received this e-mail message in error, please immediately
notify the sender by reply message and then delete the electronic
message and any attachments.

RE: Need Help in iBatis Configuration

Posted by "Angso, Tony" <To...@medco.com>.
When using the SQLMap and Java code below, am getting an empty result,
(I mean not null).  The parameter values are correct and when queried
directly, it return 1 row. However doing it through iBatis, return an
empty but initialized rxBean...

Any help is much appreciated.


My SQLMap is
	<parameterMap id="rxlocParam" class="map">
		<parameter property="rx" jdbcType="VARCHAR"
javaType="java.lang.String"/>
		<parameter property="loc" jdbcType="VARCHAR"
javaType="java.lang.String"/>
	</parameterMap>
	<resultMap id="ImRxBean"
class="com.medco.imaging.app.alpha.ImRxBean">
		<result property="docId" column="F_DOCNUMBER_ID"/>
		<result property="tiffDocId" column="TIFF_DOC_ID"/>
		<result property="docCommittalDate"
column="DOC_COMMITTAL_DTE"/>
		<result property="libraryName" column="F_LIBRARY_NAME"/>
		<result property="rx" column="RXNUM_TXT"/>
		<result property="loc" column="LOCATION_CDE"/>
		<result property="deleteDate" column="F_DELETE_DTE"/>
	</resultMap>
	<select id="getEISPolyScript" parameterMap="rxlocParam"
resultMap="ImRxBean" >
		SELECT F_DOCNUMBER_ID, 
			TIFF_DOC_ID, 
			DOC_COMMITTAL_DTE, 
			F_LIBRARY_NAME,
			RXNUM_TXT,
			LOCATION_CDE,
			F_DELETE_DTE
		FROM IM_RX rx, IM_FILENET_LIBRARY lib
		WHERE rx.F_LIBRARY_ID = lib.F_LIBRARY_ID 
		   AND RXNUM_TXT =   ?
		   AND LOCATION_CDE = ?
	</select>

My Java Code is

		Map map = new HashMap();
		map.put("rx", "0101402722");
		map.put("loc","03");

ImRxBean rxBean = (ImRxBean) sqlMap.queryForObject("getEISPolyScript",
map);

rxBean.getDocId returns zero??? Did it find any record?, if it did why
zero?

Thanks

Tony

-----------------------------------------
This e-mail message and any attachments contain confidential
information from Medco. If you are not the intended recipient, you
are hereby notified that disclosure, printing, copying,
distribution, or the taking of any action in reliance on the
contents of this electronic information is strictly prohibited. If
you have received this e-mail message in error, please immediately
notify the sender by reply message and then delete the electronic
message and any attachments.

RE: Need Help on Complex WHERE CLAUSE

Posted by Sundar Sankaranarayanan <Su...@phoenix.edu>.
If the obvious fact of table not existing was not missed then I am
guessing it could be that the username with whom u r trying to connect
to from the application, doesn't have access to these tables/schema and
u can probably query these tables with your development login access .
My 2 cents!!!

-S

-----Original Message-----
From: Jared Blitzstein [mailto:mailing-list@blitzstein.net] 
Sent: Thursday, March 06, 2008 12:46 PM
To: user-java@ibatis.apache.org
Subject: Re: Need Help on Complex WHERE CLAUSE

Here is a silly question, but did you investigate "--- Cause:  
java.sql.SQLException: ORA-00942: table or view does exist" not at all?
Turn on log4j and see what statement it's executing.


On Mar 6, 2008, at 2:42 PM, Angso, Tony wrote:

> Am trying to pass a complex WHERE CLAUSE
>
> sqlMap is
>
> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMap PUBLIC 
> "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-2.dtd">
> <sqlMap>
> 	
> 	<parameterMap id="rxlocParam" class="map">
> 		<parameter property="rx" jdbcType="VARCHAR"
> javaType="java.lang.String" />
> 		<parameter property="loc" jdbcType="VARCHAR"
> javaType="java.lang.String" />
> 	</parameterMap>
> 	<select id="getEISPolyScript" parameterMap="rxlocParam"
> resultClass="java.util.HashMap">
> 		SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
F_LIBRARY_ID
> 		FROM IM_RX
> 		WHERE RXNUM_TXT =   #rx#
> 		   AND LOCATION_CDE = #loc#
> 	</select>
> </sqlMap>
>
> Java code is
> 		Map map = new HashMap();
> 		map.put("rx", "0101402722");
> 		map.put("loc","03");
> 		
> 		list = sqlMap.queryForList("getEISPolyScript", map); //
<-- error 
> here
> 		System.out.println("Selected " + list.size() + "
> records.");
>
>
>
> Getting this error
> [3/6/08 14:25:17:541 EST] 00000026 SystemErr     R
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in WEB-INF/config/uv_sqlmap.xml.
> --- The error occurred while applying a parameter map.
> --- Check the getEISPolyScript-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: java.sql.SQLException: ORA-00942: table or view does not 
> exist
>
>
> Thanks for any help.
>
> Tony


Re: Need Help on Complex WHERE CLAUSE

Posted by Nathan Maves <na...@gmail.com>.
Tony,

This is correct if you are using parameter maps.  If you are using inline
paramter maps you would still use #rx#.

Nathan

On Thu, Mar 6, 2008 at 1:48 PM, Angso, Tony <To...@medco.com> wrote:

> I found the problem...
>
>                WHERE RXNUM_TXT =   #rx#
>                   AND LOCATION_CDE = #loc#
>
> Should be replaced with
>
>                WHERE RXNUM_TXT =  ?
>                   AND LOCATION_CDE = ?
>
>
> And it work...
> Am new to ibatis and currently just playing with it... So thanks for all
> for answering my "newbie" question...
>
> Thanks
>
>
> Tony
>
>
> -----Original Message-----
> From: Angso, Tony
> Sent: Thursday, March 06, 2008 3:09 PM
> To: 'user-java@ibatis.apache.org'
> Subject: RE: Need Help on Complex WHERE CLAUSE
>
>
> Found the error, my sqlMap object is poitning to a different instance of
> Oracle Database, hence it can't find the table... So I fixed that... Now
> it shows a different error..
>
> [3/6/08 15:01:53:682 EST] 00000026 SystemErr     R
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in WEB-INF/config/uv_sqlmap.xml.
> --- The error occurred while applying a parameter map.
> --- Check the rxlocParam.
> --- Check the statement (query failed).
> --- Cause: java.sql.SQLException: ORA-00911: invalid character
>
>  <?xml version="1.0" encoding="UTF-8"?>
>  <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
>  "http://ibatis.apache.org/dtd/sql-map-2.dtd">
>  <sqlMap>
>
>        <parameterMap id="rxlocParam" class="map">
>                <parameter property="rx" jdbcType="VARCHAR"
>  javaType="java.lang.String" />
>                <parameter property="loc" jdbcType="VARCHAR"
>  javaType="java.lang.String" />
>        </parameterMap>
>        <select id="getEISPolyScript" parameterMap="rxlocParam"
>  resultClass="java.util.HashMap">
>                SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
> F_LIBRARY_ID
>                FROM IM_RX
>                WHERE RXNUM_TXT =   #rx#
>                   AND LOCATION_CDE = #loc#
>        </select>
>  </sqlMap>
>
> What is the invalid character????
>
> With the above sqlMap,
>
> Map map = new HashMap();
> map.put("rx", "0101402722");
> map.put("loc","03");
>
> list = sqlMap.queryForList("getEISPolyScript", map); // <-- error here
> System.out.println("Selected " + list.size() + " records.");
>
> Is it allowed to use sqlMap.queryForList()?
>
> Thanks for all the patience...
>
> Tony
>
>
>
> -----Original Message-----
> From: Jared Blitzstein [mailto:mailing-list@blitzstein.net]
> Sent: Thursday, March 06, 2008 2:46 PM
> To: user-java@ibatis.apache.org
> Subject: Re: Need Help on Complex WHERE CLAUSE
>
>
> Here is a silly question, but did you investigate "--- Cause:
> java.sql.SQLException: ORA-00942: table or view does exist" not at
> all? Turn on log4j and see what statement it's executing.
>
>
> On Mar 6, 2008, at 2:42 PM, Angso, Tony wrote:
>
> > Am trying to pass a complex WHERE CLAUSE
> >
> > sqlMap is
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> > "http://ibatis.apache.org/dtd/sql-map-2.dtd">
> > <sqlMap>
> >
> >       <parameterMap id="rxlocParam" class="map">
> >               <parameter property="rx" jdbcType="VARCHAR"
> > javaType="java.lang.String" />
> >               <parameter property="loc" jdbcType="VARCHAR"
> > javaType="java.lang.String" />
> >       </parameterMap>
> >       <select id="getEISPolyScript" parameterMap="rxlocParam"
> > resultClass="java.util.HashMap">
> >               SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
> F_LIBRARY_ID
> >               FROM IM_RX
> >               WHERE RXNUM_TXT =   #rx#
> >                  AND LOCATION_CDE = #loc#
> >       </select>
> > </sqlMap>
> >
> > Java code is
> >               Map map = new HashMap();
> >               map.put("rx", "0101402722");
> >               map.put("loc","03");
> >
> >               list = sqlMap.queryForList("getEISPolyScript", map);
> > // <-- error here
> >               System.out.println("Selected " + list.size() + "
> records.");
> >
> >
> >
> > Getting this error
> > [3/6/08 14:25:17:541 EST] 00000026 SystemErr     R
> > com.ibatis.common.jdbc.exception.NestedSQLException:
> > --- The error occurred in WEB-INF/config/uv_sqlmap.xml.
> > --- The error occurred while applying a parameter map.
> > --- Check the getEISPolyScript-InlineParameterMap.
> > --- Check the statement (query failed).
> > --- Cause: java.sql.SQLException: ORA-00942: table or view does not
> > exist
> >
> >
> > Thanks for any help.
> >
> > Tony
>
>
> -----------------------------------------
> This e-mail message and any attachments contain confidential
> information from Medco. If you are not the intended recipient, you
> are hereby notified that disclosure, printing, copying,
> distribution, or the taking of any action in reliance on the
> contents of this electronic information is strictly prohibited. If
> you have received this e-mail message in error, please immediately
> notify the sender by reply message and then delete the electronic
> message and any attachments.
>

RE: Need Help on Complex WHERE CLAUSE

Posted by "Angso, Tony" <To...@medco.com>.
I found the problem...

 		WHERE RXNUM_TXT =   #rx#
 		   AND LOCATION_CDE = #loc#

Should be replaced with 

 		WHERE RXNUM_TXT =  ?
 		   AND LOCATION_CDE = ?


And it work...
Am new to ibatis and currently just playing with it... So thanks for all
for answering my "newbie" question...

Thanks


Tony


-----Original Message-----
From: Angso, Tony 
Sent: Thursday, March 06, 2008 3:09 PM
To: 'user-java@ibatis.apache.org'
Subject: RE: Need Help on Complex WHERE CLAUSE


Found the error, my sqlMap object is poitning to a different instance of
Oracle Database, hence it can't find the table... So I fixed that... Now
it shows a different error..

[3/6/08 15:01:53:682 EST] 00000026 SystemErr     R
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in WEB-INF/config/uv_sqlmap.xml.  
--- The error occurred while applying a parameter map.  
--- Check the rxlocParam.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: ORA-00911: invalid character

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" 
 "http://ibatis.apache.org/dtd/sql-map-2.dtd">
 <sqlMap>
 	
 	<parameterMap id="rxlocParam" class="map">
 		<parameter property="rx" jdbcType="VARCHAR" 
 javaType="java.lang.String" />
 		<parameter property="loc" jdbcType="VARCHAR" 
 javaType="java.lang.String" />
 	</parameterMap>
 	<select id="getEISPolyScript" parameterMap="rxlocParam" 
 resultClass="java.util.HashMap">
 		SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
F_LIBRARY_ID
 		FROM IM_RX
 		WHERE RXNUM_TXT =   #rx#
 		   AND LOCATION_CDE = #loc#
 	</select>
 </sqlMap>

What is the invalid character????

With the above sqlMap,

Map map = new HashMap();
map.put("rx", "0101402722");
map.put("loc","03");
 		
list = sqlMap.queryForList("getEISPolyScript", map); // <-- error here
System.out.println("Selected " + list.size() + " records.");

Is it allowed to use sqlMap.queryForList()?

Thanks for all the patience...

Tony



-----Original Message-----
From: Jared Blitzstein [mailto:mailing-list@blitzstein.net] 
Sent: Thursday, March 06, 2008 2:46 PM
To: user-java@ibatis.apache.org
Subject: Re: Need Help on Complex WHERE CLAUSE


Here is a silly question, but did you investigate "--- Cause:  
java.sql.SQLException: ORA-00942: table or view does exist" not at  
all? Turn on log4j and see what statement it's executing.


On Mar 6, 2008, at 2:42 PM, Angso, Tony wrote:

> Am trying to pass a complex WHERE CLAUSE
>
> sqlMap is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-2.dtd">
> <sqlMap>
> 	
> 	<parameterMap id="rxlocParam" class="map">
> 		<parameter property="rx" jdbcType="VARCHAR"
> javaType="java.lang.String" />
> 		<parameter property="loc" jdbcType="VARCHAR" 
> javaType="java.lang.String" />
> 	</parameterMap>
> 	<select id="getEISPolyScript" parameterMap="rxlocParam" 
> resultClass="java.util.HashMap">
> 		SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
F_LIBRARY_ID
> 		FROM IM_RX
> 		WHERE RXNUM_TXT =   #rx#
> 		   AND LOCATION_CDE = #loc#
> 	</select>
> </sqlMap>
>
> Java code is
> 		Map map = new HashMap();
> 		map.put("rx", "0101402722");
> 		map.put("loc","03");
> 		
> 		list = sqlMap.queryForList("getEISPolyScript", map);
> // <-- error here
> 		System.out.println("Selected " + list.size() + "
records.");
>
>
>
> Getting this error
> [3/6/08 14:25:17:541 EST] 00000026 SystemErr     R
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in WEB-INF/config/uv_sqlmap.xml.
> --- The error occurred while applying a parameter map.
> --- Check the getEISPolyScript-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: java.sql.SQLException: ORA-00942: table or view does not 
> exist
>
>
> Thanks for any help.
>
> Tony


-----------------------------------------
This e-mail message and any attachments contain confidential
information from Medco. If you are not the intended recipient, you
are hereby notified that disclosure, printing, copying,
distribution, or the taking of any action in reliance on the
contents of this electronic information is strictly prohibited. If
you have received this e-mail message in error, please immediately
notify the sender by reply message and then delete the electronic
message and any attachments.

RE: Need Help on Complex WHERE CLAUSE

Posted by "Angso, Tony" <To...@medco.com>.
Found the error, my sqlMap object is poitning to a different instance of
Oracle Database, hence it can't find the table...
So I fixed that... Now it shows a different error..

[3/6/08 15:01:53:682 EST] 00000026 SystemErr     R
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in WEB-INF/config/uv_sqlmap.xml.  
--- The error occurred while applying a parameter map.  
--- Check the rxlocParam.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: ORA-00911: invalid character

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" 
 "http://ibatis.apache.org/dtd/sql-map-2.dtd">
 <sqlMap>
 	
 	<parameterMap id="rxlocParam" class="map">
 		<parameter property="rx" jdbcType="VARCHAR" 
 javaType="java.lang.String" />
 		<parameter property="loc" jdbcType="VARCHAR" 
 javaType="java.lang.String" />
 	</parameterMap>
 	<select id="getEISPolyScript" parameterMap="rxlocParam" 
 resultClass="java.util.HashMap">
 		SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
F_LIBRARY_ID
 		FROM IM_RX
 		WHERE RXNUM_TXT =   #rx#
 		   AND LOCATION_CDE = #loc#
 	</select>
 </sqlMap>

What is the invalid character????

With the above sqlMap,

Map map = new HashMap();
map.put("rx", "0101402722");
map.put("loc","03");
 		
list = sqlMap.queryForList("getEISPolyScript", map); // <-- error here
System.out.println("Selected " + list.size() + " records.");

Is it allowed to use sqlMap.queryForList()?

Thanks for all the patience...

Tony



-----Original Message-----
From: Jared Blitzstein [mailto:mailing-list@blitzstein.net] 
Sent: Thursday, March 06, 2008 2:46 PM
To: user-java@ibatis.apache.org
Subject: Re: Need Help on Complex WHERE CLAUSE


Here is a silly question, but did you investigate "--- Cause:  
java.sql.SQLException: ORA-00942: table or view does exist" not at  
all? Turn on log4j and see what statement it's executing.


On Mar 6, 2008, at 2:42 PM, Angso, Tony wrote:

> Am trying to pass a complex WHERE CLAUSE
>
> sqlMap is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" 
> "http://ibatis.apache.org/dtd/sql-map-2.dtd">
> <sqlMap>
> 	
> 	<parameterMap id="rxlocParam" class="map">
> 		<parameter property="rx" jdbcType="VARCHAR" 
> javaType="java.lang.String" />
> 		<parameter property="loc" jdbcType="VARCHAR" 
> javaType="java.lang.String" />
> 	</parameterMap>
> 	<select id="getEISPolyScript" parameterMap="rxlocParam" 
> resultClass="java.util.HashMap">
> 		SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
F_LIBRARY_ID
> 		FROM IM_RX
> 		WHERE RXNUM_TXT =   #rx#
> 		   AND LOCATION_CDE = #loc#
> 	</select>
> </sqlMap>
>
> Java code is
> 		Map map = new HashMap();
> 		map.put("rx", "0101402722");
> 		map.put("loc","03");
> 		
> 		list = sqlMap.queryForList("getEISPolyScript", map);
> // <-- error here
> 		System.out.println("Selected " + list.size() + "
records.");
>
>
>
> Getting this error
> [3/6/08 14:25:17:541 EST] 00000026 SystemErr     R
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in WEB-INF/config/uv_sqlmap.xml.
> --- The error occurred while applying a parameter map.
> --- Check the getEISPolyScript-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: java.sql.SQLException: ORA-00942: table or view does not
> exist
>
>
> Thanks for any help.
>
> Tony


Re: Need Help on Complex WHERE CLAUSE

Posted by Jared Blitzstein <ma...@blitzstein.net>.
Here is a silly question, but did you investigate "--- Cause:  
java.sql.SQLException: ORA-00942: table or view does exist" not at  
all? Turn on log4j and see what statement it's executing.


On Mar 6, 2008, at 2:42 PM, Angso, Tony wrote:

> Am trying to pass a complex WHERE CLAUSE
>
> sqlMap is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-2.dtd">
> <sqlMap>
> 	
> 	<parameterMap id="rxlocParam" class="map">
> 		<parameter property="rx" jdbcType="VARCHAR"
> javaType="java.lang.String" />
> 		<parameter property="loc" jdbcType="VARCHAR"
> javaType="java.lang.String" />
> 	</parameterMap>
> 	<select id="getEISPolyScript" parameterMap="rxlocParam"
> resultClass="java.util.HashMap">
> 		SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
> F_LIBRARY_ID
> 		FROM IM_RX
> 		WHERE RXNUM_TXT =   #rx#
> 		   AND LOCATION_CDE = #loc#
> 	</select>
> </sqlMap>
>
> Java code is
> 		Map map = new HashMap();
> 		map.put("rx", "0101402722");
> 		map.put("loc","03");
> 		
> 		list = sqlMap.queryForList("getEISPolyScript", map);
> // <-- error here
> 		System.out.println("Selected " + list.size() + "
> records.");
>
>
>
> Getting this error
> [3/6/08 14:25:17:541 EST] 00000026 SystemErr     R
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in WEB-INF/config/uv_sqlmap.xml.
> --- The error occurred while applying a parameter map.
> --- Check the getEISPolyScript-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: java.sql.SQLException: ORA-00942: table or view does not
> exist
>
>
> Thanks for any help.
>
> Tony


Need Help on Complex WHERE CLAUSE

Posted by "Angso, Tony" <To...@medco.com>.
Am trying to pass a complex WHERE CLAUSE

sqlMap is 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap>
	
	<parameterMap id="rxlocParam" class="map">
		<parameter property="rx" jdbcType="VARCHAR"
javaType="java.lang.String" />
		<parameter property="loc" jdbcType="VARCHAR"
javaType="java.lang.String" />
	</parameterMap>
	<select id="getEISPolyScript" parameterMap="rxlocParam"
resultClass="java.util.HashMap">
		SELECT F_DOCNUMBER_ID, TIFF_DOC_ID, DOC_COMMITTAL_DTE,
F_LIBRARY_ID
		FROM IM_RX
		WHERE RXNUM_TXT =   #rx#
		   AND LOCATION_CDE = #loc#
	</select>
</sqlMap>

Java code is
		Map map = new HashMap();
		map.put("rx", "0101402722");
		map.put("loc","03");
		
		list = sqlMap.queryForList("getEISPolyScript", map);
// <-- error here
		System.out.println("Selected " + list.size() + "
records.");



Getting this error
[3/6/08 14:25:17:541 EST] 00000026 SystemErr     R
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in WEB-INF/config/uv_sqlmap.xml.  
--- The error occurred while applying a parameter map.  
--- Check the getEISPolyScript-InlineParameterMap.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: ORA-00942: table or view does not
exist


Thanks for any help.

Tony

RE: Need Help in iBatis Configuration

Posted by "Angso, Tony" <To...@medco.com>.
Am getting this now
 Error while loading properties. Cause:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

Where can I get the Oracle Driver?

-----Original Message-----
From: Clinton Begin [mailto:clinton.begin@gmail.com] 
Sent: Wednesday, March 05, 2008 3:40 PM
To: user-java@ibatis.apache.org
Subject: RE: Need Help in iBatis Configuration


Wow, sorry for such a horribly unhelpful error!  That exception is
thrown if any of these keys are missing, not simply null, but completely
missing.

            <property name="JDBC.Driver" value="${driver}"/>
            <property name="JDBC.ConnectionURL"
value="${jdbc.url.alpha}"/>
            <property name="JDBC.Username" value="${username.alpha}"/>
            <property name="JDBC.Password" value="${password.alpha}"/>

But they are indeed there... so I'm confused too, as it should
succeed...?

Is there any chance this is the wrong XML configuration file that's
being loaded?

Clinton


-----Original Message-----
From: Angso, Tony [mailto:Tony_Angso@medco.com] 
Sent: March-05-08 1:23 PM
To: user-java@ibatis.apache.org
Subject: Need Help in iBatis Configuration



Am running in RAD6 and getting the following error

[3/5/08 14:24:50:692 EST] 00000025 SystemErr R
java.lang.RuntimeException: Error occurred. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
java.lang.RuntimeException: Error parsing XPath
'/sqlMapConfig/transactionManager/dataSource/end()'. Cause:
com.ibatis.sqlmap.client.SqlMapException: Error initializing DataSource.
Could not instantiate DataSourceFactory. Cause:
java.lang.RuntimeException: SimpleDataSource: Error while loading
properties. Cause: java.lang.RuntimeException: SimpleDataSource: Some
properties were not set.

my db.properties

driver=oracle.jdbc.driver.OracleDriver
jdbc.url.alpha=jdbc:oracle:thin:@//mcfl1uaq:1535/MCDBI03
username.alpha=user
password.alpha=password

my sqlmapconfig.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config
2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
    <properties resource="db.properties"/>
    <settings cacheModelsEnabled="true" enhancementEnabled="true"
lazyLoadingEnabled="true" maxRequests="1024" maxSessions="128"
maxTransactions="32" useStatementNamespaces="false"/>
    <transactionManager type="JDBC">
        <dataSource type="SIMPLE">
            <property name="JDBC.Driver" value="${driver}"/>
            <property name="JDBC.ConnectionURL"
value="${jdbc.url.alpha}"/>
            <property name="JDBC.Username" value="${username.alpha}"/>
            <property name="JDBC.Password" value="${password.alpha}"/>
        </dataSource>
    </transactionManager>
    <sqlMap resource="xml/uv_sqlmap.xml"/>
</sqlMapConfig>

Am getting error in 

String resource = "sqlmapconfig.xml";
Reader reader = Resources.getResourceAsReader(resource);
alphaSqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);  // <--
error on this statement

Appreciate any help! Thanks
Tony


-----------------------------------------
This e-mail message and any attachments contain confidential
information from Medco. If you are not the intended recipient, you
are hereby notified that disclosure, printing, copying,
distribution, or the taking of any action in reliance on the
contents of this electronic information is strictly prohibited. If
you have received this e-mail message in error, please immediately
notify the sender by reply message and then delete the electronic
message and any attachments.

RE: Need Help in iBatis Configuration

Posted by Clinton Begin <cl...@gmail.com>.
Wow, sorry for such a horribly unhelpful error!  That exception is thrown if
any of these keys are missing, not simply null, but completely missing.

            <property name="JDBC.Driver" value="${driver}"/>
            <property name="JDBC.ConnectionURL" value="${jdbc.url.alpha}"/>
            <property name="JDBC.Username" value="${username.alpha}"/>
            <property name="JDBC.Password" value="${password.alpha}"/>

But they are indeed there... so I'm confused too, as it should succeed...?

Is there any chance this is the wrong XML configuration file that's being
loaded?

Clinton


-----Original Message-----
From: Angso, Tony [mailto:Tony_Angso@medco.com] 
Sent: March-05-08 1:23 PM
To: user-java@ibatis.apache.org
Subject: Need Help in iBatis Configuration



Am running in RAD6 and getting the following error

[3/5/08 14:24:50:692 EST] 00000025 SystemErr R
java.lang.RuntimeException: Error occurred. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
java.lang.RuntimeException: Error parsing XPath
'/sqlMapConfig/transactionManager/dataSource/end()'. Cause:
com.ibatis.sqlmap.client.SqlMapException: Error initializing DataSource.
Could not instantiate DataSourceFactory. Cause:
java.lang.RuntimeException: SimpleDataSource: Error while loading
properties. Cause: java.lang.RuntimeException: SimpleDataSource: Some
properties were not set.

my db.properties

driver=oracle.jdbc.driver.OracleDriver
jdbc.url.alpha=jdbc:oracle:thin:@//mcfl1uaq:1535/MCDBI03
username.alpha=user
password.alpha=password

my sqlmapconfig.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config
2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
    <properties resource="db.properties"/>
    <settings cacheModelsEnabled="true" enhancementEnabled="true"
lazyLoadingEnabled="true" maxRequests="1024" maxSessions="128"
maxTransactions="32" useStatementNamespaces="false"/>
    <transactionManager type="JDBC">
        <dataSource type="SIMPLE">
            <property name="JDBC.Driver" value="${driver}"/>
            <property name="JDBC.ConnectionURL"
value="${jdbc.url.alpha}"/>
            <property name="JDBC.Username" value="${username.alpha}"/>
            <property name="JDBC.Password" value="${password.alpha}"/>
        </dataSource>
    </transactionManager>
    <sqlMap resource="xml/uv_sqlmap.xml"/>
</sqlMapConfig>

Am getting error in 

String resource = "sqlmapconfig.xml";
Reader reader = Resources.getResourceAsReader(resource);
alphaSqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);  // <--
error on this statement

Appreciate any help! Thanks
Tony