import java.sql.*;public class testJDBC {
public static void main(String[] args) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
//new oracle.jdbc.driver.OracleDriver();
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.101:1521:orcl","scott","890415");
Statement stmt = conn.createStatement();
ResultSet re = stmt.executeQuery("select * from user_col_comments");
while (re.next()){
System.out.println(re.getString("TABLE_NAME"));
}
re.close();
stmt.close();
conn.close();
}
}
ps:在命令行下能用scott登陆 scott为dba权限
请问是什么原因
public static void main(String[] args) throws Exception {
Class.forName("oracle.jdbc.driver.OracleDriver");
//new oracle.jdbc.driver.OracleDriver();
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.101:1521:orcl","scott","890415");
Statement stmt = conn.createStatement();
ResultSet re = stmt.executeQuery("select * from user_col_comments");
while (re.next()){
System.out.println(re.getString("TABLE_NAME"));
}
re.close();
stmt.close();
conn.close();
}
}
ps:在命令行下能用scott登陆 scott为dba权限
请问是什么原因
在默认情况下 scott是锁定的
用system as dba登录
执行下面的语句
alter user scott account unlock;
开始的时候 scott是锁定的
但解锁之后就出现了invalid username/password; logon deni的情况。
我解锁用的是sys账号 没有要密码
你在sqlplus里是怎么登录的?
DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.101:1521:orcl","scott","\"890415\"");
在sqlplus中 sqlplus scott/890415 as sysdba改成六楼这样还是不行。。还是报ORA-01017: invalid username/password; logon denied