Tomcat5 Data Source Configuration - Tomcat Note 2

xiaoxiao2021-03-06  40

1 Log in to the Admin Account to find TomcatServer / service / host / Your web program / DataSource // -> Click here.

2 Select "CREATE New Data Source".

3 fill in the information

JNDI NAME:

JDBC / NorthWind // -> Connection pool name

Data Source URL: JDBC: Microsoft: SQLServer: //192.168.1.38: 1433; DatabaseName = Northwind

// means connecting to the Northwind database DatabaseNamenamenamenamenamenamenamenamenamenamename of SQL Server2000,

// If it is an ODBC: JDBC: ODBC: Northwind (Northwind is the database name).

// Note that the symbol 1433 port is good after the semicolon.

JDBC Driver Class: com.microsoft.jdbc.sqlserver.sqlserverdriver

// Drive needs to download.

// If it is an ODBC: sun.jdbc.odbc.jdbcodbcdriver.

User name: // Database User Name.

Password: // Database password.

Max. Active Connections: // Maximum activity connection, 0 is not limited.

Max. Idle connections: // Maximum Waiting Connection Number, 0 is not limited.

Max. Wait for connection: // Establish a connection timeout time MS, -1 is unlimited.

4 Save later must point commit change.

5 Don't restart, just refresh the page.

Note:

1) Get a connection method in the page:

Javax.naming.context ctx = new javax.naming.initialcontext ();

Javax.sql.datasource DS = (javax.sql.datasource) ctx.lookup ("Java: Comp / Env /

JDBC / NorthWind "); // Red word is the connection pool name, other fixed.

Java.sql.connection con = ds.getConnection ();

2) JNDI: Java Naming and Directory Interface, a technique that binds the name and object, the software manufactures the object, and a name, can be referenced by the name.

3) The SQL JDBC driver is also needed to put mssqlserver.jar, msutil.jar, msbase.jar under Tomcat 5.0 / Common / LIB. You may also put the Tool.jar in the JDK in.

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

New Post(0)