JDBC连接ORACLE无法登陆java.sql.SQLException: ORA-01017: invalid username/password; logon denied
当用jdbc连接Oracle数据库的时候
private Connection getConnection() throws SQLException
{
OracleDataSource ods = new OracleDataSource();
ods.setUser("biaoJM");
ods.setPassword("123456");
ods.setURL("jdbc:oracle:thin:@localhost:1521:orcl");
return ods.getConnection();
}
出现:
java.sql.SQLException:ORA-01017: invalid username/password; logon denied
…
但是我在sqlplus中可以登录
可能的原因如下:
Checklistfor ORA-01017 errors:
select username from dba_users;
The core issue with anORA-01017 error is an invalid user ID and passwords combination, but other thanan incorrect password, there are user ID issues that may contribute to theORA-01017 error:
- It may be that the userID is invalid for the target system - The user ID exists as theusername columnin the dba_users view.
- Check your $ORACLE_SIDenvironmental parameter. If your $ORACLE_SID is set to the wrong systemID then you may get a ORA-01017 error because you are connecting to the wrongdatabase.
- If using external OS userauthentication (ops$ or remote_os_authent) you need to verify that the user ID is valid. You can tellif you are using external authentication because you connect without providinga user/password combination, and only provide a forward slash to the connectstring, (e.g. connect / as sysdba;).
- Check your tnsnames.ora to ensurethat the TNS service name points to the correct server and instance name. If you specify an incorrect tnsnames.ora service name, thenthe user ID and password may not exist in that database.
我的原因是第二条
在sqlplus用conn as sysdba登陆
用select name from V$database; 查看当前的SID,发现是FIRSTDB
那么我的URL应该将orcl改为FIRSTDB
之后就可以了
我的Oracle一共有两个数据库,分别为orcl和firstdb,这个可以执行Oracle中的administration assistance for Windows查看:
注:Oracle安装目录下有JDBC的文件夹,里面有一份文档很有参考价值,说明了如何配置以及如何使用
D:\app\Administrator\product\11.2.0\dbhome_1\jdbc
JDBC连接ORACLE无法登陆java.sql.SQLException: ORA-01017: invalid username/password; logon denied的更多相关文章
- LR连接oracle时出现:SQLState=28000[Oracle][ODBC][Ora]ORA-01017:invalid username/password;logon denied
出现的现象:
- Oracle使用命令行登录提示ERROR: ORA-01017: invalid username/password; logon denied
刚在Windows上面安装好Oracle 10g,刚开始使用PLSQLDevelop软件登录提示 not logged on ,然后使用命令行登录提示 ERROR: ORA-01017: inval ...
- sqlplus登录Oracle时ORA-01017: invalid username/password; logon denied的错误
今天用scott用户登录Oracle数 据库时,竟然出现了ORA-01017: invalid username/password; logon denied错误,原以为是因为我的scott用户没有解 ...
- Oracle 12C 密码文件问题 ORA-01017: invalid username/password; logon denied
新安装的Oracle 12.1.0.2.0,NBU在测试备份的时候报ORA-01017 --alter user sys identified by "Wwjd!23";sqlpl ...
- oracle 12c ORA-01017:invalid username/password; logon denied
Oracle 12C 中,想通过操作系统认证登录Oracle 数据库,有一些要注意的地方.不然就会遇到 ORA-01017:invalid username/password; logon denie ...
- 登录PL/SQL无法登录,提示错误:ORA-01017: invalid username/password; logon denied 错误
在使用在登录PL/SQL(使用scott用户)无法登录,提示错误:ORA-01017: invalid username/password; logon denied 错误(程序中的用户和密码无法登录 ...
- Oracle SQLDeveloper ORA-01017 invalid username/password;logon denied (密码丢失解决方案)
oracle sys账号用sql developer工具无法登陆 用户名和密码不一致 如果的确是丢失密码的话:在SQL*Plus中执行如下命令: SQL>conn/as sysdba (操作 ...
- Oracle 数据库基础 出现invalid username/password; logon denied错误解决方案
出现invalid username/password; logon denied错误解决方案 [win7或win8中 cmd要以管理员身份运行] 1.Dos下输入命令:sqlplus sys/安装时 ...
- 2016.11.10 Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver
运行项目rds_web时,出现错误提示:Could not get JDBC Connection; nested exception is java.sql.SQLException: No sui ...
随机推荐
- 关于webuploader跨域解决方法
1.在iis处理程序映射 2.后台ashx处理添加如下代码
- BZOJ 2005 容斥原理
思路: 题目让求的是 Σgcd(i,j) (i<=n,j<=m) n,m不同 没法线性筛 怎么办? 容斥原理!! f[x]表示gcd(i,j)=x的个数 g[x]为 存在公约数=x 的数对 ...
- 洛谷P2118 比例简化(暴力)
题目描述 在社交媒体上,经常会看到针对某一个观点同意与否的民意调查以及结果.例如,对某一观点表示支持的有1498 人,反对的有 902人,那么赞同与反对的比例可以简单的记为1498:902. 不过,如 ...
- pthread_cleanup_push
#define pthread_cleanup_push(func, val) \ { \ struct __darwin_pthread_handler_rec __handler; \ pthre ...
- Thread-local storage
Thread-local storage (TLS) is a computer programming method that uses static or global memory local ...
- vector迭代器
https://www.cnblogs.com/quant-lee/p/6618829.html
- Hadoop_HDFS-基础知识摘要
Hadoop典型应用有:搜索.日志处理.推荐系统.数据分析.视频图像分析.数据保存等.0.数据要首先分块 Block:将一个文件进行分块,通常是64M. NameNode:--管理节点保存整个文件系统 ...
- React+Webpack+ES6环境搭建(自定义框架)
引言 目前React前端框架是今年最火的.而基于React的React Native也迅速发展.React有其独特的组件化功能与JSX的新语法,帮助前端设计有了更好的设计与便捷,而React Nati ...
- WCF客户端获取服务端异常[自定义异常]
引言 经过不断的摸索,询问/调试,终于学会了关于WCF客户端与服务端之间异常的处理机制,在此来记录自己的成果,用于记录与分享给需要的伙伴们. 首先感谢[.NET技术群]里群主[轩]的大力帮助,如有需要 ...
- H3C S5130交换机堆叠操作
配置过程中注意事项: 1.最好提前定义好IRF的主从设备,可通过IRF优先级进行定义,越大越优 2.一定要在使能IRF之前就保存配置(因为使能过程中,会出现设备重启的情况,如果设备重启后配置丢失,会导 ...