JDBC POOL configuration in WebLogic

zhaozj2021-02-16  56

JDBC POOL configuration in WebLogic

1. Copy the MSBase.jar, Msutil.jar, and MSSQLServer.jar to the% WL_HOME% directory (WebLogic81 / Server / LIB).

2. Open STARTWEBLOGIC.CMD under user_projects / domains / mydomain, add 3 JAR packets to classpath,% wl_home% / server / lib / msbase.jar;% WL_HOME% / server / lib / msutil.jar;% WL_HOME % / Server / LIB /

MSSQLServer.jar;

3. Start WebLogic, open IE, type in the address bar: http: // localhost: 7001 / console. Enter users and passwords

4. Select Services-> JDBC-> Connection Pools on the directory tree on the left, click the Configure a new JDBC Connection Pool on the right., Select the following information, then Continue:

5. Fill in the following information

Then it is created and deployed.

6. Configure data source, select Services-> JDBC-> Data Source (or TXData Sources) in the directory tree on the left, click Configure a New JDBC on the right.

Name = SQLSERVER TX DATA SOURCE JNDI Name = SQLServer Pool Name = MSSQLServerConnectionPool Select Emulate TW-PHASE COMMIT for Non-Xa Driver and Row Prefetch Enabled

Then create.

7. Restart WebLogic.

8. Do a JSP test,

<% @ Page ContentType = "Text / HTML; Charset = GB2312" Language = "Java" Import = "java.sql. *" ErrorPage = ""%>

<% @ Page Import = "Import Javax.naming. *"%>

<% @ Page Import = "Import Javax.sql. *"%>

<%

Context ctx = new initialContext ();

Object obj = ctx.lookup ("SQLServer");

DataSource DS = (Datasource) OBJ;

Connection conn = ds.getConnection ();

Statement st = conn.createstatement ();

ResultSet RS = St.executeQuery ("Select * from staffinfo);

While (rs.next ())

{

Out.println ("
");

Out.println (rs.getstring ("name");

}

Rs.close ();

St.close ();

CONN.CLOSE ();

%> Note, in fact, the connection pool configuration is written in config.xml, you can even modify the configuration file yourself, let us take a look at this paragraph

DRIVERNAME = "com.microsoft.jdbc.sqlserver.sqlserdriver"

Initialcapacity = "10" name = "myjdbc connection pool"

Password = "{3des}

7L

WM3i / FKS = "

Properties = "User = sa; databasename = PBX" targets = "Bonjovi" URL = "JDBC: Microsoft: SQLServer: //127.0.0.1: 1433" />

Name = "Myjdbc Data Source" poolname = "myjdbc connection pool"

RowPrefetchenabled = "true" targets = "bonjovi" />

转载请注明原文地址:https://www.9cbs.com/read-18342.html

New Post(0)