Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: JSP & Oracle

Re: JSP & Oracle

From: Matz <matz_at_ossis.de>
Date: Tue, 20 Feb 2001 16:59:20 +0100
Message-ID: <96u4el$dm8$00$1@news.t-online.com>

"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 Received on Tue Feb 20 2001 - 09:59:20 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US