setXXXStream???????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
ASCII?????????????????????????????????????????????
Unicode?????????????????????????????????????????????
JDBC 2.0???JDBC 3.0?????????????????????????????????????????????????????????????????????Derby?????????????????????????????????JDK 1.5?????????????????????????????????????????????????????????????????????JDK1.6????????????????????????Derby???JDBC4.0???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????Java??????????????????????????????????????????????????????java.io.InputStream???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Statement s = conn.createStatement();
s.executeUpdate("CREATE TABLE atable (a INT, b LONG VARCHAR)");
conn.commit();
java.io.File file = new java.io.File("derby.txt");
int fileLength = (int) file.length();
// ?????????????????????????????????????????????
java.io.InputStream fin = new java.io.FileInputStream(file);
PreparedStatement ps = conn.prepareStatement(
"INSERT INTO atable VALUES (?, ?)");
ps.setInt(1, 1);
// ??????????????????????????????????????????????????????????????????
ps.setAsciiStream(2, fin, fileLength);
ps.execute();
conn.commit();