JDBC Type 4 Driver Programmer's Reference for SQL/MX Release 3.2 (H06.25+, J06.14+)
Thread-safe SQL/MX Access
In the Type 4 driver, API layer classes are implemented as instance-specific objects to ensure thread
safety:
• SQLMXDataSource.getConnection() is implemented as a synchronized method to
ensure thread safety in getting a connection.
• After a connection is made, the connection object is instance-specific.
• If multiple statements are run on different threads in a single connection, statement objects are
serialized to prevent data corruption.
"Update ... Where Current of" Operations
When performing an update ... where current of cursor SQL statement, the fetch size
on a ResultSet must be 1.
If the value of the fetch size is greater than 1, the result of the update ... where current of
operation might be one of the following:
• An incorrect row might be updated based on the actual cursor position.
• An SQLException might occur, because the cursor being updated might have already been
closed.
NOTE: By default, the fetch size is 1.
The following is an example of setting a result set fetch size to 1 and executing an update ...
where current of cursor SQL statement.
ResultSet rs;
... rs.setFetchSize(1);
String st1 = rs.getCursorName();
Statement stmt2 = connection.createStatement( ResultSet.TYPE_FORWARD_ONLY
, ResultSet.CONCUR_UPDATABLE );
stmt2.executeUpdate("UPDATE cat2.sch2.table1
set j = 'update row' WHERE CURRENT OF " + st1);
Internationalization (I18N) Support
“String Literals Used in Applications” (page 28)
“Controlling String Literal Conversion by Using the Character-Set Properties” (page 29)
“Trimming Padding for Fixed-Length Character Columns” (page 31)
“Localizing Error Messages and Status Messages” (page 32)
String Literals Used in Applications
Internationalization support in the driver affects the handling of string literals. The Type 4 driver
handles string literals in two situations:
• The driver processes an SQL statement. For example:
Statement stmt = conection.getStatement();
stmt.execute(“select * from table1 where col1 = ‘abcd’”);
• The driver processes JDBC parameters. For example:
PreparedStatement pStmt = connection.prepareStatement(“select * from table1 where col1 = ?”);
pStmt.setString(1, “abcd”);
To convert a string literal from the Java character set to an array of bytes for processing by the
SQL/MX engine, the Type 4 driver uses the column type and character set in the database. For
28 Accessing SQL Databases with SQL/MX










