0

我正在编写一个遇到此问题的 jdbc 程序:名称已被现有对象使用。

 try
    {
        Class.forName("oracle.jdbc.driver.OracleDriver");
    }

    catch(ClassNotFoundException ex)
    {
        ex.printStackTrace();
    }

    Connection con=null;

    Statement stmt=null;

     con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","moon");

    stmt=con.createStatement();

     stmt.execute("create table emp4090(eno int,ename varchar(20))");

       System.out.println("Done successfully");

运行此程序时出现错误。

  Exception in thread "main" java.sql.SQLException: ORA-00955: name is already used by an existing object

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1688)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1654)
at com.aol.jdbc.Jdbc.main(Jdbc.java:26)
4

1 回答 1

1

它很简单,当您创建表时,您无法在第二次创建她。尝试删除表,然后重新创建它。

于 2015-06-26T11:07:56.223 回答