1

I am new to oracle and I am trying to use IntelliJ IDEA Database browser to see my data and my tables..

I did a basic install of oracle xe on my linux computer and the following java code does a insert and also will return all the data:

try {
            //step1 load the driver class
            Class.forName("oracle.jdbc.driver.OracleDriver");

            //step2 create  the connection object
            Connection con = DriverManager.getConnection(
                    "jdbc:oracle:thin:@localhost:1521:xe", "system", "xxx");

            //step3 create the statement object
            Statement stmt = con.createStatement();

            //step4 execute query
            Boolean ret = stmt.execute("insert into emp values (1, \'John\', 43)");

            ResultSet rs = stmt.executeQuery("select * from emp");
            while (rs.next())
                System.out.println(rs.getInt(1) + "  " + rs.getString(2) + "  " + rs.getString(3));

            //step5 close the connection object
            con.close();

but if I try to use IntelliJ IDEA database browser I dont see any XE dabase or my table.. but I am using the same connect data.

here is what I see on the screen

enter image description here

Can someone please tell me where I should be looking for my table and data.. thanks

4

1 回答 1

3

每台机器只有一个 Oracle XE 数据库。在该单一数据库中,您将拥有许多模式。许多这些模式是默认安装的(即SYSSYSTEM等)。如果您来自不同的数据库产品,那么 MySQL 或 SQL Server 所称的“数据库”与 Oracle 所称的“模式”最为相似。

根据您发布的 Java 代码,您似乎可能在模式中创建了一个EMP表。SYSTEM这是个坏主意——你永远不应该在SYSorSYSTEM模式中创建新对象。您应该创建一个新模式来保存您想要创建的任何新对象。在 IntelliJ 中,您似乎应该能够转到SYSTEM架构以找到您的表和您插入的数据。但是,同样,您不应该SYSTEM首先在模式中创建对象。

于 2013-07-25T17:20:34.497 回答