Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: JSP & Oracle (opinions follow)
This looks like a good solution. However In my experience too many developers use scrollable results sets when they don't need them. This is (or can be) a huge waste of resources. Like Sybrand I don't know a whole lot about Java and in particular JSP, but I'm not completely unfamiliar with it. If all you are doing with your result set is displaying it in a web page, all you should ever need is a read-only forward recordset. In my experience scrolling, especially scrolling updateable recordsets are way too expensive in terms of client and server resources and are almost always used if the developer possibly can.
-- Niall Litchfield Oracle DBA Audit Commission UK "Matz" <matz_at_ossis.de> wrote in message news:96u4el$dm8$00$1_at_news.t-online.com...Received on Tue Feb 20 2001 - 10:43:15 CST
> "Sybrand Bakker" <oradba_at_sybrandb.demon.nl> wrote
> > Word of advice: one of the most frequent issues I am having with jsp
developers
> > they always build sql like above example, and they *never* use
parameters.
> > I know you can do that in jdbc, and you should do that wherever you can,
because
> > using hardcoded literals instead of parameters is one of the most safe
> > performance killers: you will force Oracle to perform an hard parse.
>
> Thanks alot for this tip! I was one of those imps until now ;) shame!
>
> > I know almost zilch about JSP, but this looks quite obvious.
> > In Oracle resultsets you can only move forward.
>
> Hmm but scrolling through resultsets works for me (with JDBC2):
>
> /* create a statement explicitly scrollable */
> Statement s =
> some_connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
> ResultSet.CONCUR_READ_ONLY);
>
> > > String sqlActu = "";
> > >
> > > sqlActu = "SELECT Titre FROM Actualite ";
> > > sqlActu = sqlActu + "WHERE Status='V' ";
> > > sqlActu = sqlActu + "AND DateDebutAffichage <= " +
> > >myUtil.DateRequest(Calendar.getInstance()) + " ";
> > > sqlActu = sqlActu + "AND DateFinAffichage >= " +
> > >myUtil.DateRequest(Calendar.getInstance()) + " ";
>
> ResultSet rs = s.executeQuery(sqlActu);
>
> now you can do all the scrolling stuff (last(), absolute()...)
>
> Maybe you need the newset ODBC and JDBC drivers from Oracle (don't use the
> Microsoft driver).
>
>
> Matz
>
>
>