| Author |
SQLException: No more data to read from socket
|
Ankit Doshi
Ranch Hand
Joined: Dec 04, 2002
Posts: 222
|
|
Hi, I came across this error and spent a few hours before I could get rid of it, hence thought of posting it here in case it may be useful to others. While trying to run the below update statement from my Java code, I was getting the SQLException: No more data to read from socket from the executeUpdate method call. When I removed the single quotes from the query (like below), it worked. By the way, anyone knows the reason why it doesn't work WITH single quotes? -Ankit
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26496
|
|
Originally posted by Ankit Doshi: By the way, anyone knows the reason why it doesn't work WITH single quotes?
That would depend on your database driver and whether the columns were char/varchar or numeric.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Ankit Doshi
Ranch Hand
Joined: Dec 04, 2002
Posts: 222
|
|
I'm sorry, I forgot to mention that. I used the OracleDriver and the columns were varchar2.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26496
|
|
|
Odd. Maybe it's a driver bug?
|
 |
teemrap hgnis
Greenhorn
Joined: Apr 26, 2009
Posts: 2
|
|
this is because you populate the prepared statement params using the data type call
.setString(...) or .setInteger(...) etc therefore you dont need to put the quotes.
When you get a PreparedStatement from connection the passed query is compiled and stored into Oracle so every time its just the params that are populated using the setters.
|
 |
 |
|
|
subject: SQLException: No more data to read from socket
|
|
|