我正在尝试将值保存在数据库中,但我收到此错误
我试过这个
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
try {
// TODO add your handling code here:
captureScreen("img.jpg");
} catch (Exception ex) {
Logger.getLogger(frontendUI.class.getName()).log(Level.SEVERE, null, ex);
}
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("driver loaded");
}
catch(ClassNotFoundException ex) {
System.out.println("driver not loaded");
}
String URL = "jdbc:oracle:thin:@localhost:1521:xe";
String Username = "system";
String Password = "toushif";
try {
con = DriverManager.getConnection(URL,Username,Password);
st=(Statement) con.createStatement();
String sql="insert into TOU3(file123) values('"+abc+"')";
st.executeUpdate(sql);
}
catch(Exception e) {
e.printStackTrace();
}
/**
* @param args the command line arguments
*/
}
2条答案
按热度按时间efzxgjgh1#
试试看
z18hc3ub2#
如果要将字符串插入BLOB类型,则需要使用
getBytes()