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 ...
随机推荐
- POJ 1948 DP
题意:给你n个木棍(n<=40)每个木棍长度<=40,问用上所有的木棍拼成的三角形的面积的最大值,并输出面积*100的值(不四舍五入) 如果没有解,输出-1. 思路: 背包判断可达性. f ...
- 计算label
func getCGSize(size:CGSize,fontSize:CGFloat,text:String)->CGSize{ let attributes = [NSFontAttribu ...
- javaBean 练习—封装学生信息
编写一个封装学生信息的JavaBean对象,在页面中调用该对象,并将学生信息输出在页面中. package com.sp.test; public class Student { private St ...
- 【实战经验】64位Win7安装+32位Oracle + PL/SQL 解决方法
软件环境:64位win7.32位Oracle 10g. PL/SQL 9.0.4.1644 前言:以前开发用的都是32位系统,突然换到64位上,安装环境真的有点麻烦了,尤其对于PL/SQL只支持32位 ...
- vs2015汉化
VS2015汉化 VS2015安装打开后默认是英文的,将它改成中文的VS 1.安装下载好的语言包进行安装 2.正在安装 3.安装完成后关闭 4.打开VS2015默认不是中文的,点击Tools--> ...
- WPF 样式
样式是属性值的集合,能被应用到一个元素,类似CSS,每个控件最多只能有一个样式,通过控件的Stype属性应用样式,如下代码,其中BigFontButtonStyle是用于检索资源的关键字,也可以通过代 ...
- 乌班图 之 设置镜像服务器 、设置屏幕分辨率QAQ
设置镜像服务器 Ubuntu 中的大部分软件安装都是用apt命令,从Ubuntu的服务器上直接安装的. 但是国外你懂的网速是硬伤,因此要搞个镜像服务器,内容当然都是一样的咯. 第一步:进入系统设置 第 ...
- 命令行神器 cmder
下载地址:http://cmder.net/ 修改命令提示符λ为$ 进入解压后的 cmder 的目录,进入 vendor,打开 clink.lua 文件. 修改 local cmder_prompt ...
- hiho1055/hdu1561 - 树形dp转换成背包
题目链接 输入:一棵树,每个节点一个权值. 输出:包括1号节点在内的m个节点组成的连通分量的权值和的最大值 hdu1561和hiho1055一样,只是变换了下说法 /***************** ...
- shell-3.bash的基本功能:多命令顺序执行与管道符
1. 2.