JDBC之使用错误

来源:互联网 发布:哪个软件起名好 编辑:程序博客网 时间:2024/05/17 23:26

url填写误

No suitable driver found for

指定了无效的 Oracle URL

找不到连接的驱动,主机名前面的信息填写错误

The Network Adapter could not establish the connection

主机名或端口书写错误

Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

SID书写错误

用户名/口令无效; 登录被拒绝

使用JDBC连接,执行错误

用户名或者密码不正确

ORA-01008: 并非所有变量都已绑定

有可能是执行了2次sql语句,已经被覆盖了

String sql = "SELECT * FROM robin_demo_swm " + "WHERE name LIKE ?";PreparedStatement ps = conn.prepareStatement(sql);ps.setString(1, "%w%");ResultSet rs = ps.executeQuery(sql); <-- 此处不应有sql

ORA-00933: SQL 命令未正确结束

检查你要执行的SQL语句是否正确,切记检查空格是否书写!!!

JdbcTemplate queryForInt/Long is deprecated

代替的方法为queryForObject(String sql, Object[] args, Class requiredType)。
需要返回的是什么类型,就在第三个参数写什么类型。比如int类型就写Integer.class. long类型就写Long.class

Could not load JDBC driver class [com.mysql.jdbc.Driver]

1。检查路径是否写对
2。检查如果导入jar包》mysql-connector-java.jar

java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required

CLIENT_PLUGIN_AUTH is required
clent插件认证,原因是用的6.几版本jar包,可能跟你的客户端版本不对,换一个版本比如5.0几

0 0
原创粉丝点击