Hmm, odds are that a project small enough to not require a database
layer is small enough to not require struts either. 

Heck if you have 5 pages, why use either, just use the SQL tags in jstl
and be done with it.

Larry

>>> [EMAIL PROTECTED] 10/24/03 10:52 AM >>>

--- Vic Cekvenich <[EMAIL PROTECTED]> wrote:
> Best practice is not to code to JDBC. (Just like do not code to
servlet 
> but to Struts).

JDBC is a perfectly suitable technology to use for persistence.  Not
every
project requires an O/R mapping tool.

> Best practice is to USE a DAO, like iBatis or Hibernate, thus not
having
> 
> to code to low level API, but just the application itself and use 
> persistence, as opposed to bit twiddling. 

Using DAOs is certainly a best practice but does not preclude the use of
JDBC.  Your DAOs can be implemented using a variety of technologies
including JDBC, XML, EJB, Hibernate, etc...

> Take a look at DB Layer .PDF 
> on iBatis.com.

The Jakarta Commons DbUtils project greatly simplifies JDBC coding. 
It's
in the sandbox right now but it's moving towards promotion to commons
proper.

http://jakarta.apache.org/commons/sandbox/dbutils/index.html

David

> .V
> 
> Sasha Borodin wrote:
> > You could use a PreparedStatement, which automatically escapes
single
> > quotes, I believe:
> > 
> >            String sqlStmt = "INSERT INTO table1 (col1) VALUES (?)";
> > 
> >            pstmt = con.prepareStatement(sqlStmt);
> >                 
> >            pstmt.setString(1, someStringWhichMightHaveQuotes);
> >                    
> >            rs = pstmt.executeQuery();
> > 
> > HTH,
> > 
> > -Sasha
> > 
> > 
> > 
> > On 10/24/03 09:42, "Manuel Lenz" <[EMAIL PROTECTED]> wrote:
> > 
> > 
> >>
> >>
> >>
> >>
> >>I create DB-Inserts from my struts application.
> >>But If an user types in the sign ' any dynamicly created inserts
fail.
> >>This ist because of the sql-syntax which divides the string which
will
> be
> >>saved with '.
> >>
> >>For example: insert into table test (name, number) values ('mr
burns',
> >>'01723256477');
> >>
> >>How can I handle inserts in html-formulars which have the typed sign
'
> ?
> >>
> >>Greetings,
> >>Manuel
> >>
> >>
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> 
> -- 
> Victor Cekvenich,
> Struts Instructor
> (215) 321-9146
> 
> Advanced Struts Training
> <http://basebeans.com/do/cmsPg?content=TRAINING> Server Side Java
> training with Rich UI, mentoring, designs, samples and project
recovery
> in North East.
> Simple best practice basic Portal, a Struts CMS, Membership, Forums,
> Shopping and Credit processing, <http://basicportal.com> software,
ready
> to develop/customize; requires a db to run.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to