Ben Shory | 1 May 08:22 2009

RE: gracefuly exit from row handler

sotred proc is not an option. actually i'm porting a db2 stored proc batch app to java - spring batch - ibatis.
ok, let's say i'm processing milions of rows and counting errors.. if i reach 1k errors i want to quit.
i can use paging instead of row handler but a. it has a performance impact and b. i need to change the sql statements and also make them vendor specific.
 

From: Sundar Sankar [mailto:fatboysuns <at> gmail.com]
Sent: Thursday, April 30, 2009 7:11 PM
To: user-java <at> ibatis.apache.org
Subject: Re: gracefuly exit from row handler

I would have used a stored proc or something to do that in the DB itself. Personally I dont wanna transfer a million records over the network and then do some logic to fetch one out of it.

I dont know what your situation is, may be if you explain more, there might be a more elegant way, some of the users might have for u!

-Sundar

On Thu, Apr 30, 2009 at 8:57 AM, Ben Shory <ben.s <at> sapiens.com> wrote:
not really.. i need to choose one row out of milions using logic involving other data sources.

From: Clinton Begin [mailto:clinton.begin <at> gmail.com]
Sent: Thursday, April 30, 2009 3:58 PM
To: user-java <at> ibatis.apache.org
Subject: Re: gracefuly exit from row handler

Not really... but why are you asking for data you don't need?  Is there any way to just select out exactly what you need?

On Thu, Apr 30, 2009 at 2:20 AM, Ben Shory <ben.s <at> sapiens.com> wrote:
Hi,
any way of breaking from row handler if I don't need to traverse the results anymore?
if I throw runtime exception will it handle the resources correctly?
 
  --ben


maciego | 1 May 13:13 2009
Picon

iBator + sqlMapConfig.xml


Hi, 
I am preparing to use iBatis in my application (for my studies). I generated
model, dao and mapping via iBator and configured SqlMapConfig.xml. 
I see all 'impl' classes extends SqlMapDaoTemplate class. 
What I should do next? How make a connection - should I have another base
class?

Thanks for any reply

Regards
maciego
--

-- 
View this message in context: http://www.nabble.com/iBator-%2B-sqlMapConfig.xml-tp23331608p23331608.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

Kai Grabfelder | 1 May 13:34 2009
Picon

Re: iBator + sqlMapConfig.xml

Hi Maciego,

have you read the documentation at
http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-2/ibatis-2-docs/en/ ?

Best Regards

Kai Grabfelder

--- Original Nachricht ---
Absender: maciego
Datum: 01.05.2009 13:13
> Hi, 
> I am preparing to use iBatis in my application (for my studies). I generated
> model, dao and mapping via iBator and configured SqlMapConfig.xml. 
> I see all 'impl' classes extends SqlMapDaoTemplate class. 
> What I should do next? How make a connection - should I have another base
> class?
> 
> Thanks for any reply
> 
> Regards
> maciego

Jose Lora | 1 May 13:55 2009

RE: gracefuly exit from row handler

Is there any way you can move the error checking logic to the database instead of running it on the java server? If you need data from other systems to perform the error checking process, it may be better for you to temporarily move that data to DB2. To move the data across you could use database specific exporters and loaders to make the process more efficient. If you can do that, then it may be possible for you to code your error checking logic in SQL.

 

Just an idea.

 

Tonio

 

From: Ben Shory [mailto:ben.s <at> sapiens.com]
Sent: Friday, May 01, 2009 2:22 AM
To: user-java <at> ibatis.apache.org
Subject: RE: gracefuly exit from row handler

 

sotred proc is not an option. actually i'm porting a db2 stored proc batch app to java - spring batch - ibatis.

ok, let's say i'm processing milions of rows and counting errors.. if i reach 1k errors i want to quit.

i can use paging instead of row handler but a. it has a performance impact and b. i need to change the sql statements and also make them vendor specific.

 

 

From: Sundar Sankar [mailto:fatboysuns <at> gmail.com]
Sent: Thursday, April 30, 2009 7:11 PM
To: user-java <at> ibatis.apache.org
Subject: Re: gracefuly exit from row handler

I would have used a stored proc or something to do that in the DB itself. Personally I dont wanna transfer a million records over the network and then do some logic to fetch one out of it.

I dont know what your situation is, may be if you explain more, there might be a more elegant way, some of the users might have for u!

-Sundar

On Thu, Apr 30, 2009 at 8:57 AM, Ben Shory <ben.s <at> sapiens.com> wrote:

not really.. i need to choose one row out of milions using logic involving other data sources.

 

From: Clinton Begin [mailto:clinton.begin <at> gmail.com]
Sent: Thursday, April 30, 2009 3:58 PM
To: user-java <at> ibatis.apache.org
Subject: Re: gracefuly exit from row handler

Not really... but why are you asking for data you don't need?  Is there any way to just select out exactly what you need?

On Thu, Apr 30, 2009 at 2:20 AM, Ben Shory <ben.s <at> sapiens.com> wrote:

Hi,

any way of breaking from row handler if I don't need to traverse the results anymore?

if I throw runtime exception will it handle the resources correctly?

 

  --ben

 

 

maciego | 1 May 15:20 2009
Picon

Re: iBator + sqlMapConfig.xml


Thanks...

Regards
Maciego
--

-- 
View this message in context: http://www.nabble.com/iBator-%2B-sqlMapConfig.xml-tp23331608p23333001.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

Bhaarat Sharma | 1 May 20:09 2009
Picon

how to have two datasources in sql-map-config.xml

Hi


Currently our sql-map-config looks like this:

<sqlMapConfig>
   <settings enhancementEnabled="true" useStatementNamespaces="true" />
<transactionManager type="JDBC">
<dataSource type="JNDI">
<property name="DataSource" value="jdbc/RSGH/IJA/twy/ftwdb" />
</dataSource>
</transactionManager>
<sqlMap resource="existingSearch.xml" />
        <sqlMap resource="deceased_search.xml"/>
        <sqlMap resource="multiLoanSearch.xml"/>
</sqlMapConfig>

In the above we only have one JDBC connection and this connection goes to a SQL Server.  However, now we will have to access another DB which is in Oracle.  So we will have to create another JDBC connection and have some of our sqlMaps reference that NEW JDBC connection.  Can this be done in iBatis? can we have multiple data sources, and if so, then how do we differentiate which DB a sqlMap references. 

Thanks!
Brandon Goodin | 1 May 20:21 2009
Picon

Re: how to have two datasources in sql-map-config.xml

Why not create a separate SqlMapClient for the Oracle database?

Brandon Goodin


On Fri, May 1, 2009 at 1:09 PM, Bhaarat Sharma <bhaarat.s <at> gmail.com> wrote:
Hi

Currently our sql-map-config looks like this:

<sqlMapConfig>
   <settings enhancementEnabled="true" useStatementNamespaces="true" />
<transactionManager type="JDBC">
<dataSource type="JNDI">
<property name="DataSource" value="jdbc/RSGH/IJA/twy/ftwdb" />
</dataSource>
</transactionManager>
<sqlMap resource="existingSearch.xml" />
        <sqlMap resource="deceased_search.xml"/>
        <sqlMap resource="multiLoanSearch.xml"/>
</sqlMapConfig>

In the above we only have one JDBC connection and this connection goes to a SQL Server.  However, now we will have to access another DB which is in Oracle.  So we will have to create another JDBC connection and have some of our sqlMaps reference that NEW JDBC connection.  Can this be done in iBatis? can we have multiple data sources, and if so, then how do we differentiate which DB a sqlMap references. 

Thanks!

Bhaarat Sharma | 1 May 20:24 2009
Picon

Re: how to have two datasources in sql-map-config.xml

also, we have a spring-for-ibatis.xml file where we have code like this


<bean id="IbatisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jdbc/RSGH/IJA/twy/ftwdb"/>
</bean>

<bean id="BTHSqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  <property name="configLocation" value="classpath:sql-map-config.xml"/>
  <property name="dataSource" ref="IbatisDataSource"/>
 </bean>

 <bean id="UsageIfaceDAO" class="biv.data.dao.reports.auditreports.UsageReportDAO">
    <property name="sqlMapClient" ref="BTHSqlMapClient"/>
    <property name="dataSource" ref="IbatisDataSource"/>
 </bean>

so can I then just add another bean with jndi like this: 
<bean id="IbatisDataSource2" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jdbc/RSGH/IJA/twy/<mynewDBNAME>"/>
</bean>

then another bean for sql-map-client (I will have to make another xml right? say sql-map-client1.xml)
<bean id="BTHSqlMapClient1" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
  <property name="configLocation" value="classpath:sql-map-config1.xml"/>
  <property name="dataSource" ref="IbatisDataSource"/>
 </bean>

and then start registering my DAO's like this
 <bean id="SomeNewDAO" class="biv.data.dao.reports.auditreports.SomeReportDAO">
    <property name="sqlMapClient" ref="BTHSqlMapClient1"/>
    <property name="dataSource" ref="IbatisDataSource"/>
 </bean>

Thanks
-bhaarat
On Fri, May 1, 2009 at 2:09 PM, Bhaarat Sharma <bhaarat.s <at> gmail.com> wrote:
Hi

Currently our sql-map-config looks like this:

<sqlMapConfig>
   <settings enhancementEnabled="true" useStatementNamespaces="true" />
<transactionManager type="JDBC">
<dataSource type="JNDI">
<property name="DataSource" value="jdbc/RSGH/IJA/twy/ftwdb" />
</dataSource>
</transactionManager>
<sqlMap resource="existingSearch.xml" />
        <sqlMap resource="deceased_search.xml"/>
        <sqlMap resource="multiLoanSearch.xml"/>
</sqlMapConfig>

In the above we only have one JDBC connection and this connection goes to a SQL Server.  However, now we will have to access another DB which is in Oracle.  So we will have to create another JDBC connection and have some of our sqlMaps reference that NEW JDBC connection.  Can this be done in iBatis? can we have multiple data sources, and if so, then how do we differentiate which DB a sqlMap references. 

Thanks!

Bhaarat Sharma | 1 May 20:25 2009
Picon

Re: how to have two datasources in sql-map-config.xml

Brandon, 


I think your reply came as I was tying up my reply.  Please check out my second reply to see if that makes sense.  

Thanks

On Fri, May 1, 2009 at 2:21 PM, Brandon Goodin <brandon.goodin <at> gmail.com> wrote:
Why not create a separate SqlMapClient for the Oracle database?

Brandon Goodin



On Fri, May 1, 2009 at 1:09 PM, Bhaarat Sharma <bhaarat.s <at> gmail.com> wrote:
Hi

Currently our sql-map-config looks like this:

<sqlMapConfig>
   <settings enhancementEnabled="true" useStatementNamespaces="true" />
<transactionManager type="JDBC">
<dataSource type="JNDI">
<property name="DataSource" value="jdbc/RSGH/IJA/twy/ftwdb" />
</dataSource>
</transactionManager>
<sqlMap resource="existingSearch.xml" />
        <sqlMap resource="deceased_search.xml"/>
        <sqlMap resource="multiLoanSearch.xml"/>
</sqlMapConfig>

In the above we only have one JDBC connection and this connection goes to a SQL Server.  However, now we will have to access another DB which is in Oracle.  So we will have to create another JDBC connection and have some of our sqlMaps reference that NEW JDBC connection.  Can this be done in iBatis? can we have multiple data sources, and if so, then how do we differentiate which DB a sqlMap references. 

Thanks!


Srinivas Doddi | 1 May 20:48 2009

RE: how to have two datasources in sql-map-config.xml

We were using two separate Sql Map Configuration files for this kind of scenario.  In IBATIS, I guess there is no way of specifying two different Sql maps clients in a single configuration file.  ( Correct me, if I am wrong)

 

Thank you.

 

SRINIVAS DODDI

From: Bhaarat Sharma [mailto:bhaarat.s <at> gmail.com]
Sent: Friday, May 01, 2009 2:24 PM
To: user-java <at> ibatis.apache.org
Subject: Re: how to have two datasources in sql-map-config.xml

 

also, we have a spring-for-ibatis.xml file where we have code like this

 

<bean id="IbatisDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">

    <property name="jndiName" value="jdbc/RSGH/IJA/twy/ftwdb"/>

</bean>

 

<bean id="BTHSqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">

  <property name="configLocation" value="classpath:sql-map-config.xml"/>

  <property name="dataSource" ref="IbatisDataSource"/>

 </bean>

 

 <bean id="UsageIfaceDAO" class="biv.data.dao.reports.auditreports.UsageReportDAO">

    <property name="sqlMapClient" ref="BTHSqlMapClient"/>

    <property name="dataSource" ref="IbatisDataSource"/>

 </bean>

 

so can I then just add another bean with jndi like this: 

<bean id="IbatisDataSource2" class="org.springframework.jndi.JndiObjectFactoryBean">

    <property name="jndiName" value="jdbc/RSGH/IJA/twy/<mynewDBNAME>"/>

</bean>

 

then another bean for sql-map-client (I will have to make another xml right? say sql-map-client1.xml)

<bean id="BTHSqlMapClient1" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">

  <property name="configLocation" value="classpath:sql-map-config1.xml"/>

  <property name="dataSource" ref="IbatisDataSource"/>

 </bean>

 

and then start registering my DAO's like this

 <bean id="SomeNewDAO" class="biv.data.dao.reports.auditreports.SomeReportDAO">

    <property name="sqlMapClient" ref="BTHSqlMapClient1"/>

    <property name="dataSource" ref="IbatisDataSource"/>

 </bean>

 

Thanks

-bhaarat

On Fri, May 1, 2009 at 2:09 PM, Bhaarat Sharma <bhaarat.s <at> gmail.com> wrote:

Hi

 

Currently our sql-map-config looks like this:

 

<sqlMapConfig>

   <settings enhancementEnabled="true" useStatementNamespaces="true" />

            <transactionManager type="JDBC">

                        <dataSource type="JNDI">

                                    <property name="DataSource" value="jdbc/RSGH/IJA/twy/ftwdb" />

                        </dataSource>

            </transactionManager>

           

            <sqlMap resource="existingSearch.xml" />

        <sqlMap resource="deceased_search.xml"/>

        <sqlMap resource="multiLoanSearch.xml"/>

</sqlMapConfig>

 

In the above we only have one JDBC connection and this connection goes to a SQL Server.  However, now we will have to access another DB which is in Oracle.  So we will have to create another JDBC connection and have some of our sqlMaps reference that NEW JDBC connection.  Can this be done in iBatis? can we have multiple data sources, and if so, then how do we differentiate which DB a sqlMap references. 

 

Thanks!

 


Gmane