user2428795
user2428795

Reputation: 547

Using IntelliJ IDEA with Oracle XE.. I dont see database or table?

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

Upvotes: 1

Views: 2353

Answers (1)

Justin Cave
Justin Cave

Reputation: 231661

There is only one Oracle XE database per machine. Within that single database, you'll have a number of schemas. Many of those schemas are installed by default (i.e. SYS, SYSTEM, etc.). If you are coming from a different database product, what MySQL or SQL Server calls a "database" is most similar to what Oracle calls a "schema".

Based on the Java code you posted, it appears that you probably created an EMP table in the SYSTEM schema. That is a bad idea-- you should never create new objects in the SYS or SYSTEM schema. You should be creating a new schema to hold any new objects that you want to create. In IntelliJ, it appears that you should be able to go to the SYSTEM schema to find your table and the data you inserted. But, again, you shouldn't be creating objects in the SYSTEM schema in the first place.

Upvotes: 3

Related Questions