JDBC更新SQL时特殊字符怎么处理
答案:2 悬赏:0 手机版
解决时间 2021-02-04 00:16
- 提问者网友:几叶到寒
- 2021-02-03 11:28
JDBC更新SQL时特殊字符怎么处理
最佳答案
- 五星知识达人网友:愁杀梦里人
- 2021-02-03 12:19
代码是:
String oracleurl = "jdbc:oracle:thin:@10.67.176.108:1521:omsdb";
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection oracleconn =
DriverManager.getConnection(oracleurl, "system", "OMS#huawei_com");
String sql = "ALTER USER ossuser IDENTIFIED BY ?";
PreparedStatement oraclestat = oracleconn.prepareStatement(sql);
oraclestat.setString(1, "!Admin123");
int i = oraclestat.executeUpdate();
String oracleurl = "jdbc:oracle:thin:@10.67.176.108:1521:omsdb";
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection oracleconn =
DriverManager.getConnection(oracleurl, "system", "OMS#huawei_com");
String sql = "ALTER USER ossuser IDENTIFIED BY ?";
PreparedStatement oraclestat = oracleconn.prepareStatement(sql);
oraclestat.setString(1, "!Admin123");
int i = oraclestat.executeUpdate();
全部回答
- 1楼网友:第四晚心情
- 2021-02-03 12:38
应该是你字符类型的错误,看看有没有类型跟数据库里面类型不一样的
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯