You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Kevin Passey <kp...@kdpsoftware.co.uk> on 2003/07/01 17:40:05 UTC

Stored procedure

Hi,
 
Are there any taglibs which I can use to call a stored procedure.
 
Thanks
 
Kevin

Re: Stored procedure

Posted by Xavier Prélat <pr...@wcentric.com>.
sql taglib does not support Stored Procedure.
You should write your own custom tags.

Here is a link for Stored procedure manipulation in Java

http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html

/Xavier

Daniel Montero a écrit:

>I believe you can just do something like
><sql:query datasource="jdbc/myds" sql="exec my_proc" />
>
>just like any other sql statement.
>
>
>
>----- Original Message ----- 
>From: "Kevin Passey" <kp...@kdpsoftware.co.uk>
>To: "Taglibs (E-mail)" <ta...@jakarta.apache.org>
>Sent: Tuesday, July 01, 2003 9:40 AM
>Subject: Stored procedure
>
>
>  
>
>>Hi,
>> 
>>Are there any taglibs which I can use to call a stored procedure.
>> 
>>Thanks
>> 
>>Kevin
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
>
>
>  
>



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


Re: Stored procedure (RFI proposal)

Posted by Vic Cekvenich <vi...@baseBeans.com>.
Of course... data access in a presentation view is bad practice, much 
better to unit test a bean (with DAO, such as iBatis.com) in an MVC way.
Then you can reuse you bean for Soap, etc., not just JSP and keep your 
JSP code clean.


Michael Duffy wrote:

>Do you mean you want to batch commands, the way the
>java.sql.Statement.addBatch allows you to?  That would
>be useful to lots of people, I'll bet.  I think that
>would require tag changes, too.  
>
>I can see a <sql:batch> tag that could have multiple
><sql:update> children.  Do they do such a thing in
>Jakarta's DBTags taglib? - MOD
>
>--- James Smith <jk...@email.arizona.edu> wrote:
>  
>
>>I was actually dealing with a similar problem
>>yesterday; I wanted to write a
>>tag that called not a stored procedure, but several
>>SQL statements in a row,
>>using a dataSource, just like I would use for
>><sql:xxxx> tags.  After
>>looking through the source code, I noticed that the
>>abstract classes
>>
>>    
>>
>org.apache.taglibs.standard.tag.common.sql.QueryTagSupport
>  
>
>>and
>>
>>    
>>
>org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport
>  
>
>>both used the
>>exact same code to access a data source.  So, I was
>>wondering if in future
>>versions of the tag library, we could have an
>>abstract tag that extended
>>BodyTagSupport and did all the work of getting the
>>dataSource and database
>>connection, and then QueryTagSupport and
>>UpdateTagSupport (I didn't look at
>>TransactionTagSupport that closely, but I'm assuming
>>it does something
>>similar) could inherit from that class, as could any
>>other tags that would,
>>say, call multiple SQL statements or call a stored
>>proc using a JSTL
>>dataSource.  Since I haven't looked at the source
>>code for the standard
>>taglibs under Tomcat 5-alpha, I don't know if this
>>idea would still be
>>compatible with the newer code, but if it is, I
>>think it would be useful.
>>Just an idea!  Thanks,
>>
>>James Smith
>>Application Systems Analyst, Treistman Center
>>College of Fine Arts, University of Arizona
>>
>>----- Original Message ----- 
>>From: "Michael Duffy" <du...@yahoo.com>
>>To: "Tag Libraries Users List"
>><ta...@jakarta.apache.org>
>>Sent: Wednesday, July 02, 2003 4:40 AM
>>Subject: Re: Stored procedure
>>
>>
>>    
>>
>>>Not if the underlying implementation isn't using
>>>CallableStatement.  Stored procs can have in, out,
>>>      
>>>
>>and
>>    
>>
>>>inout parameters.  They can also return multiple
>>>ResultSets.
>>>
>>>When I look at the java.sql.CallableStatement
>>>javadocs, it seems clear to me that it's a very
>>>different animal from Statement and
>>>      
>>>
>>PreparedStatement.
>>    
>>
>>> The taglibs that support it will look very
>>>      
>>>
>>different
>>    
>>
>>>from the JSTL sql taglib.  JMHO - MOD
>>>
>>>--- Daniel Montero <da...@soin.co.cr> wrote:
>>>      
>>>
>>>>I believe you can just do something like
>>>><sql:query datasource="jdbc/myds" sql="exec
>>>>        
>>>>
>>my_proc"
>>    
>>
>>>>/>
>>>>
>>>>just like any other sql statement.
>>>>
>>>>
>>>>
>>>>----- Original Message ----- 
>>>>From: "Kevin Passey" <kp...@kdpsoftware.co.uk>
>>>>To: "Taglibs (E-mail)"
>>>><ta...@jakarta.apache.org>
>>>>Sent: Tuesday, July 01, 2003 9:40 AM
>>>>Subject: Stored procedure
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi,
>>>>>
>>>>>Are there any taglibs which I can use to call
>>>>>          
>>>>>
>>a
>>    
>>
>>>>stored procedure.
>>>>        
>>>>
>>>>>Thanks
>>>>>
>>>>>Kevin
>>>>>
>>>>>          
>>>>>
>>>>        
>>>>
>---------------------------------------------------------------------
>  
>
>>>>To unsubscribe, e-mail:
>>>>taglibs-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail:
>>>>taglibs-user-help@jakarta.apache.org
>>>>
>>>>        
>>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>SBC Yahoo! DSL - Now only $29.95 per month!
>>>http://sbc.yahoo.com
>>>
>>>
>>>      
>>>
>---------------------------------------------------------------------
>  
>
>>>To unsubscribe, e-mail:
>>>      
>>>
>>taglibs-user-unsubscribe@jakarta.apache.org
>>    
>>
>>>For additional commands, e-mail:
>>>      
>>>
>>taglibs-user-help@jakarta.apache.org
>>    
>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>taglibs-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>taglibs-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>__________________________________
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>http://sbc.yahoo.com
>  
>

-- 
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA

Advanced <a href ="baseBeans.com">Struts Training</a> and project recovery in North East.
Open Source <a href ="baseBeans.com">Content Management</a>  basicPortal sofware
Best practice<a href ="baseBeans.com">Struts Support</a> v.1.1 helper ScafflodingXPress


Re: Stored procedure (RFI proposal)

Posted by Michael Duffy <du...@yahoo.com>.
Do you mean you want to batch commands, the way the
java.sql.Statement.addBatch allows you to?  That would
be useful to lots of people, I'll bet.  I think that
would require tag changes, too.  

I can see a <sql:batch> tag that could have multiple
<sql:update> children.  Do they do such a thing in
Jakarta's DBTags taglib? - MOD

--- James Smith <jk...@email.arizona.edu> wrote:
> I was actually dealing with a similar problem
> yesterday; I wanted to write a
> tag that called not a stored procedure, but several
> SQL statements in a row,
> using a dataSource, just like I would use for
> <sql:xxxx> tags.  After
> looking through the source code, I noticed that the
> abstract classes
>
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport
> and
>
org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport
> both used the
> exact same code to access a data source.  So, I was
> wondering if in future
> versions of the tag library, we could have an
> abstract tag that extended
> BodyTagSupport and did all the work of getting the
> dataSource and database
> connection, and then QueryTagSupport and
> UpdateTagSupport (I didn't look at
> TransactionTagSupport that closely, but I'm assuming
> it does something
> similar) could inherit from that class, as could any
> other tags that would,
> say, call multiple SQL statements or call a stored
> proc using a JSTL
> dataSource.  Since I haven't looked at the source
> code for the standard
> taglibs under Tomcat 5-alpha, I don't know if this
> idea would still be
> compatible with the newer code, but if it is, I
> think it would be useful.
> Just an idea!  Thanks,
> 
> James Smith
> Application Systems Analyst, Treistman Center
> College of Fine Arts, University of Arizona
> 
> ----- Original Message ----- 
> From: "Michael Duffy" <du...@yahoo.com>
> To: "Tag Libraries Users List"
> <ta...@jakarta.apache.org>
> Sent: Wednesday, July 02, 2003 4:40 AM
> Subject: Re: Stored procedure
> 
> 
> >
> > Not if the underlying implementation isn't using
> > CallableStatement.  Stored procs can have in, out,
> and
> > inout parameters.  They can also return multiple
> > ResultSets.
> >
> > When I look at the java.sql.CallableStatement
> > javadocs, it seems clear to me that it's a very
> > different animal from Statement and
> PreparedStatement.
> >  The taglibs that support it will look very
> different
> > from the JSTL sql taglib.  JMHO - MOD
> >
> > --- Daniel Montero <da...@soin.co.cr> wrote:
> > > I believe you can just do something like
> > > <sql:query datasource="jdbc/myds" sql="exec
> my_proc"
> > > />
> > >
> > > just like any other sql statement.
> > >
> > >
> > >
> > > ----- Original Message ----- 
> > > From: "Kevin Passey" <kp...@kdpsoftware.co.uk>
> > > To: "Taglibs (E-mail)"
> > > <ta...@jakarta.apache.org>
> > > Sent: Tuesday, July 01, 2003 9:40 AM
> > > Subject: Stored procedure
> > >
> > >
> > > > Hi,
> > > >
> > > > Are there any taglibs which I can use to call
> a
> > > stored procedure.
> > > >
> > > > Thanks
> > > >
> > > > Kevin
> > > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > taglibs-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > > taglibs-user-help@jakarta.apache.org
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Re: Stored procedure (RFI proposal)

Posted by James Smith <jk...@email.arizona.edu>.
I was actually dealing with a similar problem yesterday; I wanted to write a
tag that called not a stored procedure, but several SQL statements in a row,
using a dataSource, just like I would use for <sql:xxxx> tags.  After
looking through the source code, I noticed that the abstract classes
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport and
org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport both used the
exact same code to access a data source.  So, I was wondering if in future
versions of the tag library, we could have an abstract tag that extended
BodyTagSupport and did all the work of getting the dataSource and database
connection, and then QueryTagSupport and UpdateTagSupport (I didn't look at
TransactionTagSupport that closely, but I'm assuming it does something
similar) could inherit from that class, as could any other tags that would,
say, call multiple SQL statements or call a stored proc using a JSTL
dataSource.  Since I haven't looked at the source code for the standard
taglibs under Tomcat 5-alpha, I don't know if this idea would still be
compatible with the newer code, but if it is, I think it would be useful.
Just an idea!  Thanks,

James Smith
Application Systems Analyst, Treistman Center
College of Fine Arts, University of Arizona

----- Original Message ----- 
From: "Michael Duffy" <du...@yahoo.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Wednesday, July 02, 2003 4:40 AM
Subject: Re: Stored procedure


>
> Not if the underlying implementation isn't using
> CallableStatement.  Stored procs can have in, out, and
> inout parameters.  They can also return multiple
> ResultSets.
>
> When I look at the java.sql.CallableStatement
> javadocs, it seems clear to me that it's a very
> different animal from Statement and PreparedStatement.
>  The taglibs that support it will look very different
> from the JSTL sql taglib.  JMHO - MOD
>
> --- Daniel Montero <da...@soin.co.cr> wrote:
> > I believe you can just do something like
> > <sql:query datasource="jdbc/myds" sql="exec my_proc"
> > />
> >
> > just like any other sql statement.
> >
> >
> >
> > ----- Original Message ----- 
> > From: "Kevin Passey" <kp...@kdpsoftware.co.uk>
> > To: "Taglibs (E-mail)"
> > <ta...@jakarta.apache.org>
> > Sent: Tuesday, July 01, 2003 9:40 AM
> > Subject: Stored procedure
> >
> >
> > > Hi,
> > >
> > > Are there any taglibs which I can use to call a
> > stored procedure.
> > >
> > > Thanks
> > >
> > > Kevin
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > taglibs-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>


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


Re: Stored procedure

Posted by Michael Duffy <du...@yahoo.com>.
Not if the underlying implementation isn't using
CallableStatement.  Stored procs can have in, out, and
inout parameters.  They can also return multiple
ResultSets.  

When I look at the java.sql.CallableStatement
javadocs, it seems clear to me that it's a very
different animal from Statement and PreparedStatement.
 The taglibs that support it will look very different
from the JSTL sql taglib.  JMHO - MOD

--- Daniel Montero <da...@soin.co.cr> wrote:
> I believe you can just do something like
> <sql:query datasource="jdbc/myds" sql="exec my_proc"
> />
> 
> just like any other sql statement.
> 
> 
> 
> ----- Original Message ----- 
> From: "Kevin Passey" <kp...@kdpsoftware.co.uk>
> To: "Taglibs (E-mail)"
> <ta...@jakarta.apache.org>
> Sent: Tuesday, July 01, 2003 9:40 AM
> Subject: Stored procedure
> 
> 
> > Hi,
> >  
> > Are there any taglibs which I can use to call a
> stored procedure.
> >  
> > Thanks
> >  
> > Kevin
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Re: Stored procedure

Posted by Daniel Montero <da...@soin.co.cr>.
I believe you can just do something like
<sql:query datasource="jdbc/myds" sql="exec my_proc" />

just like any other sql statement.



----- Original Message ----- 
From: "Kevin Passey" <kp...@kdpsoftware.co.uk>
To: "Taglibs (E-mail)" <ta...@jakarta.apache.org>
Sent: Tuesday, July 01, 2003 9:40 AM
Subject: Stored procedure


> Hi,
>  
> Are there any taglibs which I can use to call a stored procedure.
>  
> Thanks
>  
> Kevin
> 

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


Re: Stored procedure

Posted by Michael Duffy <du...@yahoo.com>.
Uh, I don't think so.

A stored procedure is SQL code that's executed by the
SQL engine.  In Java, the pertinent class is
java.sql.CallableStatement.

I just looked in the Jakara DBTags docs - no mention
of CallableStatement that I could see, but I only took
a quick glance.  

You might have to write your own if a good Google
search doesn't turn up anything. - MOD

--- "N. Chen" <ni...@u.washington.edu> wrote:
> 
> stored procedure? is that same as stored sql
> statement?  if so:
> 
> <sql:query sql='${statement}'/>
> 
> nick
> 
> On Tue, 1 Jul 2003, Kevin Passey wrote:
> 
> > Hi,
> >
> > Are there any taglibs which I can use to call a
> stored procedure.
> >
> > Thanks
> >
> > Kevin
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Re: Stored procedure

Posted by "N. Chen" <ni...@u.washington.edu>.
stored procedure? is that same as stored sql statement?  if so:

<sql:query sql='${statement}'/>

nick

On Tue, 1 Jul 2003, Kevin Passey wrote:

> Hi,
>
> Are there any taglibs which I can use to call a stored procedure.
>
> Thanks
>
> Kevin
>


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