You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by Morgan Delagrange <md...@yahoo.com> on 2001/02/01 18:56:47 UTC

release JDBC tag library

Hi all,

I haven't seen any feedback yet on the new version of
the JDBC tag library.  If there isn't any interest in
reviewing the tags, can we vote to release?  I, of
course, vote:

  +1

unless others are interested in reviewing the code and
documentation.

- Morgan


=====
Morgan Delagrange
Britannica.com

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Re: release JDBC tag library

Posted by Morgan Delagrange <md...@yahoo.com>.
--- Pierre Delisle <pi...@sun.com> wrote:
> Morgan Delagrange wrote:
> > I haven't seen any feedback yet on the new version
> of
> > the JDBC tag library.  If there isn't any interest
> in
> > reviewing the tags, can we vote to release?  
> 
> Morgan,
> 
> I tested the jdbc tag-library with my webapp on
> win2k with MySQL 
> and it worked fine. Thanks for a great contribution!

Thanks.  :)

> In the process of learning/using the library, a few
> "minor" things
> along with questions/comments came up. I've listed
> them at the 
> end of this email.
> 
> With respect to the "release" vote, I must admit I'm
> a bit 
> confused about what this means.
> What will change in the status of the jdbc
> tag library, since it is already committed in the 
> jakarta-taglibs workspace?

Well, we haven't really committed to stabilizing the
interface yet.  Witness that I removed some 40 odd
classes last week.  After we put a link on the website
and make an announcement to the users' group, we'll
try not to do that.

More comments below.

> Thanks,
> 
>     -- Pierre
> 
> -----
> TLD
> teiclass not properly positioned for the connection
> 'tag'
> 
> The tag element in the TLD is defined as follows:
> 
> <!ELEMENT tag
> (name, tagclass, teiclass?,
> bodycontent?, info?, attribute*) >
> 
> 'teiclass' should come before bodycontent, which is
> not
> the case for the 'connection' tag in the TLD (also
> in the examples).
> 
> [This fails under tomcat-4.0
>  org.xml.sax.SAXParseException: Element "tag" does
> not allow "teiclass" here.

Fixed.  Good catch!

> -----
> <sql:execute>
> 
> <sql:execute> is only used for insert, update, or
> delete statements.
> Since an 'execute' is not required for 'select', why
> is it required 
> for insert, update, and delete?

I tried to create two categories: stuff that loops
(resultSet) and stuff that doesn't (execute).  Maybe I
should clarify this in the documentation somehow.

> Also, ignoreErrors only available for <sql:execute>.
> What about queries?

I couldn't think of any resultset errors you would
want to ignore, while I could think of possibliy
harmless execution errors (e.g. attempted primary key
violations).

> -----
> scripting variables
> 
> In the docs, when a scripting variable is returned,
> its properties
> are described. However, not all properties are
> listed 
> (e.g. autoCommit for connection).

Yeah, I ignored properties that didn't seem
user-friendly.  They're still accessible, they're just
not documented.

> -----
> wrong syntax in example:
> 
>   <sql:execute>
>     <sql:setColumn position="1">3</sql:setInt>
>     <sql:setColumn
>
position="2"><%=request.getParameter("book_title")%></sql:setString>
>   </sql:execute>
> 
> </sql:setInt> and </sql:setString> should be
> </sql:setColumn>

Ah, I must have missed that one.  Thanks!  (and
fixed.)

> -----

Thanks for your excellent comments!

- Morgan


=====
Morgan Delagrange
Britannica.com

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Re: release JDBC tag library

Posted by Pierre Delisle <pi...@sun.com>.
Morgan Delagrange wrote:
> I haven't seen any feedback yet on the new version of
> the JDBC tag library.  If there isn't any interest in
> reviewing the tags, can we vote to release?  

Morgan,

I tested the jdbc tag-library with my webapp on win2k with MySQL 
and it worked fine. Thanks for a great contribution!

In the process of learning/using the library, a few "minor" things
along with questions/comments came up. I've listed them at the 
end of this email.

With respect to the "release" vote, I must admit I'm a bit 
confused about what this means.
What will change in the status of the jdbc
tag library, since it is already committed in the 
jakarta-taglibs workspace?

Thanks,

    -- Pierre

-----
TLD
teiclass not properly positioned for the connection 'tag'

The tag element in the TLD is defined as follows:

<!ELEMENT tag
(name, tagclass, teiclass?,
bodycontent?, info?, attribute*) >

'teiclass' should come before bodycontent, which is not
the case for the 'connection' tag in the TLD (also in the examples).

[This fails under tomcat-4.0
 org.xml.sax.SAXParseException: Element "tag" does not allow "teiclass" here.

-----
<sql:execute>

<sql:execute> is only used for insert, update, or delete statements.
Since an 'execute' is not required for 'select', why is it required 
for insert, update, and delete?

Also, ignoreErrors only available for <sql:execute>.
What about queries?

-----
scripting variables

In the docs, when a scripting variable is returned, its properties
are described. However, not all properties are listed 
(e.g. autoCommit for connection).

-----
wrong syntax in example:

  <sql:execute>
    <sql:setColumn position="1">3</sql:setInt>
    <sql:setColumn position="2"><%=request.getParameter("book_title")%></sql:setString>
  </sql:execute>

</sql:setInt> and </sql:setString> should be </sql:setColumn>
-----

Re: release JDBC tag library

Posted by Marius Scurtescu <ma...@multiactive.com>.
Morgan Delagrange wrote:
> 
> Hi Marius,
> 
> Since their syntax is so different, I'm thinking about
> creating separate getDate, getTime and getTimestamp
> tags.  I like the idea of distinct functionality
> having a distinct tag, and it would also remove the
> need for passing in the field name of the JDBC type.
> What do you think?

It sounds pretty good. This will leave only the optional
"format" and "locale" attributes. Along these lines we
should add two more tags then: getFloat and getInt.

getFloat would deal with the REAL, FLOAT and DOUBLE types,
all treated as Double. getInt would deal with TINYINT,
SMALLINT, INTEGER and BIGINT, all treated as Long.
We could make the "format" attribute required for these
two tags since it is the only reason to use them.

The "format" attribute should not be required for getDate,
and getTime though. Some databases don't have date and time 
types, only timestamp (MS SQL Server). In these cases, 
unless you specifically ask for date or time, you always
get a timestamp. Just by using getDate or getTime tag
you can extract the corresponding parts.

getTimestamp should require the "format" attribute.

I could create all these tags based on the code I
wrote so far. Let me know if I should do it.

Cheers,
Marius

> 
> - Morgan
> 
> --- Marius Scurtescu <ma...@multiactive.com> wrote:
> > Hi,
> >
> > I started using the new version and it works fine.
> >
> > It was a good idea to consolidate all the setter and
> > getter methods, but this came with a minor drawback:
> > since everything is treated as a String no specific
> > formatting can be used.
> >
> > In order to deal with the formatting I added a few
> > more attributes to the getColumn tag. These
> > attributes
> > are:
> > - type, a JDBC type
> > - format, a formatting pattern or style
> > - locale, the locale
> >
> > If you use the "type" attribute only it will affect
> > the DATE, TIME and TIMESTAMP columns. The three
> > corresponding Java classes have different "toString"
> > methods and you can control what will be displayed.
> >
> > The "format" will take a value dependent on the
> > type.
> > For numeric types it can be either a pattern as
> > accepted by the DecimalFormat constructor or
> > a style: "CURRENCY", "PERCENT" or "NUMBER".
> > For date types it can be either a pattern as
> > accepted by SimpleDateFormat or a style: "FULL",
> > "LONG", "MEDIUM" or "SHORT". For TIMESTAMP it
> > also can be a comma separated list of two styles,
> > one for date and one for time.
> >
> > The locale can have one to three components as
> > accepted by the Locale constructor: language,
> > country and variant. They are separated by "_".
> >
> > Examaples:
> > <jdbc:getColumn name="Start" type="DATE"
> > format="FULL"/>
> > <jdbc:getColumn name="End" type="TIME"/>
> > <jdbc:getColumn name="Next" type="TIMESTAMP"
> > format="SHORT,MEDIUM" locale="ro_RO"/>
> > <jdbc:getColumn name="Now" type="TIMESTAMP"
> > format="LONG"/>
> > <jdbc:getColumn name="Amount" type="CURRENCY"
> > locale="de_DE"/>
> >
> > Since I have no commit rights I will email the
> > changes I made to Morgan. I tested them today
> > and so far they are OK.
> >
> > Cheers,
> > Marius
> >
> >
> > Morgan Delagrange wrote:
> > >
> > > --- Marius Scurtescu <ma...@multiactive.com>
> > wrote:
> > > > Hi Morgan,
> > > >
> > > > I will try the new version either today or
> > tomorrow.
> > > > The original version did not work out of the box
> > > > for me and I had to make a few, small,
> > modifications
> > > > and recompile.
> > > >
> > > > From the top of my head, the changes I made
> > were:
> > > > - added a String version to a setter method to
> > make
> > > > it work with JRun (this was confirmed to be a
> > JRun
> > > > problem but the fix is so simple that it is
> > worth
> > > > doing)
> > >
> > > Sure, I didn't get a chance to create String
> > setter
> > > methods for all the tags.  If you want to fix it,
> > feel
> > > free!
> > >
> > > > - added a "name" attribute to the getter methods
> > so
> > > > you can retrieve fields by name as well
> > > > - added validation code to the getter TEI class
> > to
> > > > check that
> > > > only one of "position" or "name" attributes is
> > used
> > >
> > > Yeah, I changed my mind about that; it sounds like
> > a
> > > good idea now.  If you want to tackle it, please
> > do.
> > >
> > > Thanks, Marius!
> > >
> > > - Morgan
> > >
> > > P.S. WTF is up with all these "Undelivered Mail
> > > Returned to Sender" emails we've been getting from
> > the
> > > list this week?  Who is this?
> > >
> > > <jo...@localhost.suninternet.com>: Name service
> > error
> > > for domain
> > >     localhost.suninternet.com: Host not found
> > >
> > > =====
> > > Morgan Delagrange
> > > Britannica.com
> > >
> > > __________________________________________________
> > > Get personalized email addresses from Yahoo! Mail
> > - only $35
> > > a year!  http://personal.mail.yahoo.com/
> >
> > --
> > ------------------
> > Marius Scurtescu, Software Engineer
> > Tel: (604) 899-2835 Fax: (604) 899-2899
> > mailto:marius@multiactive.com
> > Multiactive Software Inc. http://www.multiactive.com
> > ------------------
> > Attract and retain customers with Multiactive
> > Software --
> > proud winners of PC WEEK's "Best of COMDEX" award.
> > ------------------
> 
> =====
> Morgan Delagrange
> Britannica.com
> 
> __________________________________________________
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/

-- 
------------------
Marius Scurtescu, Software Engineer
Tel: (604) 899-2835 Fax: (604) 899-2899
mailto:marius@multiactive.com
Multiactive Software Inc. http://www.multiactive.com
------------------
Attract and retain customers with Multiactive Software --
proud winners of PC WEEK's "Best of COMDEX" award.
------------------

Re: release JDBC tag library

Posted by Morgan Delagrange <md...@yahoo.com>.
Hi Marius,

Since their syntax is so different, I'm thinking about
creating separate getDate, getTime and getTimestamp
tags.  I like the idea of distinct functionality
having a distinct tag, and it would also remove the
need for passing in the field name of the JDBC type. 
What do you think?

- Morgan

--- Marius Scurtescu <ma...@multiactive.com> wrote:
> Hi,
> 
> I started using the new version and it works fine.
> 
> It was a good idea to consolidate all the setter and
> getter methods, but this came with a minor drawback:
> since everything is treated as a String no specific 
> formatting can be used.
> 
> In order to deal with the formatting I added a few
> more attributes to the getColumn tag. These
> attributes
> are:
> - type, a JDBC type
> - format, a formatting pattern or style
> - locale, the locale
> 
> If you use the "type" attribute only it will affect
> the DATE, TIME and TIMESTAMP columns. The three 
> corresponding Java classes have different "toString"
> methods and you can control what will be displayed.
> 
> The "format" will take a value dependent on the
> type.
> For numeric types it can be either a pattern as
> accepted by the DecimalFormat constructor or
> a style: "CURRENCY", "PERCENT" or "NUMBER".
> For date types it can be either a pattern as
> accepted by SimpleDateFormat or a style: "FULL",
> "LONG", "MEDIUM" or "SHORT". For TIMESTAMP it
> also can be a comma separated list of two styles,
> one for date and one for time.
> 
> The locale can have one to three components as
> accepted by the Locale constructor: language,
> country and variant. They are separated by "_".
> 
> Examaples:
> <jdbc:getColumn name="Start" type="DATE"
> format="FULL"/>
> <jdbc:getColumn name="End" type="TIME"/>
> <jdbc:getColumn name="Next" type="TIMESTAMP"
> format="SHORT,MEDIUM" locale="ro_RO"/>
> <jdbc:getColumn name="Now" type="TIMESTAMP"
> format="LONG"/>
> <jdbc:getColumn name="Amount" type="CURRENCY"
> locale="de_DE"/>
> 
> Since I have no commit rights I will email the
> changes I made to Morgan. I tested them today
> and so far they are OK.
> 
> Cheers,
> Marius
> 
> 
> Morgan Delagrange wrote:
> > 
> > --- Marius Scurtescu <ma...@multiactive.com>
> wrote:
> > > Hi Morgan,
> > >
> > > I will try the new version either today or
> tomorrow.
> > > The original version did not work out of the box
> > > for me and I had to make a few, small,
> modifications
> > > and recompile.
> > >
> > > From the top of my head, the changes I made
> were:
> > > - added a String version to a setter method to
> make
> > > it work with JRun (this was confirmed to be a
> JRun
> > > problem but the fix is so simple that it is
> worth
> > > doing)
> > 
> > Sure, I didn't get a chance to create String
> setter
> > methods for all the tags.  If you want to fix it,
> feel
> > free!
> > 
> > > - added a "name" attribute to the getter methods
> so
> > > you can retrieve fields by name as well
> > > - added validation code to the getter TEI class
> to
> > > check that
> > > only one of "position" or "name" attributes is
> used
> > 
> > Yeah, I changed my mind about that; it sounds like
> a
> > good idea now.  If you want to tackle it, please
> do.
> > 
> > Thanks, Marius!
> > 
> > - Morgan
> > 
> > P.S. WTF is up with all these "Undelivered Mail
> > Returned to Sender" emails we've been getting from
> the
> > list this week?  Who is this?
> > 
> > <jo...@localhost.suninternet.com>: Name service
> error
> > for domain
> >     localhost.suninternet.com: Host not found
> > 
> > =====
> > Morgan Delagrange
> > Britannica.com
> > 
> > __________________________________________________
> > Get personalized email addresses from Yahoo! Mail
> - only $35
> > a year!  http://personal.mail.yahoo.com/
> 
> -- 
> ------------------
> Marius Scurtescu, Software Engineer
> Tel: (604) 899-2835 Fax: (604) 899-2899
> mailto:marius@multiactive.com
> Multiactive Software Inc. http://www.multiactive.com
> ------------------
> Attract and retain customers with Multiactive
> Software --
> proud winners of PC WEEK's "Best of COMDEX" award.
> ------------------


=====
Morgan Delagrange
Britannica.com

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Re: release JDBC tag library

Posted by Marius Scurtescu <ma...@multiactive.com>.
Hi,

I started using the new version and it works fine.

It was a good idea to consolidate all the setter and
getter methods, but this came with a minor drawback:
since everything is treated as a String no specific 
formatting can be used.

In order to deal with the formatting I added a few
more attributes to the getColumn tag. These attributes
are:
- type, a JDBC type
- format, a formatting pattern or style
- locale, the locale

If you use the "type" attribute only it will affect
the DATE, TIME and TIMESTAMP columns. The three 
corresponding Java classes have different "toString"
methods and you can control what will be displayed.

The "format" will take a value dependent on the type.
For numeric types it can be either a pattern as
accepted by the DecimalFormat constructor or
a style: "CURRENCY", "PERCENT" or "NUMBER".
For date types it can be either a pattern as
accepted by SimpleDateFormat or a style: "FULL",
"LONG", "MEDIUM" or "SHORT". For TIMESTAMP it
also can be a comma separated list of two styles,
one for date and one for time.

The locale can have one to three components as
accepted by the Locale constructor: language,
country and variant. They are separated by "_".

Examaples:
<jdbc:getColumn name="Start" type="DATE" format="FULL"/>
<jdbc:getColumn name="End" type="TIME"/>
<jdbc:getColumn name="Next" type="TIMESTAMP" format="SHORT,MEDIUM" locale="ro_RO"/>
<jdbc:getColumn name="Now" type="TIMESTAMP" format="LONG"/>
<jdbc:getColumn name="Amount" type="CURRENCY" locale="de_DE"/>

Since I have no commit rights I will email the
changes I made to Morgan. I tested them today
and so far they are OK.

Cheers,
Marius


Morgan Delagrange wrote:
> 
> --- Marius Scurtescu <ma...@multiactive.com> wrote:
> > Hi Morgan,
> >
> > I will try the new version either today or tomorrow.
> > The original version did not work out of the box
> > for me and I had to make a few, small, modifications
> > and recompile.
> >
> > From the top of my head, the changes I made were:
> > - added a String version to a setter method to make
> > it work with JRun (this was confirmed to be a JRun
> > problem but the fix is so simple that it is worth
> > doing)
> 
> Sure, I didn't get a chance to create String setter
> methods for all the tags.  If you want to fix it, feel
> free!
> 
> > - added a "name" attribute to the getter methods so
> > you can retrieve fields by name as well
> > - added validation code to the getter TEI class to
> > check that
> > only one of "position" or "name" attributes is used
> 
> Yeah, I changed my mind about that; it sounds like a
> good idea now.  If you want to tackle it, please do.
> 
> Thanks, Marius!
> 
> - Morgan
> 
> P.S. WTF is up with all these "Undelivered Mail
> Returned to Sender" emails we've been getting from the
> list this week?  Who is this?
> 
> <jo...@localhost.suninternet.com>: Name service error
> for domain
>     localhost.suninternet.com: Host not found
> 
> =====
> Morgan Delagrange
> Britannica.com
> 
> __________________________________________________
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/

-- 
------------------
Marius Scurtescu, Software Engineer
Tel: (604) 899-2835 Fax: (604) 899-2899
mailto:marius@multiactive.com
Multiactive Software Inc. http://www.multiactive.com
------------------
Attract and retain customers with Multiactive Software --
proud winners of PC WEEK's "Best of COMDEX" award.
------------------

Re: release JDBC tag library

Posted by Morgan Delagrange <md...@yahoo.com>.
--- Marius Scurtescu <ma...@multiactive.com> wrote:
> Hi Morgan,
> 
> I will try the new version either today or tomorrow.
> The original version did not work out of the box
> for me and I had to make a few, small, modifications
> and recompile.
> 
> From the top of my head, the changes I made were:
> - added a String version to a setter method to make
> it work with JRun (this was confirmed to be a JRun
> problem but the fix is so simple that it is worth
> doing)

Sure, I didn't get a chance to create String setter
methods for all the tags.  If you want to fix it, feel
free!

> - added a "name" attribute to the getter methods so
> you can retrieve fields by name as well
> - added validation code to the getter TEI class to
> check that
> only one of "position" or "name" attributes is used

Yeah, I changed my mind about that; it sounds like a
good idea now.  If you want to tackle it, please do.

Thanks, Marius!

- Morgan

P.S. WTF is up with all these "Undelivered Mail
Returned to Sender" emails we've been getting from the
list this week?  Who is this?

<jo...@localhost.suninternet.com>: Name service error
for domain
    localhost.suninternet.com: Host not found


=====
Morgan Delagrange
Britannica.com

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Re: release JDBC tag library

Posted by Marius Scurtescu <ma...@multiactive.com>.
Hi Morgan,

I will try the new version either today or tomorrow.
The original version did not work out of the box
for me and I had to make a few, small, modifications
and recompile.