![]() |
JDBC Reference
|
Reference Manual |
java.sql.PreparedStatementCloudscape provides all the required JDBC 1.2 type conversions and additionally allows use of the individual setXXX methods for each type as if a setObject(Value, JDBCTypeCode) invocation were made. This means that setString can be used for any built-in target type. The setCursorName method can be used on a PreparedStatement prior to an execute request to control the cursor name used when the cursor is created. Streaming ColumnssetXXXStream requests stream data between the application and the database. JDBC allows an IN parameter to be set to a Java input stream for passing in large blobs of data in smaller chunks. When the statement is executed, the JDBC driver makes repeated calls to this input stream, reading its contents and transmitting those contents as the parameter data. Cloudscape supports the three types of streams that JDBC 1.2 provides. These three streams are: JDBC requires that you specify the length of the stream. Cloudscape does not have this restriction. Instead, you can provide the parameter -1 to indicate "read until the end of the stream." The stream object passed to these three methods can be either a standard Java stream object or the user's own subclass that implements the standard java.io.InputStream interface. Per the JDBC 1.2 standard, streams can be stored only in columns of the data types shown in Table 6-1. Streams cannot be stored in columns of the other built-in data types or of user-defined data types.
A large X indicates the preferred target data type for the type of stream. (See Table 6-3, "Mapping of java.sql.Types to SQL-J Types".) NOTE: In Version 3.6, if the stream is stored in a column of a type other than LONG VARCHAR or LONG VARBINARY, the entire stream must be able to fit into memory at one time. Streams stored in LONG VARCHAR and LONG VARBINARY columns do not have this limitation. The following example shows how a user can store a streamed java.io.File in a LONG VARCHAR column: Statement s = conn.createStatement(); s.executeUpdate("CREATE TABLE atable (a INT, b LONG VARCHAR)"); conn.commit(); java.io.File file = new java.io.File("cloudscape.LOG"); int fileLength = (int) file.length(); // first, create an input stream java.io.InputStream fin = new java.io.FileInputStream(file); PreparedStatement ps = conn.prepareStatement( |
||||||||||||||||||||||||||||
|
![]() Cloudscape Version 3.6 For information about Cloudscape technical support, go to: www.cloudscape.com/support/.Copyright © 1998, 1999, 2000 Informix Software, Inc. All rights reserved. |