<LearnWLS> Setting Up Examples to Run with a Derby Database

The examples installed with Oracle WebLogic Server include the Derby "examples" database. The wl_server examples domain includes JDBC data sources configured to use with the Derby database out-of-the-box. You do not need to configure the database or database connectivity when running the examples in the wl_server domain. For more information about Derby, see the public ApacheDerby documentation. The information in the following sections can help you configure database connectivity if you want to run the examples from a different domain or if you want to recreate the data in the database.

Prerequisites

Make sure that the Derby server is running and that you have the following information:

  • Database name

  • Host name or IP address

  • Port

  • Database username and password

Derby starts automatically when the examples Server in the wl_server domain is started. Make sure that the Derby server is running. Use the Derby "ij" tool located in the WL_HOME\common\derby\bin subdirectory of the WebLogic Server installation directory. If you are running the examples in a different domain, you can manually start the Derby server. See Starting Derby.

Generating Derby Data

Follow these steps to configure Oracle WebLogic Server exampleproperty values and populate the Derby database with sample data:

  1. Using a text editor, open the examples.properties file, located inthe EXAMPLES_HOME\examples\src directory, where EXAMPLES_HOME represents the root directory in which the WebLogic Server Examples are configured; for example: C:\Oracle\Middleware\Oracle_Home\wlserver\samples\server.

  2. Change the following lines to fit your environment:

    • derby.url=jdbc:derby://localhost:1527/examples;create=true;ServerName=localhost;databaseName=examples

    • derby.username=examples

    • derby.password=examples

    Save the file when you are finished.

  3. Open a command shell and setup the environment.

  4. Change to the EXAMPLES_HOME\examples\src\examples\common\ddl directory.

  5. Enter the following command:

    ant db.setup.derby

    This Ant target creates the tables and inserts sample data.

    To use a database server other than Derby, Oracle, or MySQL, create a db.setup.db_vendor target in the build.xml file, similar to db.setup.derby, and set the driver class; URL; and host, username, and password for the server.

Configuring JDBC Data Sources for Derby

Some Oracle WebLogic Server examples use database connections from JDBC data sources configured in the wl_server domain installed with the Oracle WebLogic Server examples. If you want to run an example in a different domain, you may need add one or more of the data sources to your WebLogic domain.

To configure the examples-demo data source:

  1. Open the Oracle WebLogic Server Administration Console.

  2. In the Domain Structure view in the left pane, expand Services > Data Sources.

  3. On the Summary of JDBC Data Sources page, click New.

  4. On the JDBC Data Source Properties page,enter or select the following information:

    Name - Enter examples-demo.

    JNDI Name - Enter examples-dataSource-demoPool.

    Database Type - Select Derby or the DBMS of the database to which you want to connect. If your DBMS is notlisted, select Other.

    Click Next to continue.

    Database Driver - Select Derby's Driver (Type 4)Versions: Any or another non-XA JDBC driver that you want to use to connect to the database.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The Derby driver is installed with Oracle WebLogic Server.

    Click Next to continue.

  5. On the Transactions Options page, follow these steps:

    1. Select Supports Global Transactions.

    2. Select One-Phase Commit.

    Click Next to continue.

  6. On the Connection Properties page, enter values for the following properties:

    Database Name - Enter demo or the name of the database to which you want to connect.

    Host Name - Enter localhost or the DNS name or IP address of the server that hosts the database.

    Port - Enter 1527 for Derby or enter the port on which the database server listens for connections requests.

    Database User Name - Enter examples for the Derby database installed with the Oracle WebLogic Server examples or if you are using a different database, enter the database user account name that you want to use for each connection in the data source.

    Password / Confirm Password - Enter examples for the Derby database or enter the password for the database user acccount specified above.

    Click Next to continue.

  7. On the Test Database Connection page,review the connection parameters and click Test Configuration.

    Oracle WebLogic Server attempts to create a connection from the Administration Server to the database. Results from the connection test are displayed at the top of the page. If the test is unsuccessful, you should correct any configuation errors and retry the test.

    If the JDBC driver you selected is not installed on the Administration Server, you should click Next to skip this step.

    Click Next to continue.

  8. On the Select Targets page, select examples Server or select the servers or clusters on which you want to deploy the data source.

  9. Click Finish to save the JDBC data source configuration. When your changes are activated, the data source will be deployed to the targets that you selected.

  10. To activate these changes, you must restart the server.

To configure the examples-demoXA data source:

  1. Open the Administration Console.

  2. In the Domain Structure view in the left pane, expand Services > Data Sources.

  3. On the Summary of Data Sources page, click New.

  4. On the JDBC Data Source Properties page,enter or select the following information:

    Name - Enter examples-demoXA.

    JNDI Name - Enter examples-dataSource-demoXAPool.

    Database Type - Select Derby or the DBMS of the database to which you want to connect. If your DBMS is notlisted, select Other.

    Click Next to continue.

    Database Driver - Select Derby's Driver (Type 4XA) Versions: Any or another XA JDBC driver that you want to use to connect to the database.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The Derby driver is installed with Oracle WebLogic Server.

    Click Next to continue.

  5. On the Transactions Options page, disable Supports Global Transactions.If the XA JDBC driver you selected requires a global transaction to execute SQL code, skip this step. Click Next to continue.

  6. On the Connection Properties page, enter values for the following properties:

    Database Name - Enter demo or the name of the database to which you want to connect.

    Host Name - Enter localhost or the DNS name or IP address of the server that hosts the database.

    Port - Enter 1527 for Derby or enter the port on which the database server listens for connections requests.

    Database User Name - Enter examples for the Derby database installed with the Oracle WebLogic Server examples or if you are using a different database, enter the database user account name that you want to use for each connection in the data source.

    Password/Confirm Password - Enter examples for the Derby database or enter the password for the database user acccount specified above.

    Click Next to continue.

  7. On the Test Database Connection page,review the connection parameters and click Test Configuration.

    Oracle WebLogic Server attempts to create a connection from the Administration Server to the database. Results from the connection test are displayed at the top of the page. If the test is unsuccessful, you should correct any configuation errors and retry the test.

    If the JDBC driver you selected is not installed on the Administration Server, you should click Next to skip this step.

    Click Next to continue.

  8. On the Select Targets page, select examples Server or select the serversor clusters on which you want to deploy the data source.

  9. Click Finish to save the JDBC data source configuration. When your changes are activated, the data source will be deployed to the targets that you selected.

  10. To activate these changes, you must restart the server.

To configure the examples-demoXA-2 data source:

  1. Open the Administration Console.

  2. In the Domain Structure view in the left pane, expand Services > Data Sources.

  3. On the Summary of Data Sources page, click New.

  4. On the JDBC Data Source Properties page,enter or select the following information:

    Name - Enter examples-demoXA-2.

    JNDI Name - Enter examples-demoXA-2.

    Database Type - Select Derby or the DBMS of the database to which you want to connect. If your DBMS is not listed, select Other.

    Click Next to continue.

    Database Driver - Select Derby's Driver (Type 4XA) Versions: Any or another XA JDBC driver that you want to use to connect to the database.

    Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with Oracle WebLogic Server, but not all listed drivers are installed. The Derby driver is installed with Oracle WebLogic Server.

    Click Next to continue.

  5. On the Transactions Options page, disable Supports Global Transactions.If the XA JDBC driver you selected requires a global transaction to execute SQL code, skip this step. Click Next to continue.

  6. On the Connection Properties page, enter values for the following properties:

    Database Name - Enter demo or the name of the database to which you want to connect.

    Host Name - Enter localhost or the DNS name or IP address of the server that hosts the database.

    Port - Enter 1527 for Derby or enter the port on which the database server listens for connections requests.

    Database User Name - Enter examples for the Derby database installed with the Oracle WebLogic Server examples or if you are using a different database, enter the database user account name that you want to use for each connectionin the data source.

    Password/Confirm Password - Enter examples for the Derby database or enter the password for the database user account specified above.

    Click Next to continue.

  7. On the Test Database Connection page,review the connection parameters and click Test Configuration.

    Oracle WebLogic Server attempts to create a connection from the Administration Server to the database. Results from the connection test are displayed at the top of the page. If the test is unsuccessful, you should correct any configuation errors and retry the test.

    If the JDBC driver you selected is not installed on the Administration Server, you should click Next to skip thisstep.

    Click Next to continue.

  8. On the Select Targets page, select examples Server or select the servers or clusters on which you want to deploy the data source.

  9. Click Finish to save the JDBC data source configuration. When your changes are activated, the data source will be deployed to the targets that you selected.

  10. To activate these changes, you must restart the server.

Python网络爬虫与推荐算法新闻推荐平台:网络爬虫:通过Python实现新浪新闻的爬取,可爬取新闻页面上的标题、文本、图片、视频链接(保留排版) 推荐算法:权重衰减+标签推荐+区域推荐+热点推荐.zip项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全领域),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明(如有)等。答辩评审平均分达到96分,放心下载使用!可轻松复现,设计报告也可借鉴此项目,该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的。 【提供帮助】:有任何使用问题欢迎随时与我联系,我会及时解答解惑,提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【项目价值】:可用在相关项目设计中,皆可应用在项目、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面,可借鉴此优质项目实现复刻,设计报告也可借鉴此项目,也可基于此项目来扩展开发出更多功能 下载后请首先打开README文件(如有),项目工程可直接复现复刻,如果基础还行,也可在此程序基础上进行修改,以实现其它功能。供开源学习/技术交流/学习参考,勿用于商业用途。质量优质,放心下载使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值