If most of the dynamic statements in an application are likely to be executed many times in the course of a session, proceed as follows:
Set the connection property DYNAMIC_PREPARE to true.
To return PreparedStatement objects containing precompiled statements, use Connection.prepareStatement( ) in the standard way:
PreparedStatement ps_precomp = Connection.prepareStatement(sql_string);
To return PreparedStatement objects containing uncompiled statements, you can use either Connection.prepareCall( ) (see the third bullet under Prepared statements in portable applications) or SybConnection.prepareStatement( ), with dynamic set to “false:”
PreparedStatement ps_uncomp = (SybConnection)conn.prepareStatement(sql_string, false);
PreparedStatement ps_uncomp = Connection.prepareCall(sql_string);
Copyright © 2003. Sybase Inc. All rights reserved. |
![]() |