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 Nathan Maves <Na...@Sun.COM> on 2005/01/05 20:24:53 UTC

oracle sequence trouble

I jest created this sequence today and I works fine from the command 
line but it returns null from ibatis.  Are there any tricks when using 
sequences?

Here are the logs...

DEBUG 01-05 12:21:56 Checked out connection 10110166 from pool.  
(SimpleDataSource.java:563)
DEBUG 01-05 12:21:56 {conn-100087} Connection  
(ConnectionLogProxy.java:42)
DEBUG 01-05 12:21:56 {pstm-100088} PreparedStatement:          select 
CurrentId.NextVal from dual       (PreparedStatementLogProxy.java:48)
DEBUG 01-05 12:21:56 {pstm-100088} Parameters: []  
(PreparedStatementLogProxy.java:49)
DEBUG 01-05 12:21:56 {pstm-100088} Types: []  
(PreparedStatementLogProxy.java:50)
DEBUG 01-05 12:21:56 {rset-100089} ResultSet  
(ResultSetLogProxy.java:41)
DEBUG 01-05 12:21:56 Returned connection 10110166 to pool.  
(SimpleDataSource.java:527)

Here is from the command line...

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
With the Partitioning and Oracle Data Mining options
JServer Release 9.2.0.2.0 - Production

SQL> select CurrentId.NextVal from dual;

    NEXTVAL
----------
      20025

SQL> exit

They are both using the same user/passwd.


Re: oracle sequence trouble

Posted by Brandon Goodin <br...@gmail.com>.
post your sqlmap so that we can see it.

Brandon


On Wed, 05 Jan 2005 14:58:13 -0700, Nathan Maves <Na...@sun.com> wrote:
> That is nice but I want to use it as its own select statement so that
> it can be re-used for other things.
> 
> Nathan
> 
> On Jan 5, 2005, at 2:54 PM, Brandon Goodin wrote:
> 
> > see page 14 of the SQLMaps manual.
> >
> >
> > On Wed, 05 Jan 2005 14:45:21 -0700, Nathan Maves
> > <Na...@sun.com> wrote:
> >> This one is really stumping me.  Anyone else ever had such a problem?
> >> This seems so trivial but it is hold up a ton of development :)
> >>
> >>
> >> On Jan 5, 2005, at 12:24 PM, Nathan Maves wrote:
> >>
> >>> I jest created this sequence today and I works fine from the command
> >>> line but it returns null from ibatis.  Are there any tricks when
> >>> using
> >>> sequences?
> >>>
> >>> Here are the logs...
> >>>
> >>> DEBUG 01-05 12:21:56 Checked out connection 10110166 from pool.
> >>> (SimpleDataSource.java:563)
> >>> DEBUG 01-05 12:21:56 {conn-100087} Connection
> >>> (ConnectionLogProxy.java:42)
> >>> DEBUG 01-05 12:21:56 {pstm-100088} PreparedStatement:          select
> >>> CurrentId.NextVal from dual       (PreparedStatementLogProxy.java:48)
> >>> DEBUG 01-05 12:21:56 {pstm-100088} Parameters: []
> >>> (PreparedStatementLogProxy.java:49)
> >>> DEBUG 01-05 12:21:56 {pstm-100088} Types: []
> >>> (PreparedStatementLogProxy.java:50)
> >>> DEBUG 01-05 12:21:56 {rset-100089} ResultSet
> >>> (ResultSetLogProxy.java:41)
> >>> DEBUG 01-05 12:21:56 Returned connection 10110166 to pool.
> >>> (SimpleDataSource.java:527)
> >>>
> >>> Here is from the command line...
> >>>
> >>> Connected to:
> >>> Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
> >>> With the Partitioning and Oracle Data Mining options
> >>> JServer Release 9.2.0.2.0 - Production
> >>>
> >>> SQL> select CurrentId.NextVal from dual;
> >>>
> >>>    NEXTVAL
> >>> ----------
> >>>      20025
> >>>
> >>> SQL> exit
> >>>
> >>> They are both using the same user/passwd.
> >>>
> >>
> >>
> 
>

Re: SOLVED Re: oracle sequence trouble

Posted by Brandon Goodin <br...@gmail.com>.
How about we follow the instructions? Then there are no problems ;-)

Brandon


On Wed, 5 Jan 2005 15:08:56 -0700, Larry Meadors
<la...@gmail.com> wrote:
> I am not sure how i feel about that...it would be convenient, but I am
> not sure of the impact it may have in other areas.
> 
> On Wed, 05 Jan 2005 15:02:23 -0700, Nathan Maves <Na...@sun.com> wrote:
> > <select id="getNextId" resultClass="string">
> >          select CurrentId.NextVal as value from dual
> > </select>
> >
> > Is there anyway that sqlmaps could check if there is only one column
> > coming back and assume that this is the value for implicit resultmaps?
>

Re: SOLVED Re: oracle sequence trouble

Posted by Nathan Maves <Na...@Sun.COM>.
Yeah, the more I thought about it you might have to check the result 
type and if it is a string the it might work.  Just something to think 
about :)

Nathan

On Jan 5, 2005, at 3:08 PM, Larry Meadors wrote:

> I am not sure how i feel about that...it would be convenient, but I am
> not sure of the impact it may have in other areas.
>
> On Wed, 05 Jan 2005 15:02:23 -0700, Nathan Maves 
> <Na...@sun.com> wrote:
>> <select id="getNextId" resultClass="string">
>>          select CurrentId.NextVal as value from dual
>> </select>
>>
>> Is there anyway that sqlmaps could check if there is only one column
>> coming back and assume that this is the value for implicit resultmaps?


Re: SOLVED Re: oracle sequence trouble

Posted by Larry Meadors <la...@gmail.com>.
I am not sure how i feel about that...it would be convenient, but I am
not sure of the impact it may have in other areas.

On Wed, 05 Jan 2005 15:02:23 -0700, Nathan Maves <Na...@sun.com> wrote:
> <select id="getNextId" resultClass="string">
>          select CurrentId.NextVal as value from dual
> </select>
> 
> Is there anyway that sqlmaps could check if there is only one column
> coming back and assume that this is the value for implicit resultmaps?

SOLVED Re: oracle sequence trouble

Posted by Nathan Maves <Na...@Sun.COM>.
Well I found the error but I wonder if it could be solved for others in 
the future.

I was missing the "as value" in the sqlmap.

<select id="getNextId" resultClass="string">
         select CurrentId.NextVal as value from dual
</select>

Is there anyway that sqlmaps could check if there is only one column 
coming back and assume that this is the value for implicit resultmaps?

Nathan
On Jan 5, 2005, at 2:58 PM, Nathan Maves wrote:

> That is nice but I want to use it as its own select statement so that 
> it can be re-used for other things.
>
> Nathan
>
> On Jan 5, 2005, at 2:54 PM, Brandon Goodin wrote:
>
>> see page 14 of the SQLMaps manual.
>>
>>
>> On Wed, 05 Jan 2005 14:45:21 -0700, Nathan Maves 
>> <Na...@sun.com> wrote:
>>> This one is really stumping me.  Anyone else ever had such a problem?
>>> This seems so trivial but it is hold up a ton of development :)
>>>
>>>
>>> On Jan 5, 2005, at 12:24 PM, Nathan Maves wrote:
>>>
>>>> I jest created this sequence today and I works fine from the command
>>>> line but it returns null from ibatis.  Are there any tricks when 
>>>> using
>>>> sequences?
>>>>
>>>> Here are the logs...
>>>>
>>>> DEBUG 01-05 12:21:56 Checked out connection 10110166 from pool.
>>>> (SimpleDataSource.java:563)
>>>> DEBUG 01-05 12:21:56 {conn-100087} Connection
>>>> (ConnectionLogProxy.java:42)
>>>> DEBUG 01-05 12:21:56 {pstm-100088} PreparedStatement:          
>>>> select
>>>> CurrentId.NextVal from dual       
>>>> (PreparedStatementLogProxy.java:48)
>>>> DEBUG 01-05 12:21:56 {pstm-100088} Parameters: []
>>>> (PreparedStatementLogProxy.java:49)
>>>> DEBUG 01-05 12:21:56 {pstm-100088} Types: []
>>>> (PreparedStatementLogProxy.java:50)
>>>> DEBUG 01-05 12:21:56 {rset-100089} ResultSet
>>>> (ResultSetLogProxy.java:41)
>>>> DEBUG 01-05 12:21:56 Returned connection 10110166 to pool.
>>>> (SimpleDataSource.java:527)
>>>>
>>>> Here is from the command line...
>>>>
>>>> Connected to:
>>>> Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
>>>> With the Partitioning and Oracle Data Mining options
>>>> JServer Release 9.2.0.2.0 - Production
>>>>
>>>> SQL> select CurrentId.NextVal from dual;
>>>>
>>>>    NEXTVAL
>>>> ----------
>>>>      20025
>>>>
>>>> SQL> exit
>>>>
>>>> They are both using the same user/passwd.
>>>>
>>>
>>>
>


Re: oracle sequence trouble

Posted by Nathan Maves <Na...@Sun.COM>.
That is nice but I want to use it as its own select statement so that 
it can be re-used for other things.

Nathan

On Jan 5, 2005, at 2:54 PM, Brandon Goodin wrote:

> see page 14 of the SQLMaps manual.
>
>
> On Wed, 05 Jan 2005 14:45:21 -0700, Nathan Maves 
> <Na...@sun.com> wrote:
>> This one is really stumping me.  Anyone else ever had such a problem?
>> This seems so trivial but it is hold up a ton of development :)
>>
>>
>> On Jan 5, 2005, at 12:24 PM, Nathan Maves wrote:
>>
>>> I jest created this sequence today and I works fine from the command
>>> line but it returns null from ibatis.  Are there any tricks when 
>>> using
>>> sequences?
>>>
>>> Here are the logs...
>>>
>>> DEBUG 01-05 12:21:56 Checked out connection 10110166 from pool.
>>> (SimpleDataSource.java:563)
>>> DEBUG 01-05 12:21:56 {conn-100087} Connection
>>> (ConnectionLogProxy.java:42)
>>> DEBUG 01-05 12:21:56 {pstm-100088} PreparedStatement:          select
>>> CurrentId.NextVal from dual       (PreparedStatementLogProxy.java:48)
>>> DEBUG 01-05 12:21:56 {pstm-100088} Parameters: []
>>> (PreparedStatementLogProxy.java:49)
>>> DEBUG 01-05 12:21:56 {pstm-100088} Types: []
>>> (PreparedStatementLogProxy.java:50)
>>> DEBUG 01-05 12:21:56 {rset-100089} ResultSet
>>> (ResultSetLogProxy.java:41)
>>> DEBUG 01-05 12:21:56 Returned connection 10110166 to pool.
>>> (SimpleDataSource.java:527)
>>>
>>> Here is from the command line...
>>>
>>> Connected to:
>>> Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
>>> With the Partitioning and Oracle Data Mining options
>>> JServer Release 9.2.0.2.0 - Production
>>>
>>> SQL> select CurrentId.NextVal from dual;
>>>
>>>    NEXTVAL
>>> ----------
>>>      20025
>>>
>>> SQL> exit
>>>
>>> They are both using the same user/passwd.
>>>
>>
>>


Re: oracle sequence trouble

Posted by Brandon Goodin <br...@gmail.com>.
see page 14 of the SQLMaps manual.


On Wed, 05 Jan 2005 14:45:21 -0700, Nathan Maves <Na...@sun.com> wrote:
> This one is really stumping me.  Anyone else ever had such a problem?
> This seems so trivial but it is hold up a ton of development :)
> 
> 
> On Jan 5, 2005, at 12:24 PM, Nathan Maves wrote:
> 
> > I jest created this sequence today and I works fine from the command
> > line but it returns null from ibatis.  Are there any tricks when using
> > sequences?
> >
> > Here are the logs...
> >
> > DEBUG 01-05 12:21:56 Checked out connection 10110166 from pool.
> > (SimpleDataSource.java:563)
> > DEBUG 01-05 12:21:56 {conn-100087} Connection
> > (ConnectionLogProxy.java:42)
> > DEBUG 01-05 12:21:56 {pstm-100088} PreparedStatement:          select
> > CurrentId.NextVal from dual       (PreparedStatementLogProxy.java:48)
> > DEBUG 01-05 12:21:56 {pstm-100088} Parameters: []
> > (PreparedStatementLogProxy.java:49)
> > DEBUG 01-05 12:21:56 {pstm-100088} Types: []
> > (PreparedStatementLogProxy.java:50)
> > DEBUG 01-05 12:21:56 {rset-100089} ResultSet
> > (ResultSetLogProxy.java:41)
> > DEBUG 01-05 12:21:56 Returned connection 10110166 to pool.
> > (SimpleDataSource.java:527)
> >
> > Here is from the command line...
> >
> > Connected to:
> > Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
> > With the Partitioning and Oracle Data Mining options
> > JServer Release 9.2.0.2.0 - Production
> >
> > SQL> select CurrentId.NextVal from dual;
> >
> >    NEXTVAL
> > ----------
> >      20025
> >
> > SQL> exit
> >
> > They are both using the same user/passwd.
> >
> 
>

Re: oracle sequence trouble

Posted by Nathan Maves <Na...@Sun.COM>.
This one is really stumping me.  Anyone else ever had such a problem?  
This seems so trivial but it is hold up a ton of development :)


On Jan 5, 2005, at 12:24 PM, Nathan Maves wrote:

> I jest created this sequence today and I works fine from the command 
> line but it returns null from ibatis.  Are there any tricks when using 
> sequences?
>
> Here are the logs...
>
> DEBUG 01-05 12:21:56 Checked out connection 10110166 from pool.  
> (SimpleDataSource.java:563)
> DEBUG 01-05 12:21:56 {conn-100087} Connection  
> (ConnectionLogProxy.java:42)
> DEBUG 01-05 12:21:56 {pstm-100088} PreparedStatement:          select 
> CurrentId.NextVal from dual       (PreparedStatementLogProxy.java:48)
> DEBUG 01-05 12:21:56 {pstm-100088} Parameters: []  
> (PreparedStatementLogProxy.java:49)
> DEBUG 01-05 12:21:56 {pstm-100088} Types: []  
> (PreparedStatementLogProxy.java:50)
> DEBUG 01-05 12:21:56 {rset-100089} ResultSet  
> (ResultSetLogProxy.java:41)
> DEBUG 01-05 12:21:56 Returned connection 10110166 to pool.  
> (SimpleDataSource.java:527)
>
> Here is from the command line...
>
> Connected to:
> Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
> With the Partitioning and Oracle Data Mining options
> JServer Release 9.2.0.2.0 - Production
>
> SQL> select CurrentId.NextVal from dual;
>
>    NEXTVAL
> ----------
>      20025
>
> SQL> exit
>
> They are both using the same user/passwd.
>