-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta3
-
x86
-
windows_2000
Name: rmT116609 Date: 08/21/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
I try to insert values into MS Access table field with type Memo using method
setCharacterStream().
import java.sql.*;
import java.io.*;
public class TestMemo
{
public static void main (String[] args) throws Exception {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:LEGO");
Statement stmt = con.createStatement();
try {
stmt.execute("DROP TABLE test_table"); //drop table if exist
} catch (Exception e) {/*do nothing*/}
stmt.execute("CREATE TABLE test_table (test_field longchar)"); //create table with one field (type MEMO)
PreparedStatement ps = con.prepareStatement("INSERT INTO test_table (test_field) VALUES (?)");
String s = "";
for(int i=0; i<555; i++){s = s + "a";} //creates long string
Reader r = new StringReader(s);
ps.setCharacterStream(1, r, s.length());
ps.execute();
}
}
------------------------------------------------------------------------------
The output is
Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC
Microsoft Access Driver]Invalid precision value
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterAtExec(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setStream(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setCharacterStream(Unknown Source)
at TestMemo.main(TestMemo.java:21)
The same problem occurs with JDK1.4.0-beta
Acctually Bug ID: 4401822 does not cover the problems with setCharacterStream, but with setString method.
(Review ID: 130121)
======================================================================