This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Row Size Problem  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got following exception when inserting a record in a table using PreparedStatement:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot create a row of size 8192 which is greater than the allowable maximum of 8060.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:2533)
The code likes:
String strSQL = "INSERT INTO Announce (Title, Content, AnnounceType) VALUES (?, ?, ?)";
PreparedStatement ps = con.prepareStatement(strSQL);
ps.setString(1, "Test");
ps.setString(2, "Hello");
ps.setString(3, "School");
ps.execute();
The Announce table likes:
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[Title] [nvarchar] (50) NULL ,
[Content] [nvarchar] (4000) NULL ,
[AnnounceType] [nvarchar] (20) NULL ,
It works if using Statement to insert the record. But I prefer PreparedStatement because it is easy to handle single quotation problem. Can anyone help me solve this problem?
Thanks.
Nanchun
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Content] [nvarchar] (4000) NULL ,
I believe PreparedStatement.setString() has a limit to the length of the String to be set. In some databases you can get around this limit by streaming the text to/from the database:
just a guess, not too familiar SQL server drivers
Jamie
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!