我试图从
java程序执行sql命令..我没有关于此代码的任何错误..但我面临来自数据库的连接拒绝..
import java.sql.*;
public class DBCreateTable
{
public static void main(String args[]) throws Exception
{
DriverManager.registerDriver (new Oracle.jdbc.driver.OracleDriver());
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe","lms","abc");
Statement stmt=con.CreateStatement();
stmt.executeUpdate("create table emp(eno number(5),name varchar2(20))");
}
}
遇到的错误是:
Exception in thread "main" java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=185599488)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:404)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:221)
at DBCreateTable.main(DBCreateTable.java:7)
在我的sql命令中,我已完成以下操作..
SQL> connect system/tiger;
SQL> create user lms identified by abc;
SQL> grant connect,resource to lms;
并告诉我什么是斯科特老虎..我在那里弄得很多……那里的用户是什么……解锁怎么样?谢谢..