Take Tomcat4.1.29 Take Tomcat4.1.29, put the database's driver file COPY to Tomcat Your webapp 2, start Tomcat, enter the administrator interface (Tomcat homepage has a link, if you don't know the password, Please open the Tomcat-Users.xml file under the Tomcat file. You can open it with a notepad. There is an admin user name and password, and the default password of admin is empty. 3, click on the left column Tomcat Server >> Service> >> Host >>> Your WebApp's Context >>> Resources >>> Data Sources 4, in the Data Source Actions drop-down box in the right column, select Create New Data Source >>> and then configure the DataSource information as follows, with MSSQL as an example : JNDI Name: jdbc / mssql Data Source URL: jdbc: microsoft: sqlserver: //192.168.0.52: 1433; databaseName = abuJDBC Driver Class:. com.microsoft.jdbc.sqlserver.SQLServerDriverUser Name: abuPassword: abuMax Active Connections: 4Max . Wait for connection: 5000Validation query: // You can not fill 5, click the Save button >>> Click the key to the Commital Changes button 6, restart the service, enter the following code <% @Page in the test page Import = "java.sql. *"%> <% @ page import = "javax.sql. *"%> <% @ Page Import = "javax.naming. *"%> <% Datasource DS = NULL; try { InitialContext CTX = New InitialContext (); DS = (DataSource) CTX.lookup ("Java: Comp / Env / JDBC / MSSQL"); connection conn = ds.getConnection (); statement stmt = c ONN.CREATESTATEMENT (); string strsql = "select * from ttt"; ResultSet RS = stmt.executequery (strsql); while (rs.next ()) {system.out.println (rs.getstring (1));} } Catch (exception ex) {ex.printStackTrace ();}%> 7, you should see printed things in the console. I hope to bring you a little help.