我已经读过 为什么在尝试在db中加载blob时会得到java.lang.AbstractMethodError?,下载了我能找到的所有11g jdbc驱动程序,并将它们作为库和/或jar文件添加到我的NetBeans应用程序中.我仍然继续得到相同的AbstractMethodError,这让我变得多了!任何指导将不胜感激!
try {
stmt = conn.createStatement();
inputFileInputStream = new FileInputStream(inputBinaryFile);
Blob vBlob = conn.createBlob();
BufferedImage vGImage=ImageIO.read(name);
int offset =0;
OutputStream out = vBlob.setBinaryStream(offset);
ImageIO.write(vGImage, "JPG", out);
PreparedStatement stat = conn.prepareStatement("INSERT INTO item VALUES (?,?,?,?,?)");
stat.setString(1, itemNo);
stat.setString(2, itemName);
stat.setBlob(3,vBlob);
stat.setString(4, invenType);
stat.setDouble(5, vPrice);
stat.executeUpdate();
} catch (IOException e) {
System.out.println("Caught I/O Exception: (Write BLOB value - Put Method).");
e.printStackTrace();
throw e;
} catch (SQLException e) {
System.out.println("Caught SQL Exception: (Write BLOB value - Put Method).");
System.out.println("SQL:\n" + …Run Code Online (Sandbox Code Playgroud)