配置 JDBC 提供者和資料來源
如果要存取關聯式資料庫,應用程式會使用您配置給應用程式伺服器的「Java™ 資料庫連線功能 (JDBC)」驅動程式和資料來源。
開始之前
- 資料來源(WebSphere® Application Server 第 4 版)(已淘汰)是用來搭配 Enterprise JavaBeans (EJB) 1.0 規格和 Java Servlet 2.2 規格一起使用。
已淘汰的特性: depfeat
- 最新標準版本的資料來源專用來搭配實作這些規格更進階版本的應用程式。
![[z/OS]](../images/ngzos.gif)
程序
- 確認在節點管理程式上,已安裝了所有必要的 JDBC 驅動程式檔案。 請參閱「各供應商資料來源必要設定下限」一文,以取得這項資訊。 如果您選擇配置使用者定義的 JDBC 提供者,請檢查資料庫說明文件,以取得驅動程式檔案的相關資訊。
- 建立 JDBC 提供者。
從管理主控台建立 JDBC 提供者時,請參閱「利用管理主控台來配置 JDBC 提供者」主題;或
使用 wsadmin Scripting 用戶端,請參閱「利用 Scripting 來配置 JDBC 提供者」主題;或
使用「Java 管理延伸 (JMX)」API,請參閱「利用 Java 管理延伸 API 來建立 JDBC 提供者和資料來源」主題。
- 建立資料來源。
從管理主控台中,請參閱「利用管理主控台來建立資料來源」主題;或
使用 wsadmin Scripting 用戶端,請參閱「利用 Scripting 配置新的資料來源」主題。 如果是第 4 版資料來源,請參閱「利用 Scripting 來配置新的 WAS40 資料來源(已淘汰)」主題;或
使用 JMX API,請參閱「利用 Java 管理延伸 API 來建立 JDBC 提供者和資料來源」主題。
必要的內容 : 不同的資料庫供應商需要不同的 JDBC 驅動程式實作內容。 請在 WebSphere Application Server 的資料來源上設定這些內容。 由於應用程式伺服器包含許多供應商 JDBC 實作的範本,管理主控台會顯示必要的內容,當您建立資料來源時,會向您發出這些內容的提示。 不過,如果您將資料存取配置寫在 Script 中,您必須參閱「各供應商資料來源必要設定下限」一文,以瞭解必要的內容和設定選項。 - 選擇性的: 配置自訂內容。
如同必要的內容,您也必須在應用程式伺服器資料來源上,設定特定供應商 JDBC 驅動程式的自訂內容。 請參閱資料庫說明文件,以取得可用的自訂內容的相關資訊。 如果要配置自訂類別來協助處理應用程式伺服器原來無法辨識的資料庫內容,請參閱「開發自訂的 DataStoreHelper 類別」主題。
另外您可能會想要配置其他選用的資料來源內容,例如 DB2 sslConnection 自訂內容。如果您使用 DB2 Universal JDBC 驅動程式提供者,如需這些自訂內容的相關資訊,請參閱您的 DB2 for z/OS 版本的 Application Programming Guide and Reference for Java
- 將資源參照連結到資料來源。請參閱「Enterprise Bean 和 Web 模組的資料來源查閱」一文。
- 測試連線(非儲存器管理持續性用法)。 請參閱「測試連線服務」主題。
結果
即使您收到認證不正確的相關資訊,仍請檢查資料庫及 JDBC 追蹤日誌。 這些日誌提供鑑別失敗的更可靠、更詳細的錯誤資料。

次主題
Data source minimum required settings, by vendor
These properties vary according to the database vendor requirements for Java Database Connectivity (JDBC) driver implementations. You must set the appropriate properties on every data source that you configure.Apache Derby 所需的資料來源設定下限
這些內容會隨著JDBC 驅動程式實作的資料庫供應商需求而不同。 您必須在所配置的每個資料來源上,設定適當的內容。 這些設定會用於 Apache Derby 資料來源。Data source minimum required settings for DB2 with the application server on AIX, HP-UX, Linux, Solaris, or Windows
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for a DB2 data source that is connecting to an application server that is running on AIX®, HP-UX, Linux, Solaris, or Windows systems.Data source minimum required settings for DB2 on z/OS and an application server on z/OS
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for a DB2 data source that is running on z/OS and will be accessed by applications in an application server that is also running on z/OS.Data source minimum required settings for DB2 Universal Database for IBM i
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for a DB2 UDB data source.Data source minimum required settings for Informix
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for Informix® data sources.Data source minimum required settings for Microsoft SQL Server
These properties vary according to the database vendor requirements for Java Database Connectivity (JDBC) driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for Microsoft SQL Server data sources.Data source minimum required settings for Oracle
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for Oracle data sources.Data source minimum required settings for Sybase
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for Sybase data sources.利用管理主控台來配置 JDBC 提供者
為了建立應用程式與關聯式資料庫之間的連線,應用程式伺服器需要使用「Java 資料庫連線功能 (JDBC)」提供者所封裝的驅動程式實作類別。Configuring a JDBC provider for a clustered environment
Use these steps to define a data source on multiple nodes that comprise a cluster.利用管理主控台來配置資料來源
應用程式元件利用資料來源來存取關聯式資料庫的連線實例。Setting up a connection to an HADR-enabled DB2 database
If you are using DB2 Version 8.2 or later as a datasource, you might want to take advantage of the high availability disaster recovery (HADR) functionality that is available in these versions of DB2. Even though you must Install two instances of DB2 on your machine before you can use the HADR functionality, you only need to configure the primary DB2 database as a data source. The HADR functionality that the primary DB2 database provides automatically handles the rerouting of data to the backup DB2 database.ResourceManagement command group for the AdminTask object
You can use the Jython or Jacl scripting languages to configure resource providers with the wsadmin tool. The commands and parameters in the ResourceManagement group can be used to define and display properties for resource providers.Creating and configuring a JDBC provider and data source using the JMX API
If your application requires access to a relational database using the Java Database Connectivity (JDBC) API, you can create the necessary JDBC provider and data source objects using the Java Management Extensions (JMX) API exclusively. Alternatively, you can use the JMX API in combination with the wsadmin scripting tool.Accessing an existing Java EE data source resource
The same DataSource MBean and JDBCProvider MBean programming model that you use to access a WebSphere Application Server managed data source (defined in scripting or the Integrated Solutions Console) can be used to access a Java™ Platform Enterprise Edition (Java EE) data source resource that is defined in the application with the DataSourceDefinition annotation or with the <data-source> element of the deployment descriptor. This feature maintains compatibility with existing scripts, simplifying the management of your resources.Using the DB2 Universal JDBC Driver to access DB2 for z/OS
The z/OS operating system requires that you configure the DB2 Universal JDBC Driver and your database to ensure interoperability. Within WebSphere Application Server, configure a Java Database Connectivity (JDBC) provider object and a data source object to implement the driver capabilities for your applications.Creating a data source that uses the Oracle JDBC Driver for OCI
You can use the Oracle JDBC for OCI driver with Version 7.0 and later of the Application Server.在應用程式伺服器中配置 Oracle Real Application Cluster (RAC)
Oracle Real Application Cluster (RAC) 是「共用一切」的資料庫架構,在這個架構中,兩個或更多 Oracle RAC 節點會叢集起來,共用相同的儲存體。 RAC 節點會通過高速交互連接而連接起來,以便在 Oracle 節點之間進行高速通訊。 這些節點可以在啟動期間交換各種資料區塊所有權資訊、鎖定資訊、交換交易資訊和資料,等等。配置使用 DB2 資料庫之應用程式的用戶端重新遞送
用戶端重新遞送特性可讓您配置 DB2 通用資料庫用戶端應用程式的通訊遺失回復,用戶端應用程式可以在儘可能不受岔斷的情況下繼續運作。 重新遞送是支援連續作業的核心,但只有在用戶端連線識別了替代位置的情況下,才有可能重新遞送。配置使用 DB2 資料庫之應用程式的用戶端親緣性
當啟用資料來源在連線失敗的情況下使用其他伺服器之時,用戶端親緣性特性是自動用戶端重新遞送的一個替代方案。 在這個只限用戶端的方法中,用戶端會決定失效接手期間替代伺服器的執行順序。 如需用戶端親緣性的相關資訊,請參閱 DB2 資訊中心的「DB2 Database for Linux, UNIX, and Windows 的用戶端親緣性」主題。Verifying a data source connection
Many connection problems can be easily fixed by verifying configuration parameters. There are steps that you must complete to enable a successful connection.Test connection service
WebSphere Application Server provides a test connection service for validating data source configurations. The testConnection operation instantiates the data source configuration, gets a connection, and then immediately closes the connection.Testing a connection with the administrative console
After you have defined and saved a data source, you can click the Test Connection button to ensure that the parameters in the data source definition are correct.Testing a connection using wsadmin
The AdminControl object of the wsadmin scripting tool has a testConnection operation that tests the configuration properties of a data source object.Configuring data source JDBC providers to use pureQuery in a Java SE environment
Use this task to configure the application data source Java Database Connectivity (JDBC) provider to use pureQuery to access DB2 in a Java Standard Edition (Java SE) environment. This configuration is for use with the Java™ Persistence API (JPA) 2.0 specification provider, WSJPA.Configuring data source JDBC providers to use pureQuery in a Java SE environment
Use this task to configure the application data source Java Database Connectivity (JDBC) provider to use pureQuery to access DB2 in a Java Standard Edition (Java SE) environment. This configuration is for use with the Java™ Persistence API (JPA) 2.0 specification provider, WSJPA.Data source minimum required settings, by vendor
These properties vary according to the database vendor requirements for Java Database Connectivity (JDBC) driver implementations. You must set the appropriate properties on every data source that you configure.Apache Derby 所需的資料來源設定下限
這些內容會隨著JDBC 驅動程式實作的資料庫供應商需求而不同。 您必須在所配置的每個資料來源上,設定適當的內容。 這些設定會用於 Apache Derby 資料來源。Data source minimum required settings for DB2 with the application server on AIX, HP-UX, Linux, Solaris, or Windows
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for a DB2 data source that is connecting to an application server that is running on AIX, HP-UX, Linux, Solaris, or Windows systems.Data source minimum required settings for DB2 on z/OS and an application server on z/OS
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for a DB2 data source that is running on z/OS and will be accessed by applications in an application server that is also running on z/OS.Data source minimum required settings for DB2 Universal Database for IBM i
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for a DB2 UDB data source.Data source minimum required settings for Informix
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for Informix data sources.Data source minimum required settings for Microsoft SQL Server
These properties vary according to the database vendor requirements for Java Database Connectivity (JDBC) driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for Microsoft SQL Server data sources.Data source minimum required settings for Oracle
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for Oracle data sources.Data source minimum required settings for Sybase
These properties vary according to the database vendor requirements for JDBC driver implementations. You must set the appropriate properties on every data source that you configure. These settings are for Sybase data sources.利用管理主控台來配置 JDBC 提供者
為了建立應用程式與關聯式資料庫之間的連線,應用程式伺服器需要使用「Java 資料庫連線功能 (JDBC)」提供者所封裝的驅動程式實作類別。Configuring a JDBC provider for a clustered environment
Use these steps to define a data source on multiple nodes that comprise a cluster.利用管理主控台來配置資料來源
應用程式元件利用資料來源來存取關聯式資料庫的連線實例。Setting up a connection to an HADR-enabled DB2 database
If you are using DB2 Version 8.2 or later as a datasource, you might want to take advantage of the high availability disaster recovery (HADR) functionality that is available in these versions of DB2. Even though you must Install two instances of DB2 on your machine before you can use the HADR functionality, you only need to configure the primary DB2 database as a data source. The HADR functionality that the primary DB2 database provides automatically handles the rerouting of data to the backup DB2 database.ResourceManagement command group for the AdminTask object
You can use the Jython or Jacl scripting languages to configure resource providers with the wsadmin tool. The commands and parameters in the ResourceManagement group can be used to define and display properties for resource providers.Creating and configuring a JDBC provider and data source using the JMX API
If your application requires access to a relational database using the Java Database Connectivity (JDBC) API, you can create the necessary JDBC provider and data source objects using the Java Management Extensions (JMX) API exclusively. Alternatively, you can use the JMX API in combination with the wsadmin scripting tool.Accessing an existing Java EE data source resource
The same DataSource MBean and JDBCProvider MBean programming model that you use to access a WebSphere Application Server managed data source (defined in scripting or the Integrated Solutions Console) can be used to access a Java™ Platform Enterprise Edition (Java EE) data source resource that is defined in the application with the DataSourceDefinition annotation or with the <data-source> element of the deployment descriptor. This feature maintains compatibility with existing scripts, simplifying the management of your resources.Using the DB2 Universal JDBC Driver to access DB2 for z/OS
The z/OS operating system requires that you configure the DB2 Universal JDBC Driver and your database to ensure interoperability. Within WebSphere Application Server, configure a Java Database Connectivity (JDBC) provider object and a data source object to implement the driver capabilities for your applications.Creating a data source that uses the Oracle JDBC Driver for OCI
You can use the Oracle JDBC for OCI driver with Version 7.0 and later of the Application Server.在應用程式伺服器中配置 Oracle Real Application Cluster (RAC)
Oracle Real Application Cluster (RAC) 是「共用一切」的資料庫架構,在這個架構中,兩個或更多 Oracle RAC 節點會叢集起來,共用相同的儲存體。 RAC 節點會通過高速交互連接而連接起來,以便在 Oracle 節點之間進行高速通訊。 這些節點可以在啟動期間交換各種資料區塊所有權資訊、鎖定資訊、交換交易資訊和資料,等等。配置使用 DB2 資料庫之應用程式的用戶端重新遞送
用戶端重新遞送特性可讓您配置 DB2 通用資料庫用戶端應用程式的通訊遺失回復,用戶端應用程式可以在儘可能不受岔斷的情況下繼續運作。 重新遞送是支援連續作業的核心,但只有在用戶端連線識別了替代位置的情況下,才有可能重新遞送。配置使用 DB2 資料庫之應用程式的用戶端親緣性
當啟用資料來源在連線失敗的情況下使用其他伺服器之時,用戶端親緣性特性是自動用戶端重新遞送的一個替代方案。 在這個只限用戶端的方法中,用戶端會決定失效接手期間替代伺服器的執行順序。 如需用戶端親緣性的相關資訊,請參閱 DB2 資訊中心的「DB2 Database for Linux, UNIX, and Windows 的用戶端親緣性」主題。Verifying a data source connection
Many connection problems can be easily fixed by verifying configuration parameters. There are steps that you must complete to enable a successful connection.Test connection service
WebSphere Application Server provides a test connection service for validating data source configurations. The testConnection operation instantiates the data source configuration, gets a connection, and then immediately closes the connection.Testing a connection with the administrative console
After you have defined and saved a data source, you can click the Test Connection button to ensure that the parameters in the data source definition are correct.Testing a connection using wsadmin
The AdminControl object of the wsadmin scripting tool has a testConnection operation that tests the configuration properties of a data source object.


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tdat_tccrtprovds
檔名:tdat_tccrtprovds.html