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 Bing Qiao <qi...@gmail.com> on 2005/06/23 14:49:02 UTC
Re: Get return value of stored procedure
Help please!
I have had several talks with our DBA who is so skeptical of iBATIS
and vow to force us to go back to jdbc. One of his arguments is that
the return code from stored procedure can not be retrieved by sqlmap.
I tried all I could but no luck till now. Any help please!
Thanks a lot!
On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> Hi,
>
> What do I need to add to the sqlmap to get the return value (for
> example, return -9) of stored procedure?
>
>
> Thanks very much!
>
> bqiao
>
Re: lock
Posted by Larry Meadors <la...@gmail.com>.
OK, fair enough:
I KNOW it is not supported.
I KNOW I have done it in the past, but depending on your database
(which I DO NOT KNOW) it may or may not work.
If it doesn't that is a bummer, because I KNOW it is not supported.
Larry
On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> Please don't answer the question that you don't know because it will
> wast both side time.
>
> -Henry
>
> Larry Meadors wrote:
>
> >DDL is not supported, but may work as an update.
> >
> >Larry
> >
> >
> >On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >>treat as ddl.
> >>
> >>-Henry
> >>
> >>Larry Meadors wrote:
> >>
> >>
> >>
> >>>How would you do it with JDBC?
> >>>
> >>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>How do i set sqlmap for the following SQL statement:
> >>>>
> >>>>lock table x in shared mode
> >>>>
> >>>>?
> >>>>
> >>>>-Henry
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
Re: lock
Posted by Brice Ruth <bd...@gmail.com>.
Hi Henry,
Experts in iBATIS do read and answer questions on this board. The original
creator of iBATIS frequents the list daily, in my experience.
However, that doesn't change the fact that this is an open source project.
You are expected to try things out and report back with errors.
You are also expected to read the exhaustive documentation that is created
for the project. As is the case in most instances, if your situation is not
covered in the documentation, it is fair to assume that it is not supported.
I assume you've ready all the 2.0 documentation, and have exhaustively
inspected the Wiki that the staff and contributors for this project
maintain?
This is by far one of the most well documented open source projects I have
come across. Take a look at the Castor documentation for a fresh look.
You'll come back thoroughly impressed, I assure you. (No offense to the
Castor guys)
Brice
On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>
> Mr. Ruth, thank you very much for your info for me to understanding this
> group. I thought there is a group of expertise watching the emails and
> helping people to use the iBATIS. So there are no iBATIS board members
> in the group. Everyone is trying and error to figure out how to use
> iBATIS. If it works, fine, if it doesn't, trying another way. You never
> know what the best/right way to do it. One suggestion I'd like to make
> to the board of iBATIS if I could is to write a better documentation so
> it will save users times.
>
> Thanks you again for you help.
>
> -Henry
>
>
>
> Brice Ruth wrote:
>
> >Hi Henry,
> >
> >Please stay civil on this list. Throwing veiled insults at regular
> >contributors on this list is not cool.
> >
> >This is not paid technical support that you're talking to. If that's
> >how you treat them, that's fine. We're all volunteers & users of
> >iBATIS, as such, we subscribe to the notion of trying things out,
> >seeing if they work. Sometimes, we're pleasantly surprised.
> >
> >In your particular case, since you haven't posted any errors from
> >iBATIS, it appears that you haven't tried anything out. As such, the
> >best we can do is suggest that you do try. If you have particular
> >problems, as a group, we can try to help straighten them out, or
> >suggest addl. features for future releases.
> >
> >Nobody is going to try things out for you, though - that's your
> >responsibility, as it should be.
> >
> >Best,
> >Brice
> >
> >
> >On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >>Please don't answer the question that you don't know because it will
> >>wast both side time.
> >>
> >>-Henry
> >>
> >>Larry Meadors wrote:
> >>
> >>
> >>
> >>>DDL is not supported, but may work as an update.
> >>>
> >>>Larry
> >>>
> >>>
> >>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>treat as ddl.
> >>>>
> >>>>-Henry
> >>>>
> >>>>Larry Meadors wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>How would you do it with JDBC?
> >>>>>
> >>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>How do i set sqlmap for the following SQL statement:
> >>>>>>
> >>>>>>lock table x in shared mode
> >>>>>>
> >>>>>>?
> >>>>>>
> >>>>>>-Henry
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
--
Brice Ruth
Software Engineer, Madison WI
Re: lock
Posted by Larry Meadors <la...@gmail.com>.
OK, this will be my last comment on this thread. Trolls irritate me.
On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> Mr. Ruth, thank you very much for your info for me to understanding this
> group. I thought there is a group of expertise watching the emails and
> helping people to use the iBATIS. So there are no iBATIS board members
Actually, every commiter on the project is on this list.
Unfortunately, we all have regular day jobs, and are unable to drop
everything to provide you with free support when you feel that you do
not have the time to try things yourself.
Those same pesky jobs also prevent us from trying every conceivable
use of the tool with every conceivable driver in every conceivable
environment.
> in the group. Everyone is trying and error to figure out how to use
> iBATIS. If it works, fine, if it doesn't, trying another way. You never
> know what the best/right way to do it. One suggestion I'd like to make
> to the board of iBATIS if I could is to write a better documentation so
> it will save users times.
You are more than welcome to contribute to the documentation in *your*
spare time.
:-D
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Home
Larry
Re: lock
Posted by Henry Lu <zh...@umich.edu>.
Mr. Skavish,,
1. I didn't ask you to reply. You don't need answer if you don't wnat to.
2. I asked Mr. Grabowski's experience
3. I didn't ask anyone to try for me
4. Is this group for sharing experience too?
-Henry
Dmitry Skavish wrote:
>excuse me, but it takes no more than 30 seconds to test it yourself.
>
>On 6/24/05, Henry Lu <zh...@umich.edu> wrote:
>
>
>>It worked. Thanks for your help. Based upon your experience, do you know
>>if this works for "create table" and "Create view"?
>>
>>-Henry
>>
>>Ron Grabowski wrote:
>>
>>
>>
>>>The code I posted was just an example. I'm more familiar with the .Net
>>>version of iBATIS. I've attached a more complete example below.
>>>
>>>I have not tested the code so if you copy and paste it into your
>>>application it will most likley not work. Make sure you replace
>>>"sqlMapconfig.xml" with the proper path to your config file:
>>>
>>>// untested - for example purposes only
>>>Reader reader = new Resources.getResourceAsReader("sqlMapconfig.xml");
>>>SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMap(reader);
>>>sqlMap.update("lockTable", null);
>>>
>>>Another way to go about solving this issue is to create a generic
>>>statement that executes sql statements:
>>>
>>><statement id="executeRawSql">
>>> $sql$
>>></statement>
>>>
>>>That could be called like this:
>>>
>>>// untested - for example purposes only
>>>sqlMap.update("executeRawSql", "lock table x in shared mode");
>>>
>>>The sqlMap object in my last example is of type SqlMapClient and can be
>>>found in the com.ibatis.sqlmap.client package.
>>>
>>>- Ron
>>>
>>>--- Henry Lu <zh...@umich.edu> wrote:
>>>
>>>
>>>
>>>
>>>
>>>>What is the class of
>>>>
>>>>sqlMapper
>>>>
>>>>?
>>>>
>>>>-Henry
>>>>
>>>>
>>>>
>>>>Ron Grabowski wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Have you tried Larry's suggestion?
>>>>>
>>>>>sqlMapper.executeUpdate("lockTable");
>>>>>
>>>>><statement id="lockTable">
>>>>>lock table x in shared mode
>>>>></statement>
>>>>>
>>>>>--- Henry Lu <zh...@umich.edu> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Mr. Ruth, thank you very much for your info for me to understanding
>>>>>>this
>>>>>>group. I thought there is a group of expertise watching the emails
>>>>>>and
>>>>>>helping people to use the iBATIS. So there are no iBATIS board
>>>>>>members
>>>>>>in the group. Everyone is trying and error to figure out how to use
>>>>>>
>>>>>>
>>>>>>iBATIS. If it works, fine, if it doesn't, trying another way. You
>>>>>>never
>>>>>>know what the best/right way to do it. One suggestion I'd like to
>>>>>>make
>>>>>>to the board of iBATIS if I could is to write a better
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>documentation
>>>>
>>>>
>>>>
>>>>
>>>>>>so
>>>>>>it will save users times.
>>>>>>
>>>>>>Thanks you again for you help.
>>>>>>
>>>>>>-Henry
>>>>>>
>>>>>>
>>>>>>
>>>>>>Brice Ruth wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi Henry,
>>>>>>>
>>>>>>>Please stay civil on this list. Throwing veiled insults at regular
>>>>>>>contributors on this list is not cool.
>>>>>>>
>>>>>>>This is not paid technical support that you're talking to. If
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>that's
>>>>
>>>>
>>>>
>>>>
>>>>>>>how you treat them, that's fine. We're all volunteers & users of
>>>>>>>iBATIS, as such, we subscribe to the notion of trying things out,
>>>>>>>seeing if they work. Sometimes, we're pleasantly surprised.
>>>>>>>
>>>>>>>In your particular case, since you haven't posted any errors from
>>>>>>>iBATIS, it appears that you haven't tried anything out. As such,
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>the
>>>>
>>>>
>>>>
>>>>
>>>>>>>best we can do is suggest that you do try. If you have particular
>>>>>>>problems, as a group, we can try to help straighten them out, or
>>>>>>>suggest addl. features for future releases.
>>>>>>>
>>>>>>>Nobody is going to try things out for you, though - that's your
>>>>>>>responsibility, as it should be.
>>>>>>>
>>>>>>>Best,
>>>>>>>Brice
>>>>>>>
>>>>>>>
>>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Please don't answer the question that you don't know because it
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>will
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>wast both side time.
>>>>>>>>
>>>>>>>>-Henry
>>>>>>>>
>>>>>>>>Larry Meadors wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>DDL is not supported, but may work as an update.
>>>>>>>>>
>>>>>>>>>Larry
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>treat as ddl.
>>>>>>>>>>
>>>>>>>>>>-Henry
>>>>>>>>>>
>>>>>>>>>>Larry Meadors wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>How would you do it with JDBC?
>>>>>>>>>>>
>>>>>>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>How do i set sqlmap for the following SQL statement:
>>>>>>>>>>>>
>>>>>>>>>>>>lock table x in shared mode
>>>>>>>>>>>>
>>>>>>>>>>>>?
>>>>>>>>>>>>
>>>>>>>>>>>>-Henry
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>
>
>
>
>
Re: lock
Posted by Dmitry Skavish <sk...@gmail.com>.
excuse me, but it takes no more than 30 seconds to test it yourself.
On 6/24/05, Henry Lu <zh...@umich.edu> wrote:
> It worked. Thanks for your help. Based upon your experience, do you know
> if this works for "create table" and "Create view"?
>
> -Henry
>
> Ron Grabowski wrote:
>
> >The code I posted was just an example. I'm more familiar with the .Net
> >version of iBATIS. I've attached a more complete example below.
> >
> >I have not tested the code so if you copy and paste it into your
> >application it will most likley not work. Make sure you replace
> >"sqlMapconfig.xml" with the proper path to your config file:
> >
> >// untested - for example purposes only
> >Reader reader = new Resources.getResourceAsReader("sqlMapconfig.xml");
> >SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMap(reader);
> >sqlMap.update("lockTable", null);
> >
> >Another way to go about solving this issue is to create a generic
> >statement that executes sql statements:
> >
> > <statement id="executeRawSql">
> > $sql$
> > </statement>
> >
> >That could be called like this:
> >
> > // untested - for example purposes only
> > sqlMap.update("executeRawSql", "lock table x in shared mode");
> >
> >The sqlMap object in my last example is of type SqlMapClient and can be
> >found in the com.ibatis.sqlmap.client package.
> >
> >- Ron
> >
> >--- Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >
> >>What is the class of
> >>
> >>sqlMapper
> >>
> >>?
> >>
> >>-Henry
> >>
> >>
> >>
> >>Ron Grabowski wrote:
> >>
> >>
> >>
> >>>Have you tried Larry's suggestion?
> >>>
> >>>sqlMapper.executeUpdate("lockTable");
> >>>
> >>><statement id="lockTable">
> >>> lock table x in shared mode
> >>></statement>
> >>>
> >>>--- Henry Lu <zh...@umich.edu> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Mr. Ruth, thank you very much for your info for me to understanding
> >>>>this
> >>>>group. I thought there is a group of expertise watching the emails
> >>>>and
> >>>>helping people to use the iBATIS. So there are no iBATIS board
> >>>>members
> >>>>in the group. Everyone is trying and error to figure out how to use
> >>>>
> >>>>
> >>>>iBATIS. If it works, fine, if it doesn't, trying another way. You
> >>>>never
> >>>>know what the best/right way to do it. One suggestion I'd like to
> >>>>make
> >>>>to the board of iBATIS if I could is to write a better
> >>>>
> >>>>
> >>documentation
> >>
> >>
> >>>>so
> >>>>it will save users times.
> >>>>
> >>>>Thanks you again for you help.
> >>>>
> >>>>-Henry
> >>>>
> >>>>
> >>>>
> >>>>Brice Ruth wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Hi Henry,
> >>>>>
> >>>>>Please stay civil on this list. Throwing veiled insults at regular
> >>>>>contributors on this list is not cool.
> >>>>>
> >>>>>This is not paid technical support that you're talking to. If
> >>>>>
> >>>>>
> >>that's
> >>
> >>
> >>>>>how you treat them, that's fine. We're all volunteers & users of
> >>>>>iBATIS, as such, we subscribe to the notion of trying things out,
> >>>>>seeing if they work. Sometimes, we're pleasantly surprised.
> >>>>>
> >>>>>In your particular case, since you haven't posted any errors from
> >>>>>iBATIS, it appears that you haven't tried anything out. As such,
> >>>>>
> >>>>>
> >>the
> >>
> >>
> >>>>>best we can do is suggest that you do try. If you have particular
> >>>>>problems, as a group, we can try to help straighten them out, or
> >>>>>suggest addl. features for future releases.
> >>>>>
> >>>>>Nobody is going to try things out for you, though - that's your
> >>>>>responsibility, as it should be.
> >>>>>
> >>>>>Best,
> >>>>>Brice
> >>>>>
> >>>>>
> >>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Please don't answer the question that you don't know because it
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>will
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>wast both side time.
> >>>>>>
> >>>>>>-Henry
> >>>>>>
> >>>>>>Larry Meadors wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>DDL is not supported, but may work as an update.
> >>>>>>>
> >>>>>>>Larry
> >>>>>>>
> >>>>>>>
> >>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>treat as ddl.
> >>>>>>>>
> >>>>>>>>-Henry
> >>>>>>>>
> >>>>>>>>Larry Meadors wrote:
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>How would you do it with JDBC?
> >>>>>>>>>
> >>>>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>>How do i set sqlmap for the following SQL statement:
> >>>>>>>>>>
> >>>>>>>>>>lock table x in shared mode
> >>>>>>>>>>
> >>>>>>>>>>?
> >>>>>>>>>>
> >>>>>>>>>>-Henry
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
> >
>
--
Dmitry Skavish
Re: lock
Posted by Ron Grabowski <ro...@yahoo.com>.
I've never tried creating tables and views using that syntax but it
should work.
--- Henry Lu <zh...@umich.edu> wrote:
> It worked. Thanks for your help. Based upon your experience, do you
> know
> if this works for "create table" and "Create view"?
>
> -Henry
>
> Ron Grabowski wrote:
>
> >The code I posted was just an example. I'm more familiar with the
> .Net
> >version of iBATIS. I've attached a more complete example below.
> >
> >I have not tested the code so if you copy and paste it into your
> >application it will most likley not work. Make sure you replace
> >"sqlMapconfig.xml" with the proper path to your config file:
> >
> >// untested - for example purposes only
> >Reader reader = new
> Resources.getResourceAsReader("sqlMapconfig.xml");
> >SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMap(reader);
> >sqlMap.update("lockTable", null);
> >
> >Another way to go about solving this issue is to create a generic
> >statement that executes sql statements:
> >
> > <statement id="executeRawSql">
> > $sql$
> > </statement>
> >
> >That could be called like this:
> >
> > // untested - for example purposes only
> > sqlMap.update("executeRawSql", "lock table x in shared mode");
> >
> >The sqlMap object in my last example is of type SqlMapClient and can
> be
> >found in the com.ibatis.sqlmap.client package.
> >
> >- Ron
> >
> >--- Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >
> >>What is the class of
> >>
> >>sqlMapper
> >>
> >>?
> >>
> >>-Henry
> >>
> >>
> >>
> >>Ron Grabowski wrote:
> >>
> >>
> >>
> >>>Have you tried Larry's suggestion?
> >>>
> >>>sqlMapper.executeUpdate("lockTable");
> >>>
> >>><statement id="lockTable">
> >>> lock table x in shared mode
> >>></statement>
> >>>
> >>>--- Henry Lu <zh...@umich.edu> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Mr. Ruth, thank you very much for your info for me to
> understanding
> >>>>this
> >>>>group. I thought there is a group of expertise watching the
> emails
> >>>>and
> >>>>helping people to use the iBATIS. So there are no iBATIS board
> >>>>members
> >>>>in the group. Everyone is trying and error to figure out how to
> use
> >>>>
> >>>>
> >>>>iBATIS. If it works, fine, if it doesnt, trying another way. You
> >>>>never
> >>>>know what the best/right way to do it. One suggestion Id like to
> >>>>make
> >>>>to the board of iBATIS if I could is to write a better
> >>>>
> >>>>
> >>documentation
> >>
> >>
> >>>>so
> >>>>it will save users times.
> >>>>
> >>>>Thanks you again for you help.
> >>>>
> >>>>-Henry
> >>>>
> >>>>
> >>>>
> >>>>Brice Ruth wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Hi Henry,
> >>>>>
> >>>>>Please stay civil on this list. Throwing veiled insults at
> regular
> >>>>>contributors on this list is not cool.
> >>>>>
> >>>>>This is not paid technical support that you're talking to. If
> >>>>>
> >>>>>
> >>that's
> >>
> >>
> >>>>>how you treat them, that's fine. We're all volunteers & users of
> >>>>>iBATIS, as such, we subscribe to the notion of trying things
> out,
> >>>>>seeing if they work. Sometimes, we're pleasantly surprised.
> >>>>>
> >>>>>In your particular case, since you haven't posted any errors
> from
> >>>>>iBATIS, it appears that you haven't tried anything out. As such,
> >>>>>
> >>>>>
> >>the
> >>
> >>
> >>>>>best we can do is suggest that you do try. If you have
> particular
> >>>>>problems, as a group, we can try to help straighten them out, or
> >>>>>suggest addl. features for future releases.
> >>>>>
> >>>>>Nobody is going to try things out for you, though - that's your
> >>>>>responsibility, as it should be.
> >>>>>
> >>>>>Best,
> >>>>>Brice
> >>>>>
> >>>>>
> >>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Please don't answer the question that you don't know because it
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>will
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>wast both side time.
> >>>>>>
> >>>>>>-Henry
> >>>>>>
> >>>>>>Larry Meadors wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>DDL is not supported, but may work as an update.
> >>>>>>>
> >>>>>>>Larry
> >>>>>>>
> >>>>>>>
> >>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>treat as ddl.
> >>>>>>>>
> >>>>>>>>-Henry
> >>>>>>>>
> >>>>>>>>Larry Meadors wrote:
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
>
=== message truncated ===
Re: lock
Posted by Henry Lu <zh...@umich.edu>.
It worked. Thanks for your help. Based upon your experience, do you know
if this works for "create table" and "Create view"?
-Henry
Ron Grabowski wrote:
>The code I posted was just an example. I'm more familiar with the .Net
>version of iBATIS. I've attached a more complete example below.
>
>I have not tested the code so if you copy and paste it into your
>application it will most likley not work. Make sure you replace
>"sqlMapconfig.xml" with the proper path to your config file:
>
>// untested - for example purposes only
>Reader reader = new Resources.getResourceAsReader("sqlMapconfig.xml");
>SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMap(reader);
>sqlMap.update("lockTable", null);
>
>Another way to go about solving this issue is to create a generic
>statement that executes sql statements:
>
> <statement id="executeRawSql">
> $sql$
> </statement>
>
>That could be called like this:
>
> // untested - for example purposes only
> sqlMap.update("executeRawSql", "lock table x in shared mode");
>
>The sqlMap object in my last example is of type SqlMapClient and can be
>found in the com.ibatis.sqlmap.client package.
>
>- Ron
>
>--- Henry Lu <zh...@umich.edu> wrote:
>
>
>
>>What is the class of
>>
>>sqlMapper
>>
>>?
>>
>>-Henry
>>
>>
>>
>>Ron Grabowski wrote:
>>
>>
>>
>>>Have you tried Larry's suggestion?
>>>
>>>sqlMapper.executeUpdate("lockTable");
>>>
>>><statement id="lockTable">
>>> lock table x in shared mode
>>></statement>
>>>
>>>--- Henry Lu <zh...@umich.edu> wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Mr. Ruth, thank you very much for your info for me to understanding
>>>>this
>>>>group. I thought there is a group of expertise watching the emails
>>>>and
>>>>helping people to use the iBATIS. So there are no iBATIS board
>>>>members
>>>>in the group. Everyone is trying and error to figure out how to use
>>>>
>>>>
>>>>iBATIS. If it works, fine, if it doesn’t, trying another way. You
>>>>never
>>>>know what the best/right way to do it. One suggestion I’d like to
>>>>make
>>>>to the board of iBATIS if I could is to write a better
>>>>
>>>>
>>documentation
>>
>>
>>>>so
>>>>it will save users times.
>>>>
>>>>Thanks you again for you help.
>>>>
>>>>-Henry
>>>>
>>>>
>>>>
>>>>Brice Ruth wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Hi Henry,
>>>>>
>>>>>Please stay civil on this list. Throwing veiled insults at regular
>>>>>contributors on this list is not cool.
>>>>>
>>>>>This is not paid technical support that you're talking to. If
>>>>>
>>>>>
>>that's
>>
>>
>>>>>how you treat them, that's fine. We're all volunteers & users of
>>>>>iBATIS, as such, we subscribe to the notion of trying things out,
>>>>>seeing if they work. Sometimes, we're pleasantly surprised.
>>>>>
>>>>>In your particular case, since you haven't posted any errors from
>>>>>iBATIS, it appears that you haven't tried anything out. As such,
>>>>>
>>>>>
>>the
>>
>>
>>>>>best we can do is suggest that you do try. If you have particular
>>>>>problems, as a group, we can try to help straighten them out, or
>>>>>suggest addl. features for future releases.
>>>>>
>>>>>Nobody is going to try things out for you, though - that's your
>>>>>responsibility, as it should be.
>>>>>
>>>>>Best,
>>>>>Brice
>>>>>
>>>>>
>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Please don't answer the question that you don't know because it
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>will
>>>>
>>>>
>>>>
>>>>
>>>>>>wast both side time.
>>>>>>
>>>>>>-Henry
>>>>>>
>>>>>>Larry Meadors wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>DDL is not supported, but may work as an update.
>>>>>>>
>>>>>>>Larry
>>>>>>>
>>>>>>>
>>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>treat as ddl.
>>>>>>>>
>>>>>>>>-Henry
>>>>>>>>
>>>>>>>>Larry Meadors wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>How would you do it with JDBC?
>>>>>>>>>
>>>>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>How do i set sqlmap for the following SQL statement:
>>>>>>>>>>
>>>>>>>>>>lock table x in shared mode
>>>>>>>>>>
>>>>>>>>>>?
>>>>>>>>>>
>>>>>>>>>>-Henry
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>>>
>
>
>
>
>
Re: lock
Posted by Ron Grabowski <ro...@yahoo.com>.
The code I posted was just an example. I'm more familiar with the .Net
version of iBATIS. I've attached a more complete example below.
I have not tested the code so if you copy and paste it into your
application it will most likley not work. Make sure you replace
"sqlMapconfig.xml" with the proper path to your config file:
// untested - for example purposes only
Reader reader = new Resources.getResourceAsReader("sqlMapconfig.xml");
SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMap(reader);
sqlMap.update("lockTable", null);
Another way to go about solving this issue is to create a generic
statement that executes sql statements:
<statement id="executeRawSql">
$sql$
</statement>
That could be called like this:
// untested - for example purposes only
sqlMap.update("executeRawSql", "lock table x in shared mode");
The sqlMap object in my last example is of type SqlMapClient and can be
found in the com.ibatis.sqlmap.client package.
- Ron
--- Henry Lu <zh...@umich.edu> wrote:
> What is the class of
>
> sqlMapper
>
> ?
>
> -Henry
>
>
>
> Ron Grabowski wrote:
>
> >Have you tried Larry's suggestion?
> >
> > sqlMapper.executeUpdate("lockTable");
> >
> > <statement id="lockTable">
> > lock table x in shared mode
> > </statement>
> >
> >--- Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >
> >>Mr. Ruth, thank you very much for your info for me to understanding
> >>this
> >>group. I thought there is a group of expertise watching the emails
> >>and
> >>helping people to use the iBATIS. So there are no iBATIS board
> >>members
> >>in the group. Everyone is trying and error to figure out how to use
>
> >>iBATIS. If it works, fine, if it doesnt, trying another way. You
> >>never
> >>know what the best/right way to do it. One suggestion Id like to
> >>make
> >>to the board of iBATIS if I could is to write a better
> documentation
> >>so
> >>it will save users times.
> >>
> >>Thanks you again for you help.
> >>
> >>-Henry
> >>
> >>
> >>
> >>Brice Ruth wrote:
> >>
> >>
> >>
> >>>Hi Henry,
> >>>
> >>>Please stay civil on this list. Throwing veiled insults at regular
> >>>contributors on this list is not cool.
> >>>
> >>>This is not paid technical support that you're talking to. If
> that's
> >>>how you treat them, that's fine. We're all volunteers & users of
> >>>iBATIS, as such, we subscribe to the notion of trying things out,
> >>>seeing if they work. Sometimes, we're pleasantly surprised.
> >>>
> >>>In your particular case, since you haven't posted any errors from
> >>>iBATIS, it appears that you haven't tried anything out. As such,
> the
> >>>best we can do is suggest that you do try. If you have particular
> >>>problems, as a group, we can try to help straighten them out, or
> >>>suggest addl. features for future releases.
> >>>
> >>>Nobody is going to try things out for you, though - that's your
> >>>responsibility, as it should be.
> >>>
> >>>Best,
> >>>Brice
> >>>
> >>>
> >>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Please don't answer the question that you don't know because it
> >>>>
> >>>>
> >>will
> >>
> >>
> >>>>wast both side time.
> >>>>
> >>>>-Henry
> >>>>
> >>>>Larry Meadors wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>DDL is not supported, but may work as an update.
> >>>>>
> >>>>>Larry
> >>>>>
> >>>>>
> >>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>treat as ddl.
> >>>>>>
> >>>>>>-Henry
> >>>>>>
> >>>>>>Larry Meadors wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>How would you do it with JDBC?
> >>>>>>>
> >>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>How do i set sqlmap for the following SQL statement:
> >>>>>>>>
> >>>>>>>>lock table x in shared mode
> >>>>>>>>
> >>>>>>>>?
> >>>>>>>>
> >>>>>>>>-Henry
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
> >
>
Re: lock
Posted by Henry Lu <zh...@umich.edu>.
What is the class of
sqlMapper
?
-Henry
Ron Grabowski wrote:
>Have you tried Larry's suggestion?
>
> sqlMapper.executeUpdate("lockTable");
>
> <statement id="lockTable">
> lock table x in shared mode
> </statement>
>
>--- Henry Lu <zh...@umich.edu> wrote:
>
>
>
>>Mr. Ruth, thank you very much for your info for me to understanding
>>this
>>group. I thought there is a group of expertise watching the emails
>>and
>>helping people to use the iBATIS. So there are no iBATIS board
>>members
>>in the group. Everyone is trying and error to figure out how to use
>>iBATIS. If it works, fine, if it doesn’t, trying another way. You
>>never
>>know what the best/right way to do it. One suggestion I’d like to
>>make
>>to the board of iBATIS if I could is to write a better documentation
>>so
>>it will save users times.
>>
>>Thanks you again for you help.
>>
>>-Henry
>>
>>
>>
>>Brice Ruth wrote:
>>
>>
>>
>>>Hi Henry,
>>>
>>>Please stay civil on this list. Throwing veiled insults at regular
>>>contributors on this list is not cool.
>>>
>>>This is not paid technical support that you're talking to. If that's
>>>how you treat them, that's fine. We're all volunteers & users of
>>>iBATIS, as such, we subscribe to the notion of trying things out,
>>>seeing if they work. Sometimes, we're pleasantly surprised.
>>>
>>>In your particular case, since you haven't posted any errors from
>>>iBATIS, it appears that you haven't tried anything out. As such, the
>>>best we can do is suggest that you do try. If you have particular
>>>problems, as a group, we can try to help straighten them out, or
>>>suggest addl. features for future releases.
>>>
>>>Nobody is going to try things out for you, though - that's your
>>>responsibility, as it should be.
>>>
>>>Best,
>>>Brice
>>>
>>>
>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>
>>>
>>>
>>>
>>>>Please don't answer the question that you don't know because it
>>>>
>>>>
>>will
>>
>>
>>>>wast both side time.
>>>>
>>>>-Henry
>>>>
>>>>Larry Meadors wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>DDL is not supported, but may work as an update.
>>>>>
>>>>>Larry
>>>>>
>>>>>
>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>treat as ddl.
>>>>>>
>>>>>>-Henry
>>>>>>
>>>>>>Larry Meadors wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>How would you do it with JDBC?
>>>>>>>
>>>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>How do i set sqlmap for the following SQL statement:
>>>>>>>>
>>>>>>>>lock table x in shared mode
>>>>>>>>
>>>>>>>>?
>>>>>>>>
>>>>>>>>-Henry
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>
>
>
>
>
Re: lock
Posted by Ron Grabowski <ro...@yahoo.com>.
Have you tried Larry's suggestion?
sqlMapper.executeUpdate("lockTable");
<statement id="lockTable">
lock table x in shared mode
</statement>
--- Henry Lu <zh...@umich.edu> wrote:
> Mr. Ruth, thank you very much for your info for me to understanding
> this
> group. I thought there is a group of expertise watching the emails
> and
> helping people to use the iBATIS. So there are no iBATIS board
> members
> in the group. Everyone is trying and error to figure out how to use
> iBATIS. If it works, fine, if it doesnt, trying another way. You
> never
> know what the best/right way to do it. One suggestion Id like to
> make
> to the board of iBATIS if I could is to write a better documentation
> so
> it will save users times.
>
> Thanks you again for you help.
>
> -Henry
>
>
>
> Brice Ruth wrote:
>
> >Hi Henry,
> >
> >Please stay civil on this list. Throwing veiled insults at regular
> >contributors on this list is not cool.
> >
> >This is not paid technical support that you're talking to. If that's
> >how you treat them, that's fine. We're all volunteers & users of
> >iBATIS, as such, we subscribe to the notion of trying things out,
> >seeing if they work. Sometimes, we're pleasantly surprised.
> >
> >In your particular case, since you haven't posted any errors from
> >iBATIS, it appears that you haven't tried anything out. As such, the
> >best we can do is suggest that you do try. If you have particular
> >problems, as a group, we can try to help straighten them out, or
> >suggest addl. features for future releases.
> >
> >Nobody is going to try things out for you, though - that's your
> >responsibility, as it should be.
> >
> >Best,
> >Brice
> >
> >
> >On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >>Please don't answer the question that you don't know because it
> will
> >>wast both side time.
> >>
> >>-Henry
> >>
> >>Larry Meadors wrote:
> >>
> >>
> >>
> >>>DDL is not supported, but may work as an update.
> >>>
> >>>Larry
> >>>
> >>>
> >>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>treat as ddl.
> >>>>
> >>>>-Henry
> >>>>
> >>>>Larry Meadors wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>How would you do it with JDBC?
> >>>>>
> >>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>How do i set sqlmap for the following SQL statement:
> >>>>>>
> >>>>>>lock table x in shared mode
> >>>>>>
> >>>>>>?
> >>>>>>
> >>>>>>-Henry
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
Re: lock
Posted by Clinton Begin <cl...@gmail.com>.
>> One suggestion I'd like to make
>> to the board of iBATIS if I could is to write a better documentation so
>> it will save users times.
Thanks for offering Henry!
We look forward to your first contributions to the documentation of the
project. Here's a list of some of the items that need better documentation.
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Not+Yet+Documented
The community appreciates your efforts.
Thanks much,
Clinton Begin
On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>
> Mr. Ruth, thank you very much for your info for me to understanding this
> group. I thought there is a group of expertise watching the emails and
> helping people to use the iBATIS. So there are no iBATIS board members
> in the group. Everyone is trying and error to figure out how to use
> iBATIS. If it works, fine, if it doesn't, trying another way. You never
> know what the best/right way to do it. One suggestion I'd like to make
> to the board of iBATIS if I could is to write a better documentation so
> it will save users times.
>
> Thanks you again for you help.
>
> -Henry
>
>
>
> Brice Ruth wrote:
>
> >Hi Henry,
> >
> >Please stay civil on this list. Throwing veiled insults at regular
> >contributors on this list is not cool.
> >
> >This is not paid technical support that you're talking to. If that's
> >how you treat them, that's fine. We're all volunteers & users of
> >iBATIS, as such, we subscribe to the notion of trying things out,
> >seeing if they work. Sometimes, we're pleasantly surprised.
> >
> >In your particular case, since you haven't posted any errors from
> >iBATIS, it appears that you haven't tried anything out. As such, the
> >best we can do is suggest that you do try. If you have particular
> >problems, as a group, we can try to help straighten them out, or
> >suggest addl. features for future releases.
> >
> >Nobody is going to try things out for you, though - that's your
> >responsibility, as it should be.
> >
> >Best,
> >Brice
> >
> >
> >On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >>Please don't answer the question that you don't know because it will
> >>wast both side time.
> >>
> >>-Henry
> >>
> >>Larry Meadors wrote:
> >>
> >>
> >>
> >>>DDL is not supported, but may work as an update.
> >>>
> >>>Larry
> >>>
> >>>
> >>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>treat as ddl.
> >>>>
> >>>>-Henry
> >>>>
> >>>>Larry Meadors wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>How would you do it with JDBC?
> >>>>>
> >>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>How do i set sqlmap for the following SQL statement:
> >>>>>>
> >>>>>>lock table x in shared mode
> >>>>>>
> >>>>>>?
> >>>>>>
> >>>>>>-Henry
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
Re: lock
Posted by Henry Lu <zh...@umich.edu>.
Mr. Ruth, thank you very much for your info for me to understanding this
group. I thought there is a group of expertise watching the emails and
helping people to use the iBATIS. So there are no iBATIS board members
in the group. Everyone is trying and error to figure out how to use
iBATIS. If it works, fine, if it doesn’t, trying another way. You never
know what the best/right way to do it. One suggestion I’d like to make
to the board of iBATIS if I could is to write a better documentation so
it will save users times.
Thanks you again for you help.
-Henry
Brice Ruth wrote:
>Hi Henry,
>
>Please stay civil on this list. Throwing veiled insults at regular
>contributors on this list is not cool.
>
>This is not paid technical support that you're talking to. If that's
>how you treat them, that's fine. We're all volunteers & users of
>iBATIS, as such, we subscribe to the notion of trying things out,
>seeing if they work. Sometimes, we're pleasantly surprised.
>
>In your particular case, since you haven't posted any errors from
>iBATIS, it appears that you haven't tried anything out. As such, the
>best we can do is suggest that you do try. If you have particular
>problems, as a group, we can try to help straighten them out, or
>suggest addl. features for future releases.
>
>Nobody is going to try things out for you, though - that's your
>responsibility, as it should be.
>
>Best,
>Brice
>
>
>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>
>
>>Please don't answer the question that you don't know because it will
>>wast both side time.
>>
>>-Henry
>>
>>Larry Meadors wrote:
>>
>>
>>
>>>DDL is not supported, but may work as an update.
>>>
>>>Larry
>>>
>>>
>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>
>>>
>>>
>>>
>>>>treat as ddl.
>>>>
>>>>-Henry
>>>>
>>>>Larry Meadors wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>How would you do it with JDBC?
>>>>>
>>>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>How do i set sqlmap for the following SQL statement:
>>>>>>
>>>>>>lock table x in shared mode
>>>>>>
>>>>>>?
>>>>>>
>>>>>>-Henry
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>
>
>
>
Re: lock
Posted by Brice Ruth <bd...@gmail.com>.
Hi Henry,
Please stay civil on this list. Throwing veiled insults at regular
contributors on this list is not cool.
This is not paid technical support that you're talking to. If that's
how you treat them, that's fine. We're all volunteers & users of
iBATIS, as such, we subscribe to the notion of trying things out,
seeing if they work. Sometimes, we're pleasantly surprised.
In your particular case, since you haven't posted any errors from
iBATIS, it appears that you haven't tried anything out. As such, the
best we can do is suggest that you do try. If you have particular
problems, as a group, we can try to help straighten them out, or
suggest addl. features for future releases.
Nobody is going to try things out for you, though - that's your
responsibility, as it should be.
Best,
Brice
On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> Please don't answer the question that you don't know because it will
> wast both side time.
>
> -Henry
>
> Larry Meadors wrote:
>
> >DDL is not supported, but may work as an update.
> >
> >Larry
> >
> >
> >On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >>treat as ddl.
> >>
> >>-Henry
> >>
> >>Larry Meadors wrote:
> >>
> >>
> >>
> >>>How would you do it with JDBC?
> >>>
> >>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>How do i set sqlmap for the following SQL statement:
> >>>>
> >>>>lock table x in shared mode
> >>>>
> >>>>?
> >>>>
> >>>>-Henry
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
--
Brice Ruth
Software Engineer, Madison WI
Re: lock
Posted by Henry Lu <zh...@umich.edu>.
Please don't answer the question that you don't know because it will
wast both side time.
-Henry
Larry Meadors wrote:
>DDL is not supported, but may work as an update.
>
>Larry
>
>
>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>
>
>>treat as ddl.
>>
>>-Henry
>>
>>Larry Meadors wrote:
>>
>>
>>
>>>How would you do it with JDBC?
>>>
>>>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>>>
>>>
>>>
>>>
>>>>How do i set sqlmap for the following SQL statement:
>>>>
>>>>lock table x in shared mode
>>>>
>>>>?
>>>>
>>>>-Henry
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>
>
>
>
Re: lock
Posted by Larry Meadors <la...@gmail.com>.
DDL is not supported, but may work as an update.
Larry
On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> treat as ddl.
>
> -Henry
>
> Larry Meadors wrote:
>
> >How would you do it with JDBC?
> >
> >On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> >
> >
> >>How do i set sqlmap for the following SQL statement:
> >>
> >>lock table x in shared mode
> >>
> >>?
> >>
> >>-Henry
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>
Re: lock
Posted by Henry Lu <zh...@umich.edu>.
treat as ddl.
-Henry
Larry Meadors wrote:
>How would you do it with JDBC?
>
>On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
>
>
>>How do i set sqlmap for the following SQL statement:
>>
>>lock table x in shared mode
>>
>>?
>>
>>-Henry
>>
>>
>>
>>
>
>
>
>
Re: lock
Posted by Larry Meadors <la...@gmail.com>.
How would you do it with JDBC?
On 6/23/05, Henry Lu <zh...@umich.edu> wrote:
> How do i set sqlmap for the following SQL statement:
>
> lock table x in shared mode
>
> ?
>
> -Henry
>
>
lock
Posted by Henry Lu <zh...@umich.edu>.
How do i set sqlmap for the following SQL statement:
lock table x in shared mode
?
-Henry
Re: Get return value of stored procedure
Posted by Bing Qiao <qi...@gmail.com>.
I can only get the error message/code from exception raised by
raiserror statement in a stored procedure.
I can't find return code from exception.
Can you suggest me how to do it?
Thanks
On 6/23/05, Larry Meadors <la...@gmail.com> wrote:
> Sounds like you are using M$ SQL Server - one piece of advice either
> way you go:
>
> DO NOT use the M$ SQL Server driver. The OSS drivers are still faster
> and less flaky.
>
> On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > Thanks for your reply.
> >
> > First, I was referring to sqlmap, not ibatis dao. Are these two
> > exlusive, jdbc and sqlmap?
>
> Absolutely not. I have many classes that use both sqlmap and jdbc with
> no issues.
>
> >
> > Second, I happen to have known that sqlmap supports OUT parameters.
> >
> > As a java developer I have no problem in using OUT parameters.
> >
> > What I was asking is: (1) does sqlmap directly support retrieving
> > RETURN code that is defined as follows in SQL online book.
> >
> > "RETURN
> > Exits unconditionally from a query or procedure. RETURN is immediate
> > and complete and can be used at any point to exit from a procedure,
> > batch, or statement block. Statements following RETURN are not
> > executed."
>
> I suspect that is going to depend upon the driver, but if it is doable
> with JDBC, it is doable with iBATIS.
>
> > Obviously, we can catch raiserror (defined as follows from SQL online
> > book) exceptions, but what about the severity level and state? My
> > second question: (2)can we retrieve them as well?
> >
> > "RAISERROR
> > Returns a user-defined error message and sets a system flag to record
> > that an error has occurred. Using RAISERROR, the client can either
> > retrieve an entry from the sysmessages table or build a message
> > dynamically with user-specified severity and state information. After
> > the message is defined it is sent back to the client as a server error
> > message."
>
> If i am reading this correctly, you want to catch the return value
> from an exception. That should work fine, in spite of it being sort of
> a messy design.
>
> > I undertand they might be vendor specific, so if no support for them
> > can someone please clarify that? really appreciate your help, thanks a
> > lot!
>
> No problem.
>
Re: Get return value of stored procedure
Posted by Bing Qiao <qi...@gmail.com>.
Thanks for your reply.
First, I was referring to sqlmap, not ibatis dao. Are these two
exlusive, jdbc and sqlmap?
Second, I happen to have known that sqlmap supports OUT parameters.
As a java developer I have no problem in using OUT parameters.
What I was asking is: (1) does sqlmap directly support retrieving
RETURN code that is defined as follows in SQL online book.
"RETURN
Exits unconditionally from a query or procedure. RETURN is immediate
and complete and can be used at any point to exit from a procedure,
batch, or statement block. Statements following RETURN are not
executed."
Obviously, we can catch raiserror (defined as follows from SQL online
book) exceptions, but what about the severity level and state? My
second question: (2)can we retrieve them as well?
"RAISERROR
Returns a user-defined error message and sets a system flag to record
that an error has occurred. Using RAISERROR, the client can either
retrieve an entry from the sysmessages table or build a message
dynamically with user-specified severity and state information. After
the message is defined it is sent back to the client as a server error
message."
I undertand they might be vendor specific, so if no support for them
can someone please clarify that? really appreciate your help, thanks a
lot!
On 6/23/05, Larry Meadors <la...@gmail.com> wrote:
> On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > Help please!
> >
> > I have had several talks with our DBA who is so skeptical of iBATIS
> > and vow to force us to go back to jdbc. One of his arguments is that
> > the return code from stored procedure can not be retrieved by sqlmap.
>
> First: That is just plain silly. There is NOTHING in iBATIS that
> precludes you from using JDBC, so your first point is that the two are
> NOT exclusive.
>
> Second: You can get return values from stored procedures. Why else
> would we have any support for them? Some return values (i.e., Oracle
> REFCURSOR return values) are not supported without some additional
> work, but mapping simpler return values is trivial. Support is
> available for in, out, and inout parameters.
>
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+call+a+stored+procedure%3F
>
> Please do yourself a favor, and read the sql maps docs, there is a ton
> of good info there.
>
> Larry
>
>
> >
> > I tried all I could but no luck till now. Any help please!
> >
> > Thanks a lot!
> >
> > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > Hi,
> > >
> > > What do I need to add to the sqlmap to get the return value (for
> > > example, return -9) of stored procedure?
> > >
> > >
> > > Thanks very much!
> > >
> > > bqiao
> > >
> >
>
Re: Get return value of stored procedure
Posted by Larry Meadors <la...@gmail.com>.
On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> Help please!
>
> I have had several talks with our DBA who is so skeptical of iBATIS
> and vow to force us to go back to jdbc. One of his arguments is that
> the return code from stored procedure can not be retrieved by sqlmap.
First: That is just plain silly. There is NOTHING in iBATIS that
precludes you from using JDBC, so your first point is that the two are
NOT exclusive.
Second: You can get return values from stored procedures. Why else
would we have any support for them? Some return values (i.e., Oracle
REFCURSOR return values) are not supported without some additional
work, but mapping simpler return values is trivial. Support is
available for in, out, and inout parameters.
http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+call+a+stored+procedure%3F
Please do yourself a favor, and read the sql maps docs, there is a ton
of good info there.
Larry
>
> I tried all I could but no luck till now. Any help please!
>
> Thanks a lot!
>
> On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > Hi,
> >
> > What do I need to add to the sqlmap to get the return value (for
> > example, return -9) of stored procedure?
> >
> >
> > Thanks very much!
> >
> > bqiao
> >
>
Re: Get return value of stored procedure
Posted by Daniel Henrique Ferreira e Silva <dh...@gmail.com>.
HAHAHAHA!
Clinton, you made me laugh hard!
"Undocumented stuff" is documented in the wiki! He he! ;-)
Well, at least it is a better situation than Oracle's undocumented parameters.
Daniel Silva.
On 6/28/05, Clinton Begin <cl...@gmail.com> wrote:
>
> The syntax I used is the newer one...and yes it's undocumented right
> now....
>
> You can find it in the "undocumented stuff" section of the wiki. ;-)
>
> Clinton
>
>
> On 6/28/05, Bing Qiao <qi...@gmail.com> wrote:
> > I realized that too. Thanks.
> >
> > BTW, the inline parameter format given by Clinton:
> > "{#value,mode=OUT,jdbcType=INTEGER# = call
> TestReturnValue}"
> >
> > is not the same as that in the online document:
> >
> > "insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
> > values (#id:NUMERIC#, #description:VARCHAR#);"
> >
> > Where can I find the specification of the former one?
> >
> > Many thanks!
> >
> > Bing
> >
> > On 6/27/05, Daniel Henrique Ferreira e Silva < dhsilva@gmail.com> wrote:
> > > Bing,
> > >
> > > You didn't have success using java.lang.Integer because it is
> > > immutable as is String class.
> > > Use, for that situation, mutable classes, like Clinton said, the Map
> > > implementations.
> > > Just read carefully Clinton's e-mails and you'll see that he had
> > > stated that previously.
> > >
> > > Hope that helped,
> > > Daniel Silva.
> > >
> > > On 6/26/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > Dear Clinton,
> > > >
> > > > Really appreciate your help, especially after I finally got it right
> > > > from your last email.
> > > >
> > > > sqlmap (both inline and parameterMap worked):
> > > >
> > > > <sqlMap namespace="TestSqlMap">
> > > >
> > > > <parameterMap id="paraMap" class="">
> > > > <parameter property="value" jdbcType="INTEGER"
> > > > javaType="java.lang.Integer" mode="OUT"/>
> > > > </parameterMap>
> > > >
> > > > <procedure id="callStoredProcedureA" parameterMap="paraMap">
> > > > {? = call TestReturnValue}
> > > > </procedure>
> > > >
> > > > <procedure id="callStoredProcedureB" parameterClass="
> java.util.HashMap">
> > > > {#value,mode=OUT,jdbcType=INTEGER# = call
> TestReturnValue}
> > > > </procedure>
> > > >
> > > > </sqlMap>
> > > >
> > > > ///////////////////////////////
> > > > call from java:
> > > >
> > > > public static Integer callStoredProcedure() {
> > > > HashMap hm = new HashMap();
> > > > hm.put("value", new Integer(-1));
> > > > try {
> > > >
> getInstance().update("callStoredProcedureA", hm);
> > > > } catch (SQLException e) {
> > > > e.printStackTrace();
> > > > }
> > > >
> > > > return (Integer)hm.get("value");
> > > > }
> > > > ///////////////////////////
> > > > stored procedure:
> > > >
> > > > CREATE PROCEDURE [dbo].[TestReturnValue] AS
> > > >
> > > > UPDATE dbo.TEST
> > > > SET USERID = USERID + 1
> > > > WHERE USERNAME = 'test'
> > > >
> > > > DECLARE @rtn INT
> > > > SELECT @rtn = USERID FROM TEST WHERE USERNAME = 'test'
> > > >
> > > > RETURN @rtn
> > > > GO
> > > >
> > > > /////////////////////////
> > > >
> > > > Another question is: can I use java.lang.Integer directly as a
> > > > parameterClass instead of a Map?
> > > >
> > > > I tried this but failed:
> > > > sqlmap:
> > > > <procedure id="callStoredProcedureC" parameterClass="
> java.lang.Integer">
> > > > {#value,mode=OUT# = call TestReturnValue}
> > > > </procedure>
> > > > //////////////////////
> > > > call from java:
> > > > public static Integer callStoredProcedureC() {
> > > > Integer integer = new Integer(-1);
> > > > try {
> > > >
> getInstance().update("callStoredProcedureC", integer);
> > > > } catch (SQLException e) {
> > > > e.printStackTrace();
> > > > }
> > > >
> > > > return integer;
> > > > }
> > > > ///////////////////////
> > > > exception:
> > > > " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
> > > > occurred while executing update procedure. \n--- Check the {? = call
> > > > TestReturnValue}. \n--- Check the output parameters (register output
> > > > parameters failed). \n--- Cause: java.sql.SQLException :
> > > > [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
> > > > not supported by this driver."
> > > > ///////////////////////
> > > >
> > > > And what about the raiserror, is it possible to get the severity level
> > > > and state besides the error message or error code?
> > > >
> > > > Thanks again,
> > > >
> > > > Bing
> > > >
> > > >
> > > > On 6/27/05, Clinton Begin < clinton.begin@gmail.com> wrote:
> > > > >
> > > > > Don't give up Bing!
> > > > >
> > > > > We'll get it eventually. That error actually might just be a result
> of me
> > > > > suggesting using a HashMap. Maps are not typed, so the driver is
> probably
> > > > > freaking because JDBC type in this case is being detected as simply
> > > > > "Object". You'll want to specify a JDBC type explicitly (like you
> would if
> > > > > it were JDBC)
> > > > >
> > > > > {#value,mode=OUT,jdbcType=NUMERIC# = call
> TestReturnValue}
> > > > >
> > > > > If NUMERIC doesn't work, try DECIMAL or INTEGER.
> > > > >
> > > > > Cheers,
> > > > >
> > > > > Clinton
> > > > >
> > > > > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > Hi Clinton
> > > > > >
> > > > > > Thanks for you help.
> > > > > >
> > > > > > Here is waht I did:
> > > > > >
> > > > > > sqlmap:
> > > > > >
> > > > > > <procedure id="callStoredProcedure"
> > > > > parameterClass="java.util.HashMap">
> > > > > > {#value,mode=OUT# = call TestReturnValue}
> > > > > > </procedure>
> > > > > >
> > > > > > call from java:
> > > > > >
> > > > > > public static Integer callStoredProcedure() {
> > > > > > HashMap hm = new HashMap();
> > > > > > hm.put("value", new Integer(-1));
> > > > > > try {
> > > > > >
> getInstance().update("callStoredProcedure",
> > > > > hm);
> > > > > > } catch (SQLException e) {
> > > > > > e.printStackTrace();
> > > > > > }
> > > > > >
> > > > > > Stored procedure:
> > > > > > CREATE PROCEDURE [dbo].[TestReturnValue] AS
> > > > > >
> > > > > > UPDATE dbo.TEST
> > > > > > SET USERID = USERID + 1
> > > > > > WHERE USERNAME = 'test'
> > > > > >
> > > > > > RETURN -17
> > > > > > GO
> > > > > >
> > > > > >
> > > > > > The exception I got:
> > > > > >
> > > > > > " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The
> error
> > > > > > occurred while executing update procedure. \n--- Check the {? =
> call
> > > > > > TestReturnValue}. \n--- Check the output parameters (register
> output
> > > > > > parameters failed). \n--- Cause: java.sql.SQLException:
> > > > > > [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type
> is
> > > > > > not supported by this driver."
> > > > > >
> > > > > > Having spent too much time on this issue, I have to give up If
> this
> > > > > > "not supported by this driver" is the real cause. It's impossible
> to
> > > > > > purssuade our DBA to use any JDBC drivers other than MS's.
> > > > > >
> > > > > >
> > > > > > Regards
> > > > > >
> > > > > > Bing
> > > > > >
> > > > > > On 6/26/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > > > Hi Bing,
> > > > > > >
> > > > > > > Yes, your syntax is correct.
> > > > > > >
> > > > > > > You should be able to do something like this:
> > > > > > >
> > > > > > > <procedure id="myProc" parameterClass="map" >
> > > > > > > {#value,mode=OUT# = call procedure_name}
> > > > > > > </procedure>
> > > > > > >
> > > > > > > I'll asume this is an update procedure, so no result class is
> needed.
> > > > > > >
> > > > > > > Notice the parameter class is a 'map", which means any instance
> of Map
> > > > > (like
> > > > > > > HashMap for example).
> > > > > > >
> > > > > > > It is important to use a mutable type for your parameter when
> using OUT
> > > > > > > params. This is because OUT params are passed back in the
> parameter
> > > > > object,
> > > > > > > not as a result object.
> > > > > > >
> > > > > > > So at the end of this call:
> > > > > > >
> > > > > > > Map myParam = new HashMap();
> > > > > > > myParam.put("value", 0); //default value
> > > > > > > sqlMapClient.update("myProc", myParam);
> > > > > > > myParam.get("value"); // value should be updated with OUT param.
> > > > > > >
> > > > > > > You can (and should) use a JavaBean as your parameter class
> instead of a
> > > > > Map
> > > > > > > if you like.
> > > > > > >
> > > > > > > Hope that helps,
> > > > > > >
> > > > > > > Clinton
> > > > > > >
> > > > > > >
> > > > > > > On 6/26/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > From sun JDBC documentation:
> > > > > > > >
> > > > > > > > The syntax for a procedure that returns a result parameter is:
> > > > > > > >
> > > > > > > > {? = call procedure_name[(?, ?, ...)]}
> > > > > > > >
> > > > > > > > Bing
> > > > > > > >
> > > > > > > > On 6/26/05, Larry Meadors < larry.meadors@gmail.com > wrote:
> > > > > > > > > I am not sure I understand. Are you trying to call a
> procedure with
> > > > > a
> > > > > > > > > single OUT parameter?
> > > > > > > > >
> > > > > > > > > If so, the syntax should be:
> > > > > > > > >
> > > > > > > > > <procedure id="BlahOut" parameterMap="BlahParm"
> > > > > > > > > resultClass="java.util.HashMap" >
> > > > > > > > > { call blah(?) }
> > > > > > > > > </procedure>
> > > > > > > > >
> > > > > > > > > and the parameter map should look like this:
> > > > > > > > >
> > > > > > > > > <parameterMap id="BlahParm" class=" java.util.Map ">
> > > > > > > > > <parameter property="a" mode="OUT" />
> > > > > > > > > </parameterMap>
> > > > > > > > >
> > > > > > > > > Larry
> > > > > > > > >
> > > > > > > > > On 6/26/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > > > Hi Clinton
> > > > > > > > > >
> > > > > > > > > > I tried something like this:
> > > > > > > > > > {? = call procedure_name}
> > > > > > > > > >
> > > > > > > > > > The ? is defined as an out parameter mapped onto a member
> (String,
> > > > > > > > > > int) of a HashMap object (I tried a javabean later as
> well) in the
> > > > > > > > > > parameter map.
> > > > > > > > > >
> > > > > > > > > > I didn't succeed with that.
> > > > > > > > > >
> > > > > > > > > > I tried to use inline parameter map too:
> > > > > > > > > > {#value:OUT# = call procedure_name}
> > > > > > > > > > by passing an Integer as parameter to queryForObject or
> other
> > > > > sqlmap
> > > > > > > methods.
> > > > > > > > > >
> > > > > > > > > > It didn't work either.
> > > > > > > > > >
> > > > > > > > > > Could you please advice what I need to do?
> > > > > > > > > >
> > > > > > > > > > I'm new to java programming. I don't have much JDBC
> experience
> > > > > > > > > > and sqlmap is the only database access tool I ever used in
> a
> > > > > > > > > > production project which I inherited from other
> developers.
> > > > > > > > > >
> > > > > > > > > > I appreciate you help, thanks very much!
> > > > > > > > > >
> > > > > > > > > > On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > > > > > > > Hi Bing,
> > > > > > > > > > >
> > > > > > > > > > > How do you get the return code using JDBC?
> > > > > > > > > > >
> > > > > > > > > > > Cheers,
> > > > > > > > > > > Clinton
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On 6/23/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > > > > > Help please!
> > > > > > > > > > > >
> > > > > > > > > > > > I have had several talks with our DBA who is so
> skeptical of
> > > > > > > iBATIS
> > > > > > > > > > > > and vow to force us to go back to jdbc. One of his
> arguments
> > > > > is
> > > > > > > that
> > > > > > > > > > > > the return code from stored procedure can not be
> retrieved by
> > > > > > > sqlmap.
> > > > > > > > > > > >
> > > > > > > > > > > > I tried all I could but no luck till now. Any help
> please!
> > > > > > > > > > > >
> > > > > > > > > > > > Thanks a lot!
> > > > > > > > > > > >
> > > > > > > > > > > > On 6/23/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > > > > > > Hi,
> > > > > > > > > > > > >
> > > > > > > > > > > > > What do I need to add to the sqlmap to get the
> return value
> > > > > (for
> > > > > > > > > > > > > example, return -9) of stored procedure?
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > Thanks very much!
> > > > > > > > > > > > >
> > > > > > > > > > > > > bqiao
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
>
Re: Get return value of stored procedure
Posted by Clinton Begin <cl...@gmail.com>.
The syntax I used is the newer one...and yes it's undocumented right now....
You can find it in the "undocumented stuff" section of the wiki. ;-)
Clinton
On 6/28/05, Bing Qiao <qi...@gmail.com> wrote:
>
> I realized that too. Thanks.
>
> BTW, the inline parameter format given by Clinton:
> "{#value,mode=OUT,jdbcType=INTEGER# = call TestReturnValue}"
>
> is not the same as that in the online document:
>
> "insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
> values (#id:NUMERIC#, #description:VARCHAR#);"
>
> Where can I find the specification of the former one?
>
> Many thanks!
>
> Bing
>
> On 6/27/05, Daniel Henrique Ferreira e Silva <dh...@gmail.com> wrote:
> > Bing,
> >
> > You didn't have success using java.lang.Integer because it is
> > immutable as is String class.
> > Use, for that situation, mutable classes, like Clinton said, the Map
> > implementations.
> > Just read carefully Clinton's e-mails and you'll see that he had
> > stated that previously.
> >
> > Hope that helped,
> > Daniel Silva.
> >
> > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > Dear Clinton,
> > >
> > > Really appreciate your help, especially after I finally got it right
> > > from your last email.
> > >
> > > sqlmap (both inline and parameterMap worked):
> > >
> > > <sqlMap namespace="TestSqlMap">
> > >
> > > <parameterMap id="paraMap" class="">
> > > <parameter property="value" jdbcType="INTEGER"
> > > javaType="java.lang.Integer" mode="OUT"/>
> > > </parameterMap>
> > >
> > > <procedure id="callStoredProcedureA" parameterMap="paraMap">
> > > {? = call TestReturnValue}
> > > </procedure>
> > >
> > > <procedure id="callStoredProcedureB" parameterClass="java.util.HashMap
> ">
> > > {#value,mode=OUT,jdbcType=INTEGER# = call TestReturnValue}
> > > </procedure>
> > >
> > > </sqlMap>
> > >
> > > ///////////////////////////////
> > > call from java:
> > >
> > > public static Integer callStoredProcedure() {
> > > HashMap hm = new HashMap();
> > > hm.put("value", new Integer(-1));
> > > try {
> > > getInstance().update("callStoredProcedureA", hm);
> > > } catch (SQLException e) {
> > > e.printStackTrace();
> > > }
> > >
> > > return (Integer)hm.get("value");
> > > }
> > > ///////////////////////////
> > > stored procedure:
> > >
> > > CREATE PROCEDURE [dbo].[TestReturnValue] AS
> > >
> > > UPDATE dbo.TEST
> > > SET USERID = USERID + 1
> > > WHERE USERNAME = 'test'
> > >
> > > DECLARE @rtn INT
> > > SELECT @rtn = USERID FROM TEST WHERE USERNAME = 'test'
> > >
> > > RETURN @rtn
> > > GO
> > >
> > > /////////////////////////
> > >
> > > Another question is: can I use java.lang.Integer directly as a
> > > parameterClass instead of a Map?
> > >
> > > I tried this but failed:
> > > sqlmap:
> > > <procedure id="callStoredProcedureC" parameterClass="java.lang.Integer
> ">
> > > {#value,mode=OUT# = call TestReturnValue}
> > > </procedure>
> > > //////////////////////
> > > call from java:
> > > public static Integer callStoredProcedureC() {
> > > Integer integer = new Integer(-1);
> > > try {
> > > getInstance().update("callStoredProcedureC", integer);
> > > } catch (SQLException e) {
> > > e.printStackTrace();
> > > }
> > >
> > > return integer;
> > > }
> > > ///////////////////////
> > > exception:
> > > " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
> > > occurred while executing update procedure. \n--- Check the {? = call
> > > TestReturnValue}. \n--- Check the output parameters (register output
> > > parameters failed). \n--- Cause: java.sql.SQLException:
> > > [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
> > > not supported by this driver."
> > > ///////////////////////
> > >
> > > And what about the raiserror, is it possible to get the severity level
> > > and state besides the error message or error code?
> > >
> > > Thanks again,
> > >
> > > Bing
> > >
> > >
> > > On 6/27/05, Clinton Begin <cl...@gmail.com> wrote:
> > > >
> > > > Don't give up Bing!
> > > >
> > > > We'll get it eventually. That error actually might just be a result
> of me
> > > > suggesting using a HashMap. Maps are not typed, so the driver is
> probably
> > > > freaking because JDBC type in this case is being detected as simply
> > > > "Object". You'll want to specify a JDBC type explicitly (like you
> would if
> > > > it were JDBC)
> > > >
> > > > {#value,mode=OUT,jdbcType=NUMERIC# = call TestReturnValue}
> > > >
> > > > If NUMERIC doesn't work, try DECIMAL or INTEGER.
> > > >
> > > > Cheers,
> > > >
> > > > Clinton
> > > >
> > > > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > Hi Clinton
> > > > >
> > > > > Thanks for you help.
> > > > >
> > > > > Here is waht I did:
> > > > >
> > > > > sqlmap:
> > > > >
> > > > > <procedure id="callStoredProcedure"
> > > > parameterClass="java.util.HashMap">
> > > > > {#value,mode=OUT# = call TestReturnValue}
> > > > > </procedure>
> > > > >
> > > > > call from java:
> > > > >
> > > > > public static Integer callStoredProcedure() {
> > > > > HashMap hm = new HashMap();
> > > > > hm.put("value", new Integer(-1));
> > > > > try {
> > > > > getInstance().update("callStoredProcedure",
> > > > hm);
> > > > > } catch (SQLException e) {
> > > > > e.printStackTrace();
> > > > > }
> > > > >
> > > > > Stored procedure:
> > > > > CREATE PROCEDURE [dbo].[TestReturnValue] AS
> > > > >
> > > > > UPDATE dbo.TEST
> > > > > SET USERID = USERID + 1
> > > > > WHERE USERNAME = 'test'
> > > > >
> > > > > RETURN -17
> > > > > GO
> > > > >
> > > > >
> > > > > The exception I got:
> > > > >
> > > > > " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The
> error
> > > > > occurred while executing update procedure. \n--- Check the {? =
> call
> > > > > TestReturnValue}. \n--- Check the output parameters (register
> output
> > > > > parameters failed). \n--- Cause: java.sql.SQLException:
> > > > > [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type
> is
> > > > > not supported by this driver."
> > > > >
> > > > > Having spent too much time on this issue, I have to give up If
> this
> > > > > "not supported by this driver" is the real cause. It's impossible
> to
> > > > > purssuade our DBA to use any JDBC drivers other than MS's.
> > > > >
> > > > >
> > > > > Regards
> > > > >
> > > > > Bing
> > > > >
> > > > > On 6/26/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > > Hi Bing,
> > > > > >
> > > > > > Yes, your syntax is correct.
> > > > > >
> > > > > > You should be able to do something like this:
> > > > > >
> > > > > > <procedure id="myProc" parameterClass="map" >
> > > > > > {#value,mode=OUT# = call procedure_name}
> > > > > > </procedure>
> > > > > >
> > > > > > I'll asume this is an update procedure, so no result class is
> needed.
> > > > > >
> > > > > > Notice the parameter class is a 'map", which means any instance
> of Map
> > > > (like
> > > > > > HashMap for example).
> > > > > >
> > > > > > It is important to use a mutable type for your parameter when
> using OUT
> > > > > > params. This is because OUT params are passed back in the
> parameter
> > > > object,
> > > > > > not as a result object.
> > > > > >
> > > > > > So at the end of this call:
> > > > > >
> > > > > > Map myParam = new HashMap();
> > > > > > myParam.put("value", 0); //default value
> > > > > > sqlMapClient.update("myProc", myParam);
> > > > > > myParam.get("value"); // value should be updated with OUT param.
> > > > > >
> > > > > > You can (and should) use a JavaBean as your parameter class
> instead of a
> > > > Map
> > > > > > if you like.
> > > > > >
> > > > > > Hope that helps,
> > > > > >
> > > > > > Clinton
> > > > > >
> > > > > >
> > > > > > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > > From sun JDBC documentation:
> > > > > > >
> > > > > > > The syntax for a procedure that returns a result parameter is:
> > > > > > >
> > > > > > > {? = call procedure_name[(?, ?, ...)]}
> > > > > > >
> > > > > > > Bing
> > > > > > >
> > > > > > > On 6/26/05, Larry Meadors < larry.meadors@gmail.com > wrote:
> > > > > > > > I am not sure I understand. Are you trying to call a
> procedure with
> > > > a
> > > > > > > > single OUT parameter?
> > > > > > > >
> > > > > > > > If so, the syntax should be:
> > > > > > > >
> > > > > > > > <procedure id="BlahOut" parameterMap="BlahParm"
> > > > > > > > resultClass="java.util.HashMap" >
> > > > > > > > { call blah(?) }
> > > > > > > > </procedure>
> > > > > > > >
> > > > > > > > and the parameter map should look like this:
> > > > > > > >
> > > > > > > > <parameterMap id="BlahParm" class=" java.util.Map">
> > > > > > > > <parameter property="a" mode="OUT" />
> > > > > > > > </parameterMap>
> > > > > > > >
> > > > > > > > Larry
> > > > > > > >
> > > > > > > > On 6/26/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > > Hi Clinton
> > > > > > > > >
> > > > > > > > > I tried something like this:
> > > > > > > > > {? = call procedure_name}
> > > > > > > > >
> > > > > > > > > The ? is defined as an out parameter mapped onto a member
> (String,
> > > > > > > > > int) of a HashMap object (I tried a javabean later as
> well) in the
> > > > > > > > > parameter map.
> > > > > > > > >
> > > > > > > > > I didn't succeed with that.
> > > > > > > > >
> > > > > > > > > I tried to use inline parameter map too:
> > > > > > > > > {#value:OUT# = call procedure_name}
> > > > > > > > > by passing an Integer as parameter to queryForObject or
> other
> > > > sqlmap
> > > > > > methods.
> > > > > > > > >
> > > > > > > > > It didn't work either.
> > > > > > > > >
> > > > > > > > > Could you please advice what I need to do?
> > > > > > > > >
> > > > > > > > > I'm new to java programming. I don't have much JDBC
> experience
> > > > > > > > > and sqlmap is the only database access tool I ever used in
> a
> > > > > > > > > production project which I inherited from other
> developers.
> > > > > > > > >
> > > > > > > > > I appreciate you help, thanks very much!
> > > > > > > > >
> > > > > > > > > On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > > > > > > Hi Bing,
> > > > > > > > > >
> > > > > > > > > > How do you get the return code using JDBC?
> > > > > > > > > >
> > > > > > > > > > Cheers,
> > > > > > > > > > Clinton
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On 6/23/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > > > > Help please!
> > > > > > > > > > >
> > > > > > > > > > > I have had several talks with our DBA who is so
> skeptical of
> > > > > > iBATIS
> > > > > > > > > > > and vow to force us to go back to jdbc. One of his
> arguments
> > > > is
> > > > > > that
> > > > > > > > > > > the return code from stored procedure can not be
> retrieved by
> > > > > > sqlmap.
> > > > > > > > > > >
> > > > > > > > > > > I tried all I could but no luck till now. Any help
> please!
> > > > > > > > > > >
> > > > > > > > > > > Thanks a lot!
> > > > > > > > > > >
> > > > > > > > > > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > > > > > > > Hi,
> > > > > > > > > > > >
> > > > > > > > > > > > What do I need to add to the sqlmap to get the
> return value
> > > > (for
> > > > > > > > > > > > example, return -9) of stored procedure?
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > Thanks very much!
> > > > > > > > > > > >
> > > > > > > > > > > > bqiao
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> >
>
Re: Get return value of stored procedure
Posted by Bing Qiao <qi...@gmail.com>.
I realized that too. Thanks.
BTW, the inline parameter format given by Clinton:
"{#value,mode=OUT,jdbcType=INTEGER# = call TestReturnValue}"
is not the same as that in the online document:
"insert into PRODUCT (PRD_ID, PRD_DESCRIPTION)
values (#id:NUMERIC#, #description:VARCHAR#);"
Where can I find the specification of the former one?
Many thanks!
Bing
On 6/27/05, Daniel Henrique Ferreira e Silva <dh...@gmail.com> wrote:
> Bing,
>
> You didn't have success using java.lang.Integer because it is
> immutable as is String class.
> Use, for that situation, mutable classes, like Clinton said, the Map
> implementations.
> Just read carefully Clinton's e-mails and you'll see that he had
> stated that previously.
>
> Hope that helped,
> Daniel Silva.
>
> On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > Dear Clinton,
> >
> > Really appreciate your help, especially after I finally got it right
> > from your last email.
> >
> > sqlmap (both inline and parameterMap worked):
> >
> > <sqlMap namespace="TestSqlMap">
> >
> > <parameterMap id="paraMap" class="">
> > <parameter property="value" jdbcType="INTEGER"
> > javaType="java.lang.Integer" mode="OUT"/>
> > </parameterMap>
> >
> > <procedure id="callStoredProcedureA" parameterMap="paraMap">
> > {? = call TestReturnValue}
> > </procedure>
> >
> > <procedure id="callStoredProcedureB" parameterClass="java.util.HashMap">
> > {#value,mode=OUT,jdbcType=INTEGER# = call TestReturnValue}
> > </procedure>
> >
> > </sqlMap>
> >
> > ///////////////////////////////
> > call from java:
> >
> > public static Integer callStoredProcedure() {
> > HashMap hm = new HashMap();
> > hm.put("value", new Integer(-1));
> > try {
> > getInstance().update("callStoredProcedureA", hm);
> > } catch (SQLException e) {
> > e.printStackTrace();
> > }
> >
> > return (Integer)hm.get("value");
> > }
> > ///////////////////////////
> > stored procedure:
> >
> > CREATE PROCEDURE [dbo].[TestReturnValue] AS
> >
> > UPDATE dbo.TEST
> > SET USERID = USERID + 1
> > WHERE USERNAME = 'test'
> >
> > DECLARE @rtn INT
> > SELECT @rtn = USERID FROM TEST WHERE USERNAME = 'test'
> >
> > RETURN @rtn
> > GO
> >
> > /////////////////////////
> >
> > Another question is: can I use java.lang.Integer directly as a
> > parameterClass instead of a Map?
> >
> > I tried this but failed:
> > sqlmap:
> > <procedure id="callStoredProcedureC" parameterClass="java.lang.Integer">
> > {#value,mode=OUT# = call TestReturnValue}
> > </procedure>
> > //////////////////////
> > call from java:
> > public static Integer callStoredProcedureC() {
> > Integer integer = new Integer(-1);
> > try {
> > getInstance().update("callStoredProcedureC", integer);
> > } catch (SQLException e) {
> > e.printStackTrace();
> > }
> >
> > return integer;
> > }
> > ///////////////////////
> > exception:
> > " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
> > occurred while executing update procedure. \n--- Check the {? = call
> > TestReturnValue}. \n--- Check the output parameters (register output
> > parameters failed). \n--- Cause: java.sql.SQLException:
> > [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
> > not supported by this driver."
> > ///////////////////////
> >
> > And what about the raiserror, is it possible to get the severity level
> > and state besides the error message or error code?
> >
> > Thanks again,
> >
> > Bing
> >
> >
> > On 6/27/05, Clinton Begin <cl...@gmail.com> wrote:
> > >
> > > Don't give up Bing!
> > >
> > > We'll get it eventually. That error actually might just be a result of me
> > > suggesting using a HashMap. Maps are not typed, so the driver is probably
> > > freaking because JDBC type in this case is being detected as simply
> > > "Object". You'll want to specify a JDBC type explicitly (like you would if
> > > it were JDBC)
> > >
> > > {#value,mode=OUT,jdbcType=NUMERIC# = call TestReturnValue}
> > >
> > > If NUMERIC doesn't work, try DECIMAL or INTEGER.
> > >
> > > Cheers,
> > >
> > > Clinton
> > >
> > > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > Hi Clinton
> > > >
> > > > Thanks for you help.
> > > >
> > > > Here is waht I did:
> > > >
> > > > sqlmap:
> > > >
> > > > <procedure id="callStoredProcedure"
> > > parameterClass="java.util.HashMap">
> > > > {#value,mode=OUT# = call TestReturnValue}
> > > > </procedure>
> > > >
> > > > call from java:
> > > >
> > > > public static Integer callStoredProcedure() {
> > > > HashMap hm = new HashMap();
> > > > hm.put("value", new Integer(-1));
> > > > try {
> > > > getInstance().update("callStoredProcedure",
> > > hm);
> > > > } catch (SQLException e) {
> > > > e.printStackTrace();
> > > > }
> > > >
> > > > Stored procedure:
> > > > CREATE PROCEDURE [dbo].[TestReturnValue] AS
> > > >
> > > > UPDATE dbo.TEST
> > > > SET USERID = USERID + 1
> > > > WHERE USERNAME = 'test'
> > > >
> > > > RETURN -17
> > > > GO
> > > >
> > > >
> > > > The exception I got:
> > > >
> > > > " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
> > > > occurred while executing update procedure. \n--- Check the {? = call
> > > > TestReturnValue}. \n--- Check the output parameters (register output
> > > > parameters failed). \n--- Cause: java.sql.SQLException:
> > > > [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
> > > > not supported by this driver."
> > > >
> > > > Having spent too much time on this issue, I have to give up If this
> > > > "not supported by this driver" is the real cause. It's impossible to
> > > > purssuade our DBA to use any JDBC drivers other than MS's.
> > > >
> > > >
> > > > Regards
> > > >
> > > > Bing
> > > >
> > > > On 6/26/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > Hi Bing,
> > > > >
> > > > > Yes, your syntax is correct.
> > > > >
> > > > > You should be able to do something like this:
> > > > >
> > > > > <procedure id="myProc" parameterClass="map" >
> > > > > {#value,mode=OUT# = call procedure_name}
> > > > > </procedure>
> > > > >
> > > > > I'll asume this is an update procedure, so no result class is needed.
> > > > >
> > > > > Notice the parameter class is a 'map", which means any instance of Map
> > > (like
> > > > > HashMap for example).
> > > > >
> > > > > It is important to use a mutable type for your parameter when using OUT
> > > > > params. This is because OUT params are passed back in the parameter
> > > object,
> > > > > not as a result object.
> > > > >
> > > > > So at the end of this call:
> > > > >
> > > > > Map myParam = new HashMap();
> > > > > myParam.put("value", 0); //default value
> > > > > sqlMapClient.update("myProc", myParam);
> > > > > myParam.get("value"); // value should be updated with OUT param.
> > > > >
> > > > > You can (and should) use a JavaBean as your parameter class instead of a
> > > Map
> > > > > if you like.
> > > > >
> > > > > Hope that helps,
> > > > >
> > > > > Clinton
> > > > >
> > > > >
> > > > > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > From sun JDBC documentation:
> > > > > >
> > > > > > The syntax for a procedure that returns a result parameter is:
> > > > > >
> > > > > > {? = call procedure_name[(?, ?, ...)]}
> > > > > >
> > > > > > Bing
> > > > > >
> > > > > > On 6/26/05, Larry Meadors < larry.meadors@gmail.com > wrote:
> > > > > > > I am not sure I understand. Are you trying to call a procedure with
> > > a
> > > > > > > single OUT parameter?
> > > > > > >
> > > > > > > If so, the syntax should be:
> > > > > > >
> > > > > > > <procedure id="BlahOut" parameterMap="BlahParm"
> > > > > > > resultClass="java.util.HashMap" >
> > > > > > > { call blah(?) }
> > > > > > > </procedure>
> > > > > > >
> > > > > > > and the parameter map should look like this:
> > > > > > >
> > > > > > > <parameterMap id="BlahParm" class=" java.util.Map">
> > > > > > > <parameter property="a" mode="OUT" />
> > > > > > > </parameterMap>
> > > > > > >
> > > > > > > Larry
> > > > > > >
> > > > > > > On 6/26/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > Hi Clinton
> > > > > > > >
> > > > > > > > I tried something like this:
> > > > > > > > {? = call procedure_name}
> > > > > > > >
> > > > > > > > The ? is defined as an out parameter mapped onto a member (String,
> > > > > > > > int) of a HashMap object (I tried a javabean later as well) in the
> > > > > > > > parameter map.
> > > > > > > >
> > > > > > > > I didn't succeed with that.
> > > > > > > >
> > > > > > > > I tried to use inline parameter map too:
> > > > > > > > {#value:OUT# = call procedure_name}
> > > > > > > > by passing an Integer as parameter to queryForObject or other
> > > sqlmap
> > > > > methods.
> > > > > > > >
> > > > > > > > It didn't work either.
> > > > > > > >
> > > > > > > > Could you please advice what I need to do?
> > > > > > > >
> > > > > > > > I'm new to java programming. I don't have much JDBC experience
> > > > > > > > and sqlmap is the only database access tool I ever used in a
> > > > > > > > production project which I inherited from other developers.
> > > > > > > >
> > > > > > > > I appreciate you help, thanks very much!
> > > > > > > >
> > > > > > > > On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > > > > > Hi Bing,
> > > > > > > > >
> > > > > > > > > How do you get the return code using JDBC?
> > > > > > > > >
> > > > > > > > > Cheers,
> > > > > > > > > Clinton
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On 6/23/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > > > Help please!
> > > > > > > > > >
> > > > > > > > > > I have had several talks with our DBA who is so skeptical of
> > > > > iBATIS
> > > > > > > > > > and vow to force us to go back to jdbc. One of his arguments
> > > is
> > > > > that
> > > > > > > > > > the return code from stored procedure can not be retrieved by
> > > > > sqlmap.
> > > > > > > > > >
> > > > > > > > > > I tried all I could but no luck till now. Any help please!
> > > > > > > > > >
> > > > > > > > > > Thanks a lot!
> > > > > > > > > >
> > > > > > > > > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > > > > > > Hi,
> > > > > > > > > > >
> > > > > > > > > > > What do I need to add to the sqlmap to get the return value
> > > (for
> > > > > > > > > > > example, return -9) of stored procedure?
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > Thanks very much!
> > > > > > > > > > >
> > > > > > > > > > > bqiao
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Re: Get return value of stored procedure
Posted by Daniel Henrique Ferreira e Silva <dh...@gmail.com>.
Bing,
You didn't have success using java.lang.Integer because it is
immutable as is String class.
Use, for that situation, mutable classes, like Clinton said, the Map
implementations.
Just read carefully Clinton's e-mails and you'll see that he had
stated that previously.
Hope that helped,
Daniel Silva.
On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> Dear Clinton,
>
> Really appreciate your help, especially after I finally got it right
> from your last email.
>
> sqlmap (both inline and parameterMap worked):
>
> <sqlMap namespace="TestSqlMap">
>
> <parameterMap id="paraMap" class="">
> <parameter property="value" jdbcType="INTEGER"
> javaType="java.lang.Integer" mode="OUT"/>
> </parameterMap>
>
> <procedure id="callStoredProcedureA" parameterMap="paraMap">
> {? = call TestReturnValue}
> </procedure>
>
> <procedure id="callStoredProcedureB" parameterClass="java.util.HashMap">
> {#value,mode=OUT,jdbcType=INTEGER# = call TestReturnValue}
> </procedure>
>
> </sqlMap>
>
> ///////////////////////////////
> call from java:
>
> public static Integer callStoredProcedure() {
> HashMap hm = new HashMap();
> hm.put("value", new Integer(-1));
> try {
> getInstance().update("callStoredProcedureA", hm);
> } catch (SQLException e) {
> e.printStackTrace();
> }
>
> return (Integer)hm.get("value");
> }
> ///////////////////////////
> stored procedure:
>
> CREATE PROCEDURE [dbo].[TestReturnValue] AS
>
> UPDATE dbo.TEST
> SET USERID = USERID + 1
> WHERE USERNAME = 'test'
>
> DECLARE @rtn INT
> SELECT @rtn = USERID FROM TEST WHERE USERNAME = 'test'
>
> RETURN @rtn
> GO
>
> /////////////////////////
>
> Another question is: can I use java.lang.Integer directly as a
> parameterClass instead of a Map?
>
> I tried this but failed:
> sqlmap:
> <procedure id="callStoredProcedureC" parameterClass="java.lang.Integer">
> {#value,mode=OUT# = call TestReturnValue}
> </procedure>
> //////////////////////
> call from java:
> public static Integer callStoredProcedureC() {
> Integer integer = new Integer(-1);
> try {
> getInstance().update("callStoredProcedureC", integer);
> } catch (SQLException e) {
> e.printStackTrace();
> }
>
> return integer;
> }
> ///////////////////////
> exception:
> " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
> occurred while executing update procedure. \n--- Check the {? = call
> TestReturnValue}. \n--- Check the output parameters (register output
> parameters failed). \n--- Cause: java.sql.SQLException:
> [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
> not supported by this driver."
> ///////////////////////
>
> And what about the raiserror, is it possible to get the severity level
> and state besides the error message or error code?
>
> Thanks again,
>
> Bing
>
>
> On 6/27/05, Clinton Begin <cl...@gmail.com> wrote:
> >
> > Don't give up Bing!
> >
> > We'll get it eventually. That error actually might just be a result of me
> > suggesting using a HashMap. Maps are not typed, so the driver is probably
> > freaking because JDBC type in this case is being detected as simply
> > "Object". You'll want to specify a JDBC type explicitly (like you would if
> > it were JDBC)
> >
> > {#value,mode=OUT,jdbcType=NUMERIC# = call TestReturnValue}
> >
> > If NUMERIC doesn't work, try DECIMAL or INTEGER.
> >
> > Cheers,
> >
> > Clinton
> >
> > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > Hi Clinton
> > >
> > > Thanks for you help.
> > >
> > > Here is waht I did:
> > >
> > > sqlmap:
> > >
> > > <procedure id="callStoredProcedure"
> > parameterClass="java.util.HashMap">
> > > {#value,mode=OUT# = call TestReturnValue}
> > > </procedure>
> > >
> > > call from java:
> > >
> > > public static Integer callStoredProcedure() {
> > > HashMap hm = new HashMap();
> > > hm.put("value", new Integer(-1));
> > > try {
> > > getInstance().update("callStoredProcedure",
> > hm);
> > > } catch (SQLException e) {
> > > e.printStackTrace();
> > > }
> > >
> > > Stored procedure:
> > > CREATE PROCEDURE [dbo].[TestReturnValue] AS
> > >
> > > UPDATE dbo.TEST
> > > SET USERID = USERID + 1
> > > WHERE USERNAME = 'test'
> > >
> > > RETURN -17
> > > GO
> > >
> > >
> > > The exception I got:
> > >
> > > " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
> > > occurred while executing update procedure. \n--- Check the {? = call
> > > TestReturnValue}. \n--- Check the output parameters (register output
> > > parameters failed). \n--- Cause: java.sql.SQLException:
> > > [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
> > > not supported by this driver."
> > >
> > > Having spent too much time on this issue, I have to give up If this
> > > "not supported by this driver" is the real cause. It's impossible to
> > > purssuade our DBA to use any JDBC drivers other than MS's.
> > >
> > >
> > > Regards
> > >
> > > Bing
> > >
> > > On 6/26/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > Hi Bing,
> > > >
> > > > Yes, your syntax is correct.
> > > >
> > > > You should be able to do something like this:
> > > >
> > > > <procedure id="myProc" parameterClass="map" >
> > > > {#value,mode=OUT# = call procedure_name}
> > > > </procedure>
> > > >
> > > > I'll asume this is an update procedure, so no result class is needed.
> > > >
> > > > Notice the parameter class is a 'map", which means any instance of Map
> > (like
> > > > HashMap for example).
> > > >
> > > > It is important to use a mutable type for your parameter when using OUT
> > > > params. This is because OUT params are passed back in the parameter
> > object,
> > > > not as a result object.
> > > >
> > > > So at the end of this call:
> > > >
> > > > Map myParam = new HashMap();
> > > > myParam.put("value", 0); //default value
> > > > sqlMapClient.update("myProc", myParam);
> > > > myParam.get("value"); // value should be updated with OUT param.
> > > >
> > > > You can (and should) use a JavaBean as your parameter class instead of a
> > Map
> > > > if you like.
> > > >
> > > > Hope that helps,
> > > >
> > > > Clinton
> > > >
> > > >
> > > > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > From sun JDBC documentation:
> > > > >
> > > > > The syntax for a procedure that returns a result parameter is:
> > > > >
> > > > > {? = call procedure_name[(?, ?, ...)]}
> > > > >
> > > > > Bing
> > > > >
> > > > > On 6/26/05, Larry Meadors < larry.meadors@gmail.com > wrote:
> > > > > > I am not sure I understand. Are you trying to call a procedure with
> > a
> > > > > > single OUT parameter?
> > > > > >
> > > > > > If so, the syntax should be:
> > > > > >
> > > > > > <procedure id="BlahOut" parameterMap="BlahParm"
> > > > > > resultClass="java.util.HashMap" >
> > > > > > { call blah(?) }
> > > > > > </procedure>
> > > > > >
> > > > > > and the parameter map should look like this:
> > > > > >
> > > > > > <parameterMap id="BlahParm" class=" java.util.Map">
> > > > > > <parameter property="a" mode="OUT" />
> > > > > > </parameterMap>
> > > > > >
> > > > > > Larry
> > > > > >
> > > > > > On 6/26/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > Hi Clinton
> > > > > > >
> > > > > > > I tried something like this:
> > > > > > > {? = call procedure_name}
> > > > > > >
> > > > > > > The ? is defined as an out parameter mapped onto a member (String,
> > > > > > > int) of a HashMap object (I tried a javabean later as well) in the
> > > > > > > parameter map.
> > > > > > >
> > > > > > > I didn't succeed with that.
> > > > > > >
> > > > > > > I tried to use inline parameter map too:
> > > > > > > {#value:OUT# = call procedure_name}
> > > > > > > by passing an Integer as parameter to queryForObject or other
> > sqlmap
> > > > methods.
> > > > > > >
> > > > > > > It didn't work either.
> > > > > > >
> > > > > > > Could you please advice what I need to do?
> > > > > > >
> > > > > > > I'm new to java programming. I don't have much JDBC experience
> > > > > > > and sqlmap is the only database access tool I ever used in a
> > > > > > > production project which I inherited from other developers.
> > > > > > >
> > > > > > > I appreciate you help, thanks very much!
> > > > > > >
> > > > > > > On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > > > > Hi Bing,
> > > > > > > >
> > > > > > > > How do you get the return code using JDBC?
> > > > > > > >
> > > > > > > > Cheers,
> > > > > > > > Clinton
> > > > > > > >
> > > > > > > >
> > > > > > > > On 6/23/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > > Help please!
> > > > > > > > >
> > > > > > > > > I have had several talks with our DBA who is so skeptical of
> > > > iBATIS
> > > > > > > > > and vow to force us to go back to jdbc. One of his arguments
> > is
> > > > that
> > > > > > > > > the return code from stored procedure can not be retrieved by
> > > > sqlmap.
> > > > > > > > >
> > > > > > > > > I tried all I could but no luck till now. Any help please!
> > > > > > > > >
> > > > > > > > > Thanks a lot!
> > > > > > > > >
> > > > > > > > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > What do I need to add to the sqlmap to get the return value
> > (for
> > > > > > > > > > example, return -9) of stored procedure?
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Thanks very much!
> > > > > > > > > >
> > > > > > > > > > bqiao
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
Re: Get return value of stored procedure
Posted by Bing Qiao <qi...@gmail.com>.
Dear Clinton,
Really appreciate your help, especially after I finally got it right
from your last email.
sqlmap (both inline and parameterMap worked):
<sqlMap namespace="TestSqlMap">
<parameterMap id="paraMap" class="">
<parameter property="value" jdbcType="INTEGER"
javaType="java.lang.Integer" mode="OUT"/>
</parameterMap>
<procedure id="callStoredProcedureA" parameterMap="paraMap">
{? = call TestReturnValue}
</procedure>
<procedure id="callStoredProcedureB" parameterClass="java.util.HashMap">
{#value,mode=OUT,jdbcType=INTEGER# = call TestReturnValue}
</procedure>
</sqlMap>
///////////////////////////////
call from java:
public static Integer callStoredProcedure() {
HashMap hm = new HashMap();
hm.put("value", new Integer(-1));
try {
getInstance().update("callStoredProcedureA", hm);
} catch (SQLException e) {
e.printStackTrace();
}
return (Integer)hm.get("value");
}
///////////////////////////
stored procedure:
CREATE PROCEDURE [dbo].[TestReturnValue] AS
UPDATE dbo.TEST
SET USERID = USERID + 1
WHERE USERNAME = 'test'
DECLARE @rtn INT
SELECT @rtn = USERID FROM TEST WHERE USERNAME = 'test'
RETURN @rtn
GO
/////////////////////////
Another question is: can I use java.lang.Integer directly as a
parameterClass instead of a Map?
I tried this but failed:
sqlmap:
<procedure id="callStoredProcedureC" parameterClass="java.lang.Integer">
{#value,mode=OUT# = call TestReturnValue}
</procedure>
//////////////////////
call from java:
public static Integer callStoredProcedureC() {
Integer integer = new Integer(-1);
try {
getInstance().update("callStoredProcedureC", integer);
} catch (SQLException e) {
e.printStackTrace();
}
return integer;
}
///////////////////////
exception:
" \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
occurred while executing update procedure. \n--- Check the {? = call
TestReturnValue}. \n--- Check the output parameters (register output
parameters failed). \n--- Cause: java.sql.SQLException:
[Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
not supported by this driver."
///////////////////////
And what about the raiserror, is it possible to get the severity level
and state besides the error message or error code?
Thanks again,
Bing
On 6/27/05, Clinton Begin <cl...@gmail.com> wrote:
>
> Don't give up Bing!
>
> We'll get it eventually. That error actually might just be a result of me
> suggesting using a HashMap. Maps are not typed, so the driver is probably
> freaking because JDBC type in this case is being detected as simply
> "Object". You'll want to specify a JDBC type explicitly (like you would if
> it were JDBC)
>
> {#value,mode=OUT,jdbcType=NUMERIC# = call TestReturnValue}
>
> If NUMERIC doesn't work, try DECIMAL or INTEGER.
>
> Cheers,
>
> Clinton
>
> On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > Hi Clinton
> >
> > Thanks for you help.
> >
> > Here is waht I did:
> >
> > sqlmap:
> >
> > <procedure id="callStoredProcedure"
> parameterClass="java.util.HashMap">
> > {#value,mode=OUT# = call TestReturnValue}
> > </procedure>
> >
> > call from java:
> >
> > public static Integer callStoredProcedure() {
> > HashMap hm = new HashMap();
> > hm.put("value", new Integer(-1));
> > try {
> > getInstance().update("callStoredProcedure",
> hm);
> > } catch (SQLException e) {
> > e.printStackTrace();
> > }
> >
> > Stored procedure:
> > CREATE PROCEDURE [dbo].[TestReturnValue] AS
> >
> > UPDATE dbo.TEST
> > SET USERID = USERID + 1
> > WHERE USERNAME = 'test'
> >
> > RETURN -17
> > GO
> >
> >
> > The exception I got:
> >
> > " \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
> > occurred while executing update procedure. \n--- Check the {? = call
> > TestReturnValue}. \n--- Check the output parameters (register output
> > parameters failed). \n--- Cause: java.sql.SQLException:
> > [Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
> > not supported by this driver."
> >
> > Having spent too much time on this issue, I have to give up If this
> > "not supported by this driver" is the real cause. It's impossible to
> > purssuade our DBA to use any JDBC drivers other than MS's.
> >
> >
> > Regards
> >
> > Bing
> >
> > On 6/26/05, Clinton Begin <cl...@gmail.com> wrote:
> > > Hi Bing,
> > >
> > > Yes, your syntax is correct.
> > >
> > > You should be able to do something like this:
> > >
> > > <procedure id="myProc" parameterClass="map" >
> > > {#value,mode=OUT# = call procedure_name}
> > > </procedure>
> > >
> > > I'll asume this is an update procedure, so no result class is needed.
> > >
> > > Notice the parameter class is a 'map", which means any instance of Map
> (like
> > > HashMap for example).
> > >
> > > It is important to use a mutable type for your parameter when using OUT
> > > params. This is because OUT params are passed back in the parameter
> object,
> > > not as a result object.
> > >
> > > So at the end of this call:
> > >
> > > Map myParam = new HashMap();
> > > myParam.put("value", 0); //default value
> > > sqlMapClient.update("myProc", myParam);
> > > myParam.get("value"); // value should be updated with OUT param.
> > >
> > > You can (and should) use a JavaBean as your parameter class instead of a
> Map
> > > if you like.
> > >
> > > Hope that helps,
> > >
> > > Clinton
> > >
> > >
> > > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > From sun JDBC documentation:
> > > >
> > > > The syntax for a procedure that returns a result parameter is:
> > > >
> > > > {? = call procedure_name[(?, ?, ...)]}
> > > >
> > > > Bing
> > > >
> > > > On 6/26/05, Larry Meadors < larry.meadors@gmail.com > wrote:
> > > > > I am not sure I understand. Are you trying to call a procedure with
> a
> > > > > single OUT parameter?
> > > > >
> > > > > If so, the syntax should be:
> > > > >
> > > > > <procedure id="BlahOut" parameterMap="BlahParm"
> > > > > resultClass="java.util.HashMap" >
> > > > > { call blah(?) }
> > > > > </procedure>
> > > > >
> > > > > and the parameter map should look like this:
> > > > >
> > > > > <parameterMap id="BlahParm" class=" java.util.Map">
> > > > > <parameter property="a" mode="OUT" />
> > > > > </parameterMap>
> > > > >
> > > > > Larry
> > > > >
> > > > > On 6/26/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > Hi Clinton
> > > > > >
> > > > > > I tried something like this:
> > > > > > {? = call procedure_name}
> > > > > >
> > > > > > The ? is defined as an out parameter mapped onto a member (String,
> > > > > > int) of a HashMap object (I tried a javabean later as well) in the
> > > > > > parameter map.
> > > > > >
> > > > > > I didn't succeed with that.
> > > > > >
> > > > > > I tried to use inline parameter map too:
> > > > > > {#value:OUT# = call procedure_name}
> > > > > > by passing an Integer as parameter to queryForObject or other
> sqlmap
> > > methods.
> > > > > >
> > > > > > It didn't work either.
> > > > > >
> > > > > > Could you please advice what I need to do?
> > > > > >
> > > > > > I'm new to java programming. I don't have much JDBC experience
> > > > > > and sqlmap is the only database access tool I ever used in a
> > > > > > production project which I inherited from other developers.
> > > > > >
> > > > > > I appreciate you help, thanks very much!
> > > > > >
> > > > > > On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > > > Hi Bing,
> > > > > > >
> > > > > > > How do you get the return code using JDBC?
> > > > > > >
> > > > > > > Cheers,
> > > > > > > Clinton
> > > > > > >
> > > > > > >
> > > > > > > On 6/23/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > > > Help please!
> > > > > > > >
> > > > > > > > I have had several talks with our DBA who is so skeptical of
> > > iBATIS
> > > > > > > > and vow to force us to go back to jdbc. One of his arguments
> is
> > > that
> > > > > > > > the return code from stored procedure can not be retrieved by
> > > sqlmap.
> > > > > > > >
> > > > > > > > I tried all I could but no luck till now. Any help please!
> > > > > > > >
> > > > > > > > Thanks a lot!
> > > > > > > >
> > > > > > > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > What do I need to add to the sqlmap to get the return value
> (for
> > > > > > > > > example, return -9) of stored procedure?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Thanks very much!
> > > > > > > > >
> > > > > > > > > bqiao
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Get return value of stored procedure
Posted by Bing Qiao <qi...@gmail.com>.
Hi Clinton
Thanks for you help.
Here is waht I did:
sqlmap:
<procedure id="callStoredProcedure" parameterClass="java.util.HashMap">
{#value,mode=OUT# = call TestReturnValue}
</procedure>
call from java:
public static Integer callStoredProcedure() {
HashMap hm = new HashMap();
hm.put("value", new Integer(-1));
try {
getInstance().update("callStoredProcedure", hm);
} catch (SQLException e) {
e.printStackTrace();
}
Stored procedure:
CREATE PROCEDURE [dbo].[TestReturnValue] AS
UPDATE dbo.TEST
SET USERID = USERID + 1
WHERE USERNAME = 'test'
RETURN -17
GO
The exception I got:
" \n--- The error occurred in SqlMap/TestSqlMap.xml. \n--- The error
occurred while executing update procedure. \n--- Check the {? = call
TestReturnValue}. \n--- Check the output parameters (register output
parameters failed). \n--- Cause: java.sql.SQLException:
[Microsoft][SQLServer 2000 Driver for JDBC]The specified SQL type is
not supported by this driver."
Having spent too much time on this issue, I have to give up If this
"not supported by this driver" is the real cause. It's impossible to
purssuade our DBA to use any JDBC drivers other than MS's.
Regards
Bing
On 6/26/05, Clinton Begin <cl...@gmail.com> wrote:
> Hi Bing,
>
> Yes, your syntax is correct.
>
> You should be able to do something like this:
>
> <procedure id="myProc" parameterClass="map" >
> {#value,mode=OUT# = call procedure_name}
> </procedure>
>
> I'll asume this is an update procedure, so no result class is needed.
>
> Notice the parameter class is a 'map", which means any instance of Map (like
> HashMap for example).
>
> It is important to use a mutable type for your parameter when using OUT
> params. This is because OUT params are passed back in the parameter object,
> not as a result object.
>
> So at the end of this call:
>
> Map myParam = new HashMap();
> myParam.put("value", 0); //default value
> sqlMapClient.update("myProc", myParam);
> myParam.get("value"); // value should be updated with OUT param.
>
> You can (and should) use a JavaBean as your parameter class instead of a Map
> if you like.
>
> Hope that helps,
>
> Clinton
>
>
> On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > From sun JDBC documentation:
> >
> > The syntax for a procedure that returns a result parameter is:
> >
> > {? = call procedure_name[(?, ?, ...)]}
> >
> > Bing
> >
> > On 6/26/05, Larry Meadors < larry.meadors@gmail.com> wrote:
> > > I am not sure I understand. Are you trying to call a procedure with a
> > > single OUT parameter?
> > >
> > > If so, the syntax should be:
> > >
> > > <procedure id="BlahOut" parameterMap="BlahParm"
> > > resultClass="java.util.HashMap" >
> > > { call blah(?) }
> > > </procedure>
> > >
> > > and the parameter map should look like this:
> > >
> > > <parameterMap id="BlahParm" class=" java.util.Map">
> > > <parameter property="a" mode="OUT" />
> > > </parameterMap>
> > >
> > > Larry
> > >
> > > On 6/26/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > Hi Clinton
> > > >
> > > > I tried something like this:
> > > > {? = call procedure_name}
> > > >
> > > > The ? is defined as an out parameter mapped onto a member (String,
> > > > int) of a HashMap object (I tried a javabean later as well) in the
> > > > parameter map.
> > > >
> > > > I didn't succeed with that.
> > > >
> > > > I tried to use inline parameter map too:
> > > > {#value:OUT# = call procedure_name}
> > > > by passing an Integer as parameter to queryForObject or other sqlmap
> methods.
> > > >
> > > > It didn't work either.
> > > >
> > > > Could you please advice what I need to do?
> > > >
> > > > I'm new to java programming. I don't have much JDBC experience
> > > > and sqlmap is the only database access tool I ever used in a
> > > > production project which I inherited from other developers.
> > > >
> > > > I appreciate you help, thanks very much!
> > > >
> > > > On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > > Hi Bing,
> > > > >
> > > > > How do you get the return code using JDBC?
> > > > >
> > > > > Cheers,
> > > > > Clinton
> > > > >
> > > > >
> > > > > On 6/23/05, Bing Qiao < qiaobing@gmail.com> wrote:
> > > > > > Help please!
> > > > > >
> > > > > > I have had several talks with our DBA who is so skeptical of
> iBATIS
> > > > > > and vow to force us to go back to jdbc. One of his arguments is
> that
> > > > > > the return code from stored procedure can not be retrieved by
> sqlmap.
> > > > > >
> > > > > > I tried all I could but no luck till now. Any help please!
> > > > > >
> > > > > > Thanks a lot!
> > > > > >
> > > > > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > What do I need to add to the sqlmap to get the return value (for
> > > > > > > example, return -9) of stored procedure?
> > > > > > >
> > > > > > >
> > > > > > > Thanks very much!
> > > > > > >
> > > > > > > bqiao
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
>
Re: Get return value of stored procedure
Posted by Clinton Begin <cl...@gmail.com>.
Hi Bing,
Yes, your syntax is correct.
You should be able to do something like this:
<procedure id="myProc" parameterClass="map" >
{#value,mode=OUT# = call procedure_name}
</procedure>
I'll asume this is an update procedure, so no result class is needed.
Notice the parameter class is a 'map", which means any instance of Map (like
HashMap for example).
It is important to use a mutable type for your parameter when using OUT
params. This is because OUT params are passed back in the parameter object,
not as a result object.
So at the end of this call:
Map myParam = new HashMap();
myParam.put("value", 0); //default value
sqlMapClient.update("myProc", myParam);
myParam.get("value"); // value should be updated with OUT param.
You can (and should) use a JavaBean as your parameter class instead of a Map
if you like.
Hope that helps,
Clinton
On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
>
> From sun JDBC documentation:
>
> The syntax for a procedure that returns a result parameter is:
>
> {? = call procedure_name[(?, ?, ...)]}
>
> Bing
>
> On 6/26/05, Larry Meadors <la...@gmail.com> wrote:
> > I am not sure I understand. Are you trying to call a procedure with a
> > single OUT parameter?
> >
> > If so, the syntax should be:
> >
> > <procedure id="BlahOut" parameterMap="BlahParm"
> > resultClass="java.util.HashMap" >
> > { call blah(?) }
> > </procedure>
> >
> > and the parameter map should look like this:
> >
> > <parameterMap id="BlahParm" class="java.util.Map">
> > <parameter property="a" mode="OUT" />
> > </parameterMap>
> >
> > Larry
> >
> > On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > > Hi Clinton
> > >
> > > I tried something like this:
> > > {? = call procedure_name}
> > >
> > > The ? is defined as an out parameter mapped onto a member (String,
> > > int) of a HashMap object (I tried a javabean later as well) in the
> > > parameter map.
> > >
> > > I didn't succeed with that.
> > >
> > > I tried to use inline parameter map too:
> > > {#value:OUT# = call procedure_name}
> > > by passing an Integer as parameter to queryForObject or other sqlmap
> methods.
> > >
> > > It didn't work either.
> > >
> > > Could you please advice what I need to do?
> > >
> > > I'm new to java programming. I don't have much JDBC experience
> > > and sqlmap is the only database access tool I ever used in a
> > > production project which I inherited from other developers.
> > >
> > > I appreciate you help, thanks very much!
> > >
> > > On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > > > Hi Bing,
> > > >
> > > > How do you get the return code using JDBC?
> > > >
> > > > Cheers,
> > > > Clinton
> > > >
> > > >
> > > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > Help please!
> > > > >
> > > > > I have had several talks with our DBA who is so skeptical of
> iBATIS
> > > > > and vow to force us to go back to jdbc. One of his arguments is
> that
> > > > > the return code from stored procedure can not be retrieved by
> sqlmap.
> > > > >
> > > > > I tried all I could but no luck till now. Any help please!
> > > > >
> > > > > Thanks a lot!
> > > > >
> > > > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > > Hi,
> > > > > >
> > > > > > What do I need to add to the sqlmap to get the return value (for
> > > > > > example, return -9) of stored procedure?
> > > > > >
> > > > > >
> > > > > > Thanks very much!
> > > > > >
> > > > > > bqiao
> > > > > >
> > > > >
> > > >
> > > >
> > >
> >
>
Re: Get return value of stored procedure
Posted by Bing Qiao <qi...@gmail.com>.
>From sun JDBC documentation:
The syntax for a procedure that returns a result parameter is:
{? = call procedure_name[(?, ?, ...)]}
Bing
On 6/26/05, Larry Meadors <la...@gmail.com> wrote:
> I am not sure I understand. Are you trying to call a procedure with a
> single OUT parameter?
>
> If so, the syntax should be:
>
> <procedure id="BlahOut" parameterMap="BlahParm"
> resultClass="java.util.HashMap" >
> { call blah(?) }
> </procedure>
>
> and the parameter map should look like this:
>
> <parameterMap id="BlahParm" class="java.util.Map">
> <parameter property="a" mode="OUT" />
> </parameterMap>
>
> Larry
>
> On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> > Hi Clinton
> >
> > I tried something like this:
> > {? = call procedure_name}
> >
> > The ? is defined as an out parameter mapped onto a member (String,
> > int) of a HashMap object (I tried a javabean later as well) in the
> > parameter map.
> >
> > I didn't succeed with that.
> >
> > I tried to use inline parameter map too:
> > {#value:OUT# = call procedure_name}
> > by passing an Integer as parameter to queryForObject or other sqlmap methods.
> >
> > It didn't work either.
> >
> > Could you please advice what I need to do?
> >
> > I'm new to java programming. I don't have much JDBC experience
> > and sqlmap is the only database access tool I ever used in a
> > production project which I inherited from other developers.
> >
> > I appreciate you help, thanks very much!
> >
> > On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > > Hi Bing,
> > >
> > > How do you get the return code using JDBC?
> > >
> > > Cheers,
> > > Clinton
> > >
> > >
> > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > Help please!
> > > >
> > > > I have had several talks with our DBA who is so skeptical of iBATIS
> > > > and vow to force us to go back to jdbc. One of his arguments is that
> > > > the return code from stored procedure can not be retrieved by sqlmap.
> > > >
> > > > I tried all I could but no luck till now. Any help please!
> > > >
> > > > Thanks a lot!
> > > >
> > > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > > Hi,
> > > > >
> > > > > What do I need to add to the sqlmap to get the return value (for
> > > > > example, return -9) of stored procedure?
> > > > >
> > > > >
> > > > > Thanks very much!
> > > > >
> > > > > bqiao
> > > > >
> > > >
> > >
> > >
> >
>
Re: Get return value of stored procedure
Posted by Larry Meadors <la...@gmail.com>.
I am not sure I understand. Are you trying to call a procedure with a
single OUT parameter?
If so, the syntax should be:
<procedure id="BlahOut" parameterMap="BlahParm"
resultClass="java.util.HashMap" >
{ call blah(?) }
</procedure>
and the parameter map should look like this:
<parameterMap id="BlahParm" class="java.util.Map">
<parameter property="a" mode="OUT" />
</parameterMap>
Larry
On 6/26/05, Bing Qiao <qi...@gmail.com> wrote:
> Hi Clinton
>
> I tried something like this:
> {? = call procedure_name}
>
> The ? is defined as an out parameter mapped onto a member (String,
> int) of a HashMap object (I tried a javabean later as well) in the
> parameter map.
>
> I didn't succeed with that.
>
> I tried to use inline parameter map too:
> {#value:OUT# = call procedure_name}
> by passing an Integer as parameter to queryForObject or other sqlmap methods.
>
> It didn't work either.
>
> Could you please advice what I need to do?
>
> I'm new to java programming. I don't have much JDBC experience
> and sqlmap is the only database access tool I ever used in a
> production project which I inherited from other developers.
>
> I appreciate you help, thanks very much!
>
> On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> > Hi Bing,
> >
> > How do you get the return code using JDBC?
> >
> > Cheers,
> > Clinton
> >
> >
> > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > Help please!
> > >
> > > I have had several talks with our DBA who is so skeptical of iBATIS
> > > and vow to force us to go back to jdbc. One of his arguments is that
> > > the return code from stored procedure can not be retrieved by sqlmap.
> > >
> > > I tried all I could but no luck till now. Any help please!
> > >
> > > Thanks a lot!
> > >
> > > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > What do I need to add to the sqlmap to get the return value (for
> > > > example, return -9) of stored procedure?
> > > >
> > > >
> > > > Thanks very much!
> > > >
> > > > bqiao
> > > >
> > >
> >
> >
>
Re: Get return value of stored procedure
Posted by Bing Qiao <qi...@gmail.com>.
Hi Clinton
I tried something like this:
{? = call procedure_name}
The ? is defined as an out parameter mapped onto a member (String,
int) of a HashMap object (I tried a javabean later as well) in the
parameter map.
I didn't succeed with that.
I tried to use inline parameter map too:
{#value:OUT# = call procedure_name}
by passing an Integer as parameter to queryForObject or other sqlmap methods.
It didn't work either.
Could you please advice what I need to do?
I'm new to java programming. I don't have much JDBC experience
and sqlmap is the only database access tool I ever used in a
production project which I inherited from other developers.
I appreciate you help, thanks very much!
On 6/25/05, Clinton Begin <cl...@gmail.com> wrote:
> Hi Bing,
>
> How do you get the return code using JDBC?
>
> Cheers,
> Clinton
>
>
> On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > Help please!
> >
> > I have had several talks with our DBA who is so skeptical of iBATIS
> > and vow to force us to go back to jdbc. One of his arguments is that
> > the return code from stored procedure can not be retrieved by sqlmap.
> >
> > I tried all I could but no luck till now. Any help please!
> >
> > Thanks a lot!
> >
> > On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > > Hi,
> > >
> > > What do I need to add to the sqlmap to get the return value (for
> > > example, return -9) of stored procedure?
> > >
> > >
> > > Thanks very much!
> > >
> > > bqiao
> > >
> >
>
>
Re: Get return value of stored procedure
Posted by Clinton Begin <cl...@gmail.com>.
Hi Bing,
How do you get the return code using JDBC?
Cheers,
Clinton
On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
>
> Help please!
>
> I have had several talks with our DBA who is so skeptical of iBATIS
> and vow to force us to go back to jdbc. One of his arguments is that
> the return code from stored procedure can not be retrieved by sqlmap.
>
> I tried all I could but no luck till now. Any help please!
>
> Thanks a lot!
>
> On 6/23/05, Bing Qiao <qi...@gmail.com> wrote:
> > Hi,
> >
> > What do I need to add to the sqlmap to get the return value (for
> > example, return -9) of stored procedure?
> >
> >
> > Thanks very much!
> >
> > bqiao
> >
>