Summarize the database connection pool

xiaoxiao2021-03-06  54

I have seen many friends in questioning the problem of database connection pools, so ICLATIONS. The following is the difference between Oracle and SQL Server when configuring the connection pool: 1.oracle and SQL Server Differences when configuring the pool:

Oracle configuration method in Tomcat configuration URL jdbc: Oracle: Thin: @ 172.28.122.49: 1521: CPDB

driverclassname Oracle.jdbc.driver.Oracledriver

SQL Server configuration method URL JDBC: Microsoft: SQLServer: //127.0.0.1: 1433; DatabaseName = Pubs

driverclassname com.microsoft.jdbc.sqlserver.sqlserverdriver Note: SQL Server package acquisition from http://www.microsoft.com/ downloads / details.aspx? FamilyID = 4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae & DisplayLang = en # filelist download "Microsoft SQL Server 2000 Driver for JDBC", and install, get msbase.jar, mssqlserver.jar and msutil.jar three documents , Three files Copy to Tomcat 4.1 COMMON / LIB folder

Oracle Package Way ORANT/JDBC/LIB/CLASES12.JAR COPY to Tomcat 4.1 COMMON / LIB folder

2. Oracle and SQL Server Differences when using JDBC: ORACLESTRING URL_ = "172.28.122.49:1521:CPDB"; String ID_ =" CU01 "; string pass_ =" abc "; class.forname (" Oracle.jdbc.driver "CONN = DriverManager.getConnection (" JDBC: Oracle: Thin: @ " URL_, ID_, Pass_);

SQL ServerClass.forName ( "oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection ( "jdbc: microsoft: sqlserver: // BLUESKY: 1433; User = sa; Password = sa; DatabaseName = sitedb); Class. Forname (drivername); connection conn = drivermanager.getConnection (connURL);

3. Examples Examples: Tomcattry.xml is Tomcat's configuration file, Sample is a connection pool Servlet code (start servlet through Comming.html) This example environment OS: Windows2000JDK: 1.4.2_04ide: Eclipse3.0Web Server: Tomcat4. 1.27DATABASE: Oracle9i

Database table structure Name: TEST structure: username not null varchar2 (10) Password varcha2 (10) Built table statement: Create Table Test (username varchar (10) Primary Key, Password Varchar (10));

At the same time, I also concluded an example of connecting pools, login login function, using the connection pool to connect Oracle9i, please leave your e-mail.

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

New Post(0)