Article View: borland.public.jbuilder.java.language
Article #15250Size limitation of java.sql.PreparedStatement.setString() ??
From: Carey Gibson/Gregg Carrier
Date: Sun, 27 Jun 1999 00:00
Date: Sun, 27 Jun 1999 00:00
47 lines
2417 bytes
2417 bytes
Hi,
Not really a JBuilder question per se, although I am using JBuilder on
this project...but, heck, y'all seem pretty sharp ;)
I am having a peculiar bit of difficulty using a PreparedStatement to
update an Access database
via the JDBC-ODBC driver. When I use the setString method and insert a
value into my
PreparedStatement that is longer than about 230 characters, it
truncates the String and enters
only the first 230 characters into the DB. Is there a different seXXX
method of PreparedStatment
that is more appropriate to use?
I have ruled out the database as the problem, since cutting and pasting
large blocks of text
directly into these fields (Access type 'memo') works fine. If I test
the value of the String in
question just before it is inserted into the PreparedStatement, it is
still intact. Likewise, if I
assemble my SQL statement as a String and execute the update via
Statement.executeUpdate(),
everything works fine. I need to avoid executing my SQL in this way,
however, as I need to
accomodate user input that may contain double quotes and other hairy
characters that can throw
things off if not used in a PreparedStatement.
Here's a rough example of my sitch:
String longString = (a string of about 800 characters say);
PreparedStatement ps =
conn.prepareStatement("UPDATE Table SET
Column1=? WHERE Col2=43"); pstmt.setString(1,longString);
pstmt.executeUpdate();
Results: the first 230 characters are inserted into 'Column1' of
'Table'. Any thoughts/similar
experience? Tia.
Gregg
-**** Posted from RemarQ, http://www.remarq.com/?c ****-
Search and Read Usenet Discussions in your Browser
Technical Details
Message-ID:
<y2vd3.20141$me.10215534@WReNphoon4>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,b255404f77974144,start X-Google-Attributes: gidf74b3,public From: barley@pacific.net (Carey Gibson/Gregg Carrier) Subject: Size limitation of java.sql.PreparedStatement.setString() ?? Date: 1999/06/27 Message-ID: <y2vd3.20141$me.10215534@WReNphoon4> X-Deja-AN: 494512948 X-Trace: WReNphoon4 930512158 10.0.2.25 (Sun, 27 Jun 1999 12:35:58 PDT) Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here X-Originating-Host: 206.184.5.113 NNTP-Posting-Date: Sun, 27 Jun 1999 12:35:58 PDT Newsgroups: borland.public.jbuilder.java.language