We know that,WeblogicIs a Java application server used to develop, integrate, deploy, and manage large-scale distributed Web applications, network applications, and database applications. Set Weblogic andOracle Database Connection PoolThe combined platform provides convenient conditions for Java application development. This article describes how to use Weblogic8 with an Oracle database connection pool. Let's take a look at this process.
1. Works with the connection pool
First, enter http: // localhost: 7001/console in the address bar of the browser to enter the console.
Go to mydomain (custom Domain Name)-service-JDBC-connection buffer pool in the left-side menu.
Click "match new JDBC Connection Pool ..."
Data Type Selection: Oracle
Database Driver Process Selection: Oracle's Driver (Thin) Version: 9.0.1, 0.2.0, 10
Click "continue" in the lower right corner"
Write the name of the connection pool to be set in this example: myconnection1)
Database Name: name of the database to be visited
Host Name: Host Name or IP address written to the database server. In this example, 192.168.1.20)
Port: 1521
Enter the database username and password based on the actual situation
Click "continue"
Click "test-driven process matching" on the next page to reveal "connection wins"
Click "Create and arrange"
Show the configuration items of myconnection1 in the list of new versions
Connection Pool combination ends
2. Test and Connection Pool
Go to mydomain (custom Domain Name)-service-JDBC-connection buffer pool in the left-side menu.
Click "myconnection1"
Click the "connection" tab in the "match" tab.
Click "reveal" in the advanced option"
Choose "test keep connection", "test create connection", and "test release connection"
It is easy to write a table name to the database in the "test table name ".
Write "SQL select * from student" in "Initial SQL"
Select the "support local transactions" option
Click "use"
Click "test buffer pool" on the "test" tab"
Reveal "Quiz wins"
3. JDBC data sources
Go to mydomain (custom Domain Name)-service-JDBC-data source in the left-side menu of the Management Console
Click "match new JDBC Data Source"
Write the name of the data source to be matched in this example: myperformance1)
Write the name of the Meeting in the JNDI name. Example: test/ora9)
Click "continue"
Choose myconnection1 in the buffer pool name
Click "continue" and "CREATE"
Show the matching items of myperformance1 in the list
End of data source combination
4. Test the JDBC Data Source
Create and arrange testjdbc. jsp. The source code is as follows:
- <% @ Page import = "java. SQL. *" %>
-
- <% @ Page import = "javax. naming. *" %>
-
- <% @ Page import = "javax. SQL. *" %>
-
- <%
-
- Try {
-
- Context initCtx = new InitialContext ();
-
- DataSource ds = (DataSource) initCtx. lookup ("test/student ");
-
- Connection conn = ds. getConnection ();
-
- Statement stmt = conn. createStatement ();
-
- // Query the number of emp data items in the table
-
- ResultSet rs1_stmt.exe cuteQuery ("select count (*) as num from emp ");
-
- Rs. next ();
-
- Out. println (rs. getString ("num "));
-
- Rs. close ();
-
- Stmt. close ();
-
- } Catch (Exception e ){
-
- E. printStackTrace ();
-
- }
-
- %>
This article introduces Weblogic and Oracle database connection pool. We hope this article will bring you some benefits!