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 suprememenu <sh...@gmail.com> on 2010/01/28 10:54:53 UTC

how to concate a string in insert statement using ibatis?

hi all,
   i would like to know how can i contact a string in insert statemnet using
ibatis?

insert into knet 
      (TRACK_ID, 
       STORE_ID,
       order_id
       DATE
       ) 
       values(
     	 #trackId#,
		#storeId#,
	       'abc'+#orderId#,
		SYSDATE)


i mean for the column orderId i need to add a static string . when i tried
the above i am getting error ...
-- 
View this message in context: http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibatis--tp27353435p27353435.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


RE: how to concate a string in insert statement using ibatis?

Posted by suprememenu <sh...@gmail.com>.
Hi,
      I solved the issue from java side .
thanks.



suprememenu wrote:
> 
> hi ,
>   i mean its inserting the database but with value as abc?orderId it
> should insert into db as abc123 (where 123 is the orderId)
> 
> 
> 
> suprememenu wrote:
>> 
>> hi ,
>>     when i try 'abc?orderId?'  this its inserting the data like
>> 'abc?orderId?' directlly in the database.
>>     
>> 
>> 
>> 
>> meindert-3 wrote:
>>> 
>>> Best option is to do it on the java side, otherwise you can use
>>> 'abc?orderId?' what will insert (sql inject!) the literal value of
>>> orderId
>>> in your query
>>> -----Original Message-----
>>> From: suprememenu [mailto:shaikhid@gmail.com] 
>>> Sent: 28 January 2010 11:55 AM
>>> To: user-java@ibatis.apache.org
>>> Subject: how to concate a string in insert statement using ibatis?
>>> 
>>> 
>>> hi all,
>>>    i would like to know how can i contact a string in insert statemnet
>>> using
>>> ibatis?
>>> 
>>> insert into knet 
>>>       (TRACK_ID, 
>>>        STORE_ID,
>>>        order_id
>>>        DATE
>>>        ) 
>>>        values(
>>>      	 #trackId#,
>>> 		#storeId#,
>>> 	       'abc'+#orderId#,
>>> 		SYSDATE)
>>> 
>>> 
>>> i mean for the column orderId i need to add a static string . when i
>>> tried
>>> the above i am getting error ...
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibat
>>> is--tp27353435p27353435.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> 
>>> 
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com 
>>> Version: 9.0.733 / Virus Database: 271.1.1/2650 - Release Date: 01/27/10
>>> 21:36:00
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibatis--tp27353435p27354145.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


RE: how to concate a string in insert statement using ibatis?

Posted by suprememenu <sh...@gmail.com>.
hi ,
  i mean its inserting the database but with value as abc?orderId it should
insert into db as abc123 (where 123 is the orderId)



suprememenu wrote:
> 
> hi ,
>     when i try 'abc?orderId?'  this its inserting the data like
> 'abc?orderId?' directlly in the database.
>     
> 
> 
> 
> meindert-3 wrote:
>> 
>> Best option is to do it on the java side, otherwise you can use
>> 'abc?orderId?' what will insert (sql inject!) the literal value of
>> orderId
>> in your query
>> -----Original Message-----
>> From: suprememenu [mailto:shaikhid@gmail.com] 
>> Sent: 28 January 2010 11:55 AM
>> To: user-java@ibatis.apache.org
>> Subject: how to concate a string in insert statement using ibatis?
>> 
>> 
>> hi all,
>>    i would like to know how can i contact a string in insert statemnet
>> using
>> ibatis?
>> 
>> insert into knet 
>>       (TRACK_ID, 
>>        STORE_ID,
>>        order_id
>>        DATE
>>        ) 
>>        values(
>>      	 #trackId#,
>> 		#storeId#,
>> 	       'abc'+#orderId#,
>> 		SYSDATE)
>> 
>> 
>> i mean for the column orderId i need to add a static string . when i
>> tried
>> the above i am getting error ...
>> -- 
>> View this message in context:
>> http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibat
>> is--tp27353435p27353435.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> 
>> 
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com 
>> Version: 9.0.733 / Virus Database: 271.1.1/2650 - Release Date: 01/27/10
>> 21:36:00
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibatis--tp27353435p27353835.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


RE: how to concate a string in insert statement using ibatis?

Posted by suprememenu <sh...@gmail.com>.
hi ,
    when i try 'abc?orderId?'  this its inserting the data like
'abc?orderId?' directlly in the database.
    



meindert-3 wrote:
> 
> Best option is to do it on the java side, otherwise you can use
> 'abc?orderId?' what will insert (sql inject!) the literal value of orderId
> in your query
> -----Original Message-----
> From: suprememenu [mailto:shaikhid@gmail.com] 
> Sent: 28 January 2010 11:55 AM
> To: user-java@ibatis.apache.org
> Subject: how to concate a string in insert statement using ibatis?
> 
> 
> hi all,
>    i would like to know how can i contact a string in insert statemnet
> using
> ibatis?
> 
> insert into knet 
>       (TRACK_ID, 
>        STORE_ID,
>        order_id
>        DATE
>        ) 
>        values(
>      	 #trackId#,
> 		#storeId#,
> 	       'abc'+#orderId#,
> 		SYSDATE)
> 
> 
> i mean for the column orderId i need to add a static string . when i tried
> the above i am getting error ...
> -- 
> View this message in context:
> http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibat
> is--tp27353435p27353435.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 9.0.733 / Virus Database: 271.1.1/2650 - Release Date: 01/27/10
> 21:36:00
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibatis--tp27353435p27353818.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: CommitRequired attribute of transactionManager in iBatis 3

Posted by "Eduardo M. Cavalcanti" <ec...@eversystems.com.br>.
Hello Clinton,
No repair.
I just wanted some clarification on this matter.
Thank you.


On 28/01/2010 17:22, Clinton Begin wrote:
> In iBATIS 3, you can use .commit(boolean force)
>
> The advantage is that you need not incur the performance penalty for 
> every transaction, and also, it allows frameworks like spring to 
> declaratively configure transactions to be forcefully committed.
>
> Your thoughts?
>
> Clinton
>
> On Thu, Jan 28, 2010 at 1:42 PM, Eduardo M. Cavalcanti 
> <ecavalcanti@eversystems.com.br 
> <ma...@eversystems.com.br>> wrote:
>
>     Hello,
>     The CommitRequired attribute of transactionManager, present in
>     iBatis 2 is no longer necessary in iBatis 3?
>
>     Quote from iBatis 2 manual:
>
>     "The <transactionManager> element also allows an optional
>     attribute commitRequired that can be true or
>     false. Normally iBATIS will not commit transactions unless an
>     insert, update, or delete operation has been
>     performed. This is true even if you explicitly call the
>     commitTransaction() method. This behavior
>     creates problems in some cases. If you want iBATIS to always
>     commit transactions, even if no insert,
>     update, or delete operation has been performed, then set the value
>     of the commitRequired attribute to true.
>     Examples of where this attribute is useful include:
>
>     1. If you call a stored procedures that updates data as well as
>     returning rows. In that case you would
>     call the procedure with the queryForList() operation – so iBATIS
>     would not normally commit the
>     transaction. But then the updates would be rolled back.
>     2. In a WebSphere environment when you are using connection
>     pooling and you use the JNDI
>     <dataSource> and the JDBC or JTA transaction manager. WebSphere
>     requires all transactions on
>     pooled connections to be committed or the connection will not be
>     returned to the pool."
>
>
>     How to proceed in iBatis 3 in the example cases mentioned?
>
>     Thank you.
>
>
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>     <ma...@ibatis.apache.org>
>     For additional commands, e-mail: user-java-help@ibatis.apache.org
>     <ma...@ibatis.apache.org>
>
>


Re: CommitRequired attribute of transactionManager in iBatis 3

Posted by Clinton Begin <cl...@gmail.com>.
In iBATIS 3, you can use .commit(boolean force)

The advantage is that you need not incur the performance penalty for every
transaction, and also, it allows frameworks like spring to declaratively
configure transactions to be forcefully committed.

Your thoughts?

Clinton

On Thu, Jan 28, 2010 at 1:42 PM, Eduardo M. Cavalcanti <
ecavalcanti@eversystems.com.br> wrote:

> Hello,
> The CommitRequired attribute of transactionManager, present in iBatis 2 is
> no longer necessary in iBatis 3?
>
> Quote from iBatis 2 manual:
>
> "The <transactionManager> element also allows an optional attribute
> commitRequired that can be true or
> false. Normally iBATIS will not commit transactions unless an insert,
> update, or delete operation has been
> performed. This is true even if you explicitly call the commitTransaction()
> method. This behavior
> creates problems in some cases. If you want iBATIS to always commit
> transactions, even if no insert,
> update, or delete operation has been performed, then set the value of the
> commitRequired attribute to true.
> Examples of where this attribute is useful include:
>
> 1. If you call a stored procedures that updates data as well as returning
> rows. In that case you would
> call the procedure with the queryForList() operation – so iBATIS would not
> normally commit the
> transaction. But then the updates would be rolled back.
> 2. In a WebSphere environment when you are using connection pooling and you
> use the JNDI
> <dataSource> and the JDBC or JTA transaction manager. WebSphere requires
> all transactions on
> pooled connections to be committed or the connection will not be returned
> to the pool."
>
>
> How to proceed in iBatis 3 in the example cases mentioned?
>
> Thank you.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

CommitRequired attribute of transactionManager in iBatis 3

Posted by "Eduardo M. Cavalcanti" <ec...@eversystems.com.br>.
Hello,
The CommitRequired attribute of transactionManager, present in iBatis 2 
is no longer necessary in iBatis 3?

Quote from iBatis 2 manual:

"The <transactionManager> element also allows an optional attribute 
commitRequired that can be true or
false. Normally iBATIS will not commit transactions unless an insert, 
update, or delete operation has been
performed. This is true even if you explicitly call the 
commitTransaction() method. This behavior
creates problems in some cases. If you want iBATIS to always commit 
transactions, even if no insert,
update, or delete operation has been performed, then set the value of 
the commitRequired attribute to true.
Examples of where this attribute is useful include:

1. If you call a stored procedures that updates data as well as 
returning rows. In that case you would
call the procedure with the queryForList() operation – so iBATIS would 
not normally commit the
transaction. But then the updates would be rolled back.
2. In a WebSphere environment when you are using connection pooling and 
you use the JNDI
<dataSource> and the JDBC or JTA transaction manager. WebSphere requires 
all transactions on
pooled connections to be committed or the connection will not be 
returned to the pool."


How to proceed in iBatis 3 in the example cases mentioned?

Thank you.




---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


RE: how to concate a string in insert statement using ibatis?

Posted by meindert <me...@eduflex.com>.
Best option is to do it on the java side, otherwise you can use
'abc?orderId?' what will insert (sql inject!) the literal value of orderId
in your query
-----Original Message-----
From: suprememenu [mailto:shaikhid@gmail.com] 
Sent: 28 January 2010 11:55 AM
To: user-java@ibatis.apache.org
Subject: how to concate a string in insert statement using ibatis?


hi all,
   i would like to know how can i contact a string in insert statemnet using
ibatis?

insert into knet 
      (TRACK_ID, 
       STORE_ID,
       order_id
       DATE
       ) 
       values(
     	 #trackId#,
		#storeId#,
	       'abc'+#orderId#,
		SYSDATE)


i mean for the column orderId i need to add a static string . when i tried
the above i am getting error ...
-- 
View this message in context:
http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibat
is--tp27353435p27353435.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.733 / Virus Database: 271.1.1/2650 - Release Date: 01/27/10
21:36:00


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: how to concate a string in insert statement using ibatis?

Posted by Jason King <jh...@airmail.net>.
In Oracle || is the string concatenation operator

'abc'||#orderId# should work.
suprememenu wrote:
>
> suprememenu wrote:
>   
>> hi all,
>>    i would like to know how can i contact a string in insert statemnet
>> using ibatis?
>>
>> insert into knet 
>>       (TRACK_ID, 
>>        STORE_ID,
>>        order_id
>>        DATE
>>        ) 
>>        values(
>>      	 #trackId#,
>> 		#storeId#,
>> 	       'abc'+#orderId#,
>> 		SYSDATE)
>>
>>
>> i mean for the column orderId i need to add a static string . when i tried
>> the above i am getting error ... Cause: java.sql.SQLException: ORA-01722:
>> invalid number
>>
>>     
>
>   


Re: how to concate a string in insert statement using ibatis?

Posted by suprememenu <sh...@gmail.com>.


suprememenu wrote:
> 
> hi all,
>    i would like to know how can i contact a string in insert statemnet
> using ibatis?
> 
> insert into knet 
>       (TRACK_ID, 
>        STORE_ID,
>        order_id
>        DATE
>        ) 
>        values(
>      	 #trackId#,
> 		#storeId#,
> 	       'abc'+#orderId#,
> 		SYSDATE)
> 
> 
> i mean for the column orderId i need to add a static string . when i tried
> the above i am getting error ... Cause: java.sql.SQLException: ORA-01722:
> invalid number
> 

-- 
View this message in context: http://old.nabble.com/how-to-concate-a-string-in-insert-statement-using-ibatis--tp27353435p27353477.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org