You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by MORÁVEK Peter <mo...@pobox.sk> on 2001/01/15 17:41:20 UTC

ESQL taglib

Is here someone who is implementing CallableStatements into the esql
taglibrary, so I do not make it on my own, and then replacing with the
default behaviour ?
 
If no, I can try it to do it ... and send it to the dev list.

Thanks in advance

Peter

Re: ESQL taglib

Posted by Tagunov Anthony <at...@nnt.ru>.
On Tue, 16 Jan 2001 16:46:12 -0500, Matthew Cordes wrote:

>Can you post some sample code. I do not develop esql, but I am 
>curious about CallableStatement syntax. Does your db have any
>kind of a trigger? That might be another alternative.
>
>-matt

Sorry, just no time for anything more (or Moscow tube will close without me getting in :)
Just sending you the version of esql.xsl I'm using now (it is an out of law child of
very early esql taglibs, there you can find how we call callable statements.

the query is smth like {Some_GetI} where Some_GetI is the name of the stored procedure

>
>On Tue, Jan 16, 2001 at 11:50:55PM +0300, Tagunov Anthony wrote:
>> On Mon, 15 Jan 2001 18:31:10 +0000, Werner Guttmann wrote:
>> 
>> Hi, guys!
>> 
>> Yes, there's need in using CallableStatement. It's one of the reasons we
>> use non-standart esql.xsl. 
>> 
>> WE DO NEED TO CALL these stored procedures from the database.
>> They "query" looks something like {Some_Procedure}. It may have
>> parameters. It returns resultset quite as an ordinary query would.
>> 
>> In our case we use a simpliest query possible without parameters
>> (our db has not got proper autoincrement fields, but we could manage
>> it via a store procedure: first invoke thing proc and obtain a unique
>> id  and the make an insert. But of course the strored procedures are
>> able of doing much more then that.
>> 
>> >CallableStatements are used to execute stored procedures in JDBC. They are
>> >very similar to PreparedStatements with regards to how they are being
>> >initialised and invoked (incl. the parameter binding).
>> >
>> >The main difference is that ...
>> >
>> >- the code of the stored procedure normally resides on the db server, and
>> >actually can be written in a language of choice, e.g. Java, Pro*SQL
>> >(Oracle), etc.
>> >- no SQL String is being passed to the db server during instantiation of the
>> >CallableStatement.
>> >
>> >Werner
>> >
>> >Donald Ball wrote:
>> >
>> >> On Mon, 15 Jan 2001, [iso-8859-1] MORUVEK Peter wrote:
>> >>
>> >> > Is here someone who is implementing CallableStatements into the esql
>> >> > taglibrary, so I do not make it on my own, and then replacing with the
>> >> > default behaviour ?
>> >>
>> >> i've never had the need to use them, but i'm interested in helping add
>> >> them. how are they typically used in JDBC?
>> >>
>> >> - donald
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>> >> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>> >
>> >
>> >---------------------------------------------------------------------
>> >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>> >For additional commands, e-mail: cocoon-users-help@xml.apache.org
>> >
>> >
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>



Re: ESQL taglib

Posted by Matthew Cordes <mc...@maine.edu>.
Can you post some sample code. I do not develop esql, but I am 
curious about CallableStatement syntax. Does your db have any
kind of a trigger? That might be another alternative.

-matt

On Tue, Jan 16, 2001 at 11:50:55PM +0300, Tagunov Anthony wrote:
> On Mon, 15 Jan 2001 18:31:10 +0000, Werner Guttmann wrote:
> 
> Hi, guys!
> 
> Yes, there's need in using CallableStatement. It's one of the reasons we
> use non-standart esql.xsl. 
> 
> WE DO NEED TO CALL these stored procedures from the database.
> They "query" looks something like {Some_Procedure}. It may have
> parameters. It returns resultset quite as an ordinary query would.
> 
> In our case we use a simpliest query possible without parameters
> (our db has not got proper autoincrement fields, but we could manage
> it via a store procedure: first invoke thing proc and obtain a unique
> id  and the make an insert. But of course the strored procedures are
> able of doing much more then that.
> 
> >CallableStatements are used to execute stored procedures in JDBC. They are
> >very similar to PreparedStatements with regards to how they are being
> >initialised and invoked (incl. the parameter binding).
> >
> >The main difference is that ...
> >
> >- the code of the stored procedure normally resides on the db server, and
> >actually can be written in a language of choice, e.g. Java, Pro*SQL
> >(Oracle), etc.
> >- no SQL String is being passed to the db server during instantiation of the
> >CallableStatement.
> >
> >Werner
> >
> >Donald Ball wrote:
> >
> >> On Mon, 15 Jan 2001, [iso-8859-1] MORUVEK Peter wrote:
> >>
> >> > Is here someone who is implementing CallableStatements into the esql
> >> > taglibrary, so I do not make it on my own, and then replacing with the
> >> > default behaviour ?
> >>
> >> i've never had the need to use them, but i'm interested in helping add
> >> them. how are they typically used in JDBC?
> >>
> >> - donald
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> >> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> >For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 

Re: ESQL taglib

Posted by Tagunov Anthony <at...@nnt.ru>.
On Tue, 16 Jan 2001 21:16:44 -0500 (EST), Donald Ball wrote:

>On Tue, 16 Jan 2001, Tagunov Anthony wrote:
>
>> Yes, there's need in using CallableStatement. It's one of the reasons we
>> use non-standart esql.xsl.
>>
>> WE DO NEED TO CALL these stored procedures from the database.
>> They "query" looks something like {Some_Procedure}. It may have
>> parameters. It returns resultset quite as an ordinary query would.
>
>so, i could test to see if a query is in fact a call to a stored procedure
>by looking to see if it starts with '{'?
>
>- donald
>

All I know I know from http://java.sun.com/docs/books/tutorial/jdbc/basics/storedprocedures.html .. And it looks like
the answer is YES

Best Regards, Tagunov Anthony



Re: ESQL taglib

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 16 Jan 2001, Tagunov Anthony wrote:

> Yes, there's need in using CallableStatement. It's one of the reasons we
> use non-standart esql.xsl.
>
> WE DO NEED TO CALL these stored procedures from the database.
> They "query" looks something like {Some_Procedure}. It may have
> parameters. It returns resultset quite as an ordinary query would.

so, i could test to see if a query is in fact a call to a stored procedure
by looking to see if it starts with '{'?

- donald


Re: ESQL taglib

Posted by Tagunov Anthony <at...@nnt.ru>.
On Mon, 15 Jan 2001 18:31:10 +0000, Werner Guttmann wrote:

Hi, guys!

Yes, there's need in using CallableStatement. It's one of the reasons we
use non-standart esql.xsl. 

WE DO NEED TO CALL these stored procedures from the database.
They "query" looks something like {Some_Procedure}. It may have
parameters. It returns resultset quite as an ordinary query would.

In our case we use a simpliest query possible without parameters
(our db has not got proper autoincrement fields, but we could manage
it via a store procedure: first invoke thing proc and obtain a unique
id  and the make an insert. But of course the strored procedures are
able of doing much more then that.

>CallableStatements are used to execute stored procedures in JDBC. They are
>very similar to PreparedStatements with regards to how they are being
>initialised and invoked (incl. the parameter binding).
>
>The main difference is that ...
>
>- the code of the stored procedure normally resides on the db server, and
>actually can be written in a language of choice, e.g. Java, Pro*SQL
>(Oracle), etc.
>- no SQL String is being passed to the db server during instantiation of the
>CallableStatement.
>
>Werner
>
>Donald Ball wrote:
>
>> On Mon, 15 Jan 2001, [iso-8859-1] MORаVEK Peter wrote:
>>
>> > Is here someone who is implementing CallableStatements into the esql
>> > taglibrary, so I do not make it on my own, and then replacing with the
>> > default behaviour ?
>>
>> i've never had the need to use them, but i'm interested in helping add
>> them. how are they typically used in JDBC?
>>
>> - donald
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>




Re: [C1.8.x] Stored Procedures support in ESQL logicsheet

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 20 Apr 2001, Drasko Kokic wrote:

> is there any progress in integrating the stored
> procedures support into the ESQL logicsheet?
>
> I know that there is a separate logicsheet proposal
> for the stored procedures functionality, but believe
> that would be better to extend ESQL logicsheet.
>
> Anybody on it already?

i'm anxiously awaiting user feedback from the patch that was submitted - i
have no database that supports stored procedures, so i can't do any
testing. have you had success with it?

- donald


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


[C1.8.x] Stored Procedures support in ESQL logicsheet

Posted by Drasko Kokic <dr...@yahoo.com>.
Hi there,

is there any progress in integrating the stored
procedures support into the ESQL logicsheet?

I know that there is a separate logicsheet proposal
for the stored procedures functionality, but believe
that would be better to extend ESQL logicsheet.

Anybody on it already?

Drasko


--- Ulrich Mayring <ul...@denic.de> wrote:
> > Donald Ball wrote:
> > 
> > > can you give me a short code snippet
> illustrating their use?
> > >
> > > - donald
> 
> from the auth taglib:
> 
> Connection con =
>
DriverManager.getConnection(dburl,username,password);
> String dbsp = "SP_MY_PROC";
> CallableStatement stmt = con.prepareCall("{?=call "
> + dbsp + "(?,?)}");
> stmt.registerOutParameter(1,java.sql.Types.VARCHAR);
> stmt.setString(2,param1);
> stmt.setString(3,param2);
> try {
> 	ResultSet rs = stmt.executeQuery();
> 	result = rs.getString(1);
> 	}
> catch(Exception e) {
> 	result = stmt.getString(1);
> 	}
> 
> This code takes into account that some wacky JDBC
> drivers (like the
> Sybase one I use) can only read the stored
> procedure's result with a
> result set, so this is tried first. If the JDBC
> driver is sane and
> throws an exception, then we try with
> stmt.getString(1), which
> apparently is the "correct" way of retrieving
> results from a stored
> procedure.
> 
> Ulrich
> 
> -- 
> Ulrich Mayring
> DENIC eG, Systementwicklung
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> cocoon-users-help@xml.apache.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: ESQL taglib

Posted by Ulrich Mayring <ul...@denic.de>.
> Donald Ball wrote:
> 
> > can you give me a short code snippet illustrating their use?
> >
> > - donald

from the auth taglib:

Connection con = DriverManager.getConnection(dburl,username,password);
String dbsp = "SP_MY_PROC";
CallableStatement stmt = con.prepareCall("{?=call " + dbsp + "(?,?)}");
stmt.registerOutParameter(1,java.sql.Types.VARCHAR);
stmt.setString(2,param1);
stmt.setString(3,param2);
try {
	ResultSet rs = stmt.executeQuery();
	result = rs.getString(1);
	}
catch(Exception e) {
	result = stmt.getString(1);
	}

This code takes into account that some wacky JDBC drivers (like the
Sybase one I use) can only read the stored procedure's result with a
result set, so this is tried first. If the JDBC driver is sane and
throws an exception, then we try with stmt.getString(1), which
apparently is the "correct" way of retrieving results from a stored
procedure.

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

Re: ESQL taglib

Posted by Werner Guttmann <We...@msdw.com>.
Out of memory (as I do not have any code at my hands right now .. ;-)).

catch {
    String storedProcedureInterface = "{name_of_sp(?,?)}"
    CallableStatement cs = new CallableStatement (storedProcedureInterface);

    cs.setString(1, ...);
    cs.setString(2, ...);

    cs.executeUpdate();
} catch (SQLException e) {
    ...
}

There's some difference with regards to registering out parameters and return
parameters, but for details I would have to send you to the JDBC javadocs.

I hope this helps.

Werner


Donald Ball wrote:

> On Mon, 15 Jan 2001, Werner Guttmann wrote:
>
> > CallableStatements are used to execute stored procedures in JDBC. They are
> > very similar to PreparedStatements with regards to how they are being
> > initialised and invoked (incl. the parameter binding).
> >
> > The main difference is that ...
> >
> > - the code of the stored procedure normally resides on the db server, and
> > actually can be written in a language of choice, e.g. Java, Pro*SQL
> > (Oracle), etc.
> > - no SQL String is being passed to the db server during instantiation of the
> > CallableStatement.
>
> can you give me a short code snippet illustrating their use?
>
> - donald
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: ESQL taglib

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 15 Jan 2001, Werner Guttmann wrote:

> CallableStatements are used to execute stored procedures in JDBC. They are
> very similar to PreparedStatements with regards to how they are being
> initialised and invoked (incl. the parameter binding).
>
> The main difference is that ...
>
> - the code of the stored procedure normally resides on the db server, and
> actually can be written in a language of choice, e.g. Java, Pro*SQL
> (Oracle), etc.
> - no SQL String is being passed to the db server during instantiation of the
> CallableStatement.

can you give me a short code snippet illustrating their use?

- donald


Re: ESQL taglib

Posted by Werner Guttmann <We...@msdw.com>.
CallableStatements are used to execute stored procedures in JDBC. They are
very similar to PreparedStatements with regards to how they are being
initialised and invoked (incl. the parameter binding).

The main difference is that ...

- the code of the stored procedure normally resides on the db server, and
actually can be written in a language of choice, e.g. Java, Pro*SQL
(Oracle), etc.
- no SQL String is being passed to the db server during instantiation of the
CallableStatement.

Werner

Donald Ball wrote:

> On Mon, 15 Jan 2001, [iso-8859-1] MORÁVEK Peter wrote:
>
> > Is here someone who is implementing CallableStatements into the esql
> > taglibrary, so I do not make it on my own, and then replacing with the
> > default behaviour ?
>
> i've never had the need to use them, but i'm interested in helping add
> them. how are they typically used in JDBC?
>
> - donald
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: ESQL taglib

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 15 Jan 2001, [iso-8859-1] MOR�VEK Peter wrote:

> Is here someone who is implementing CallableStatements into the esql
> taglibrary, so I do not make it on my own, and then replacing with the
> default behaviour ?

i've never had the need to use them, but i'm interested in helping add
them. how are they typically used in JDBC?

- donald


Re: ESQL taglib

Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 15 Jan 2001, [iso-8859-1] MOR�VEK Peter wrote:

> Is here someone who is implementing CallableStatements into the esql
> taglibrary, so I do not make it on my own, and then replacing with the
> default behaviour ?

i've never had the need to use them, but i'm interested in helping add
them. how are they typically used in JDBC?

- donald