Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 24th, 2006, 07:22 AM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Java

i am tring to create a text area that can be inserted into an oracle field.i am hoping to set the text area up with no restrictions on the entries,but am having trouble dealin with single quotation,&,$ and @.

 
Old February 13th, 2006, 05:36 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should be using PreparedStatement's for inserting data into your database. Here is the PreparedStatement example from the J2SE 1.4.2 API specification:

   PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?");
   pstmt.setBigDecimal(1, 153833.00)
   pstmt.setInt(2, 110592)

See how the SQL values are supplied outside of the statement's definition? Doing this ensures that the parameters you're inserting are properly escaped, and more importantly, that they don't inject user-supplied SQL into your database. (SQL injections can drop your database tables or retrieve database rows that you never intended!)


Jon Emerson
http://www.jonemerson.net/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Root Cause:java.lang.NoSuchMethodError: java.util. anees81 JSP Basics 3 March 1st, 2011 08:55 AM
java.lang.OutOfMemoryError: Java heap space meetkotresh J2EE 1 February 2nd, 2008 01:52 AM
Java Media Framework(I am new to java) amirdiwan4eva Pro Java 4 July 12th, 2006 04:50 AM
Java Code - Wrox - Beginning JAVA - Ivor Horton ponguru Java Databases 3 May 18th, 2006 12:30 PM
Java vs Java Script functions joemorrison74 J2EE 0 July 6th, 2005 04:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.