File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Prepared Statements Limited in Size?? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Prepared Statements Limited in Size??" Watch "Prepared Statements Limited in Size??" New topic
Author

Prepared Statements Limited in Size??

Gale Greaser
Greenhorn

Joined: Aug 05, 2002
Posts: 17
Hello!
Here is the Prepared Statement I am trying to execute:
ps.modifyRecord = "UPDATE Log SET date_recv = ?, patient_name = ?, is_new_patient = ?, med_rec_nbr = ?, person_recv_intake = ?, uwhc_uwmf = ?, responsible_party = ?, address = ?, zipcode = ?, birthdate = ?, referred_by = ?, prev_med_care = ?, prim_care_physician = ?, reason_left_prev_provider = ?, reason_for_visit = ?, statement_sent_recv = ?, appropriate_facility = ?, comments = ?, needs_fin_screening = ?, decision = ?, updated_by = ?, date_updated=default WHERE record_id = ?
* When I replace the question marks with real data, wrap it in a Java Statement, it works just fine.
* However, when I execute it as a prepared statement:
// Set SQL Insert Information
psInsert.setString( 1, "2/2/2000");
psInsert.setString( 2, "sd" );
psInsert.setString( 3, "sd" );
psInsert.setString( 4, "12" );
psInsert.setString( 5, "sd" );
psInsert.setString( 6, "sd");
psInsert.setString( 7, "sd");
psInsert.setString( 8, "sd" );
psInsert.setString( 9, "12" );
psInsert.setString( 10, "1/3/2000" );
psInsert.setString( 11, "sd" );
psInsert.setString( 12, "sd");
psInsert.setString( 13, "sd" );
psInsert.setString( 14, "sd" );
psInsert.setString( 15, "123" );
psInsert.setString( 16, "123" );
psInsert.setString( 17, "123" );
psInsert.setString( 18, "123" );
psInsert.setString( 19, "123" );
psInsert.setString( 20, "123");
psInsert.setString( 21, "user" );
psInsert.setString(22, "1");

// Execute
psInsert.executeUpdate();

... I get this error:
Exception: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The identifier that starts with 'UPDATE Log SET date_recv = @P1, patient_name = @P2, is_new_patient = @P3, med_rec_nbr = @P4, person_recv_intake = @P5, uwhc_uwmf' is too long. Maximum length is 128.
* I'm terribly confused - can Prepared Statements only be of a finite size?
* Please help - Thanks in Advance!

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Prepared Statements Limited in Size??
 
Similar Threads
Getting name of CallableStatement before execute?
multiple prepared statemnets using executeBatch
PreparedStatement
Prepared Statement - only for field values?
preparedStatement