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 ...
随机推荐
- C#各个版本中的新增特性详解【转】
序言 自从2000年初期发布以来,c#编程语言不断的得到改进,使我们能够更加清晰的编写代码,也更加容易维护我们的代码,增强的功能已经从1.0搞到啦7.0甚至7.1,每一次改过都伴随着.NET Fram ...
- 关于exsi的虚拟网络
相关术语: VM Network 默认的网络 VSwitch (默认)标准交换机 (exsi的内核中) Port groups (用来定义各个不同vlan) DVSwitch分布式交换机(exs ...
- ActiveMQ学习笔记(15)----Message Dispatch高级特性(一)
1. Message Cursors 1.1 概述 ActiveMQ发送持久化消息的典型的厝里方式是:当消息的消费者准备就绪时,消息发送系统把存储的消息按批次发送给消费者,在发送完一个批次的消息后,指 ...
- SpringBoot学习笔记(10)-----SpringBoot中使用Redis/Mongodb和缓存Ehcache缓存和redis缓存
1. 使用Redis 在使用redis之前,首先要保证安装或有redis的服务器,接下就是引入redis依赖. pom.xml文件如下 <dependency> <groupId&g ...
- 计算a-b的差[返回BigDecimal 类型]
/*** * 返回 a-b 的差 [返回 BigDecimal 类型] * @param a 被减数 * @param b 减数 * @return */ public static BigDecim ...
- centos 7.1安装frees witch
http://blog.sina.com.cn/s/blog_539d6e0c0102zgvm.html
- Springboot+swagger2的接口文档开发
一.创建一个SpringBoot项目 1. 2. 3. 4. 把web里的web选中,SQL里选择自己需要的,点击next 二.创建各项所需的controller,configure等 1. 项目布局 ...
- Springboot错误问题总结
进行springboot+swagger2测试的时候,启动项目发现出现这个问题 把所有的类,配置类都注释掉,不管用,百度搜索之后发现一个解决办法, 半信半疑的加到启动类SpringBootApplic ...
- ip iproute2的典型应用
net-tools和iproute2的命令做对比,做到简单明了,分别演示如何去获取.配置和操作系统网络信息. 以下是net-tools和iproute2的大致对比: 4.1 ip link set-- ...
- 【codeforces 379D】New Year Letter
[题目链接]:http://codeforces.com/contest/379/problem/D [题意] 让你构造出两个长度分别为n和m的字符串s[1]和s[2] 然后按照连接的规则,顺序连接s ...