[
http://issues.apache.org/jira/browse/DERBY-1292?page=comments#action_12378023 ]
Gerald Khin commented on DERBY-1292:
------------------------------------
Here is a repro:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
public class CCEBatchUpdateRepro {
public static void main(String[] args) {
try {
Class.forName("org.apache.derby.jdbc.ClientDriver");
}
catch(ClassNotFoundException e) {
e.printStackTrace();
System.exit(1);
}
Connection conn = null;
try {
conn =
DriverManager.getConnection("jdbc:derby://localhost:1527/TESTDB");;
conn.setAutoCommit(false);
createTable(conn);
doInserts(conn);
conn.rollback();
conn.close();
}
catch(Exception e) {
e.printStackTrace();
System.exit(1);
}
finally {
if (conn != null) {
try {
conn.rollback();
conn.close();
}
catch (Exception ex) {
}
}
}
System.exit(0);
}
private static void createTable(Connection conn) throws SQLException {
final Statement stmt = conn.createStatement();
try {
stmt.execute("CREATE TABLE CCE_REPRO(text1 VARCHAR(100), text2
CLOB)");
}
finally {
stmt.close();
}
}
private static void doInserts(Connection conn) throws SQLException {
final PreparedStatement stmt = conn.prepareStatement("INSERT INTO
CCE_REPRO(text1,text2) VALUES (?,?)");
try {
stmt.setNull(1, Types.VARCHAR);
stmt.setString(2, "clob");
stmt.addBatch();
stmt.setString(1, "varchar");
stmt.setNull(2, Types.CLOB);
stmt.addBatch();
stmt.executeBatch();
stmt.close();
}
finally {
stmt.close();
}
}
}
> ClassCastException in ClientDriver when using CLOB columns and batch updates
> ----------------------------------------------------------------------------
>
> Key: DERBY-1292
> URL: http://issues.apache.org/jira/browse/DERBY-1292
> Project: Derby
> Type: Bug
> Versions: 10.1.2.1
> Reporter: Gerald Khin
>
> java.lang.ClassCastException: java.lang.String
> at
> org.apache.derby.client.net.NetStatementRequest.computeProtocolTypesAndLengths(Unknown
> Source)
> at
> org.apache.derby.client.net.NetStatementRequest.buildSQLDTAcommandData(Unknown
> Source)
> at org.apache.derby.client.net.NetStatementRequest.writeExecute(Unknown
> Source)
> at
> org.apache.derby.client.net.NetPreparedStatement.writeExecute_(Unknown Source)
> at org.apache.derby.client.am.PreparedStatement.writeExecute(Unknown
> Source)
> at
> org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown
> Source)
> at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown
> Source)
> at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown
> Source)
> at CCEBatchUpdateRepro.doInserts(CCEBatchUpdateRepro.java:71)
> at CCEBatchUpdateRepro.main(CCEBatchUpdateRepro.java:27)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira