You are on page 1of 15

Oracle JDeveloper 系列文章

第二章:Oracle JDeveloper 與 Oracle 資料庫


繼上次第一部份的介紹,相信大家對於 Oracle JDeveloper 有了初步的認識,本
文繼續針對 Oracle JDeveloper 的功能介紹,因為 Oracle 本身是做資料庫出身
所以針對 Oracle 資料庫也提供相當好的整合,在此,為大家示範一下:

在 Connection 中包括很多整合的項目,其中包括 Application Server,可以提供


你直接和 Application Server 的連接,方便你做程式 Deploy,也包括 Database,
可以直接和 Oracle DB 整合,當然其中也可以和第三者廠商做整合,將會在後面
做說明,其餘尚有和 Oracle Designer,和 Oracle SCM 以及 Web Services 相關
等等都有 Connection 可以設定。

1 頁
12/29/2004
Oracle JDeveloper 系列文章

第一步,可以開始設定 Connection Name:OE_HOME(OE Samples)


,Connection
Type:可以設定運用 Oracle JDBC,其中 JDBC-ODBC 是 JDBC 和 ODBC 之
間所需要設定的 Type,其中 Third Party JDBC Driver,是可以讓使用者連接非
Oracle 資料庫,例如:MySQL,SQL Server 等等。

2 頁
12/29/2004
Oracle JDeveloper 系列文章

輸入使用者的帳號和密碼,視情況需要,輸入 DB 的 Role,在此,如下設定。

此時,Driver 可以選擇 Thin 或是 OCI8 Driver,在此我們選 Thin Driver。

3 頁
12/29/2004
Oracle JDeveloper 系列文章

輸入 Oracle 資料庫相關資訊。

如果按下 Test Connection,出現連線成功,代表設定完成。


可以直接按下完成,及可以設定成功。

4 頁
12/29/2004
Oracle JDeveloper 系列文章

可以看到在 Database 中可以展開 OE,即可已將 Database Connection 打開,其


中包括各種不同 Compinent,其中包括 Table、View、Procedures 等等的元件。

展開 Table,可以將所有 Table 顯示,可以顯示


Table 中的相關資料。

系統導覽區,可以顯示相關的 Detail 訊息,會於


下面繼續說明。

5 頁
12/29/2004
Oracle JDeveloper 系列文章

可以在系統導覽區看到 Customers Table 中,看到 Table 中所有的 Column。

可以在主要的區域上,看到 Table 相關的資訊,也就是 Table 的 Structure。

可以繼續點 Data,可以直接去 Query Data,並且會採用分頁方式呈現。

6 頁
12/29/2004
Oracle JDeveloper 系列文章

如下圖:

在這裡,示範一下,如何使用 Oracle JDeveloper 來 Create 一個 Table,可以直


接在 Table 的項目,按下右鍵(New Table)。

7 頁
12/29/2004
Oracle JDeveloper 系列文章

Create Table Wizard:

定義相關的欄位,包括 Owner、Table Name、Comment 等等。

8 頁
12/29/2004
Oracle JDeveloper 系列文章

開始準備定義 Column。

輸入 Table_Name,以及所需要定義相關的 DataType。

9 頁
12/29/2004
Oracle JDeveloper 系列文章

輸入 Table Comment。

繼續建立下一個欄位,可以一直建立下去。

10 頁
12/29/2004
Oracle JDeveloper 系列文章

建立 Table 的 Primary Key。

建立 Table 的 Unique Constraints。

11 頁
12/29/2004
Oracle JDeveloper 系列文章

建立 Table 的 Foreign Keys Constraints。

需要 Check 的 Constraint,只是一些基本的 Table Validation。

12 頁
12/29/2004
Oracle JDeveloper 系列文章

定義 Table 的 Tablespace。

會將 Oracle JDeveloper 所做好的 SQL Comment,先行進行展示,你可以再一次


針對 SQL 去做 Create Table 相關的確定。
你可以按下 Save,可以將此段 SQL 做存檔,以便未來方便使用,個人強烈需
要存檔起來。

13 頁
12/29/2004
Oracle JDeveloper 系列文章

以下是已經 Create 好的相關 Table。

14 頁
12/29/2004
Oracle JDeveloper 系列文章

本章節相關註解:
如果你需要連接非 Oracle 資料庫,你可以選擇 Third Party JDBC Driver,其餘
設定都差不多,就可以連到別種資料庫。

15 頁
12/29/2004

You might also like