Database connection pool configuration Reference Samlei's document "Switch JBoss default database to mysql" http://dev.9cbs.net/develop/Article/33/33406.SHTM slightly modified: 1, copy C: /JBoss-3.2. 5 / DOCS / EXAMPLES / JCA / MYSQL-DS.XML to C: /JBOSS-3.2.5/Server/default/deploy under 2, copy c: /jboss-3.2.5/docs/examples/jms/mysql-jdbc2 -service.xml to c: /jboss-3.2.5/server/default/deploy/JMS, and rename HSQLDB-JDBC2-Service.xml or delete 3, C: /Jboss-3.2.5/server/default/ DePloy / JMS / HSQLDB-JDBC-State-Service.xml is changed to mysqlds4, restart JBoss test connection pool's JSP page: <% @ Page Import = "javax.naming. *"%> <% @ page import = "javax.sql. *"%> <% @ page import = "java.sql. *"%>
<% Context ctx = new initialContext (); // Get initialization context
Object obj = ctx.lookup ("java: / mysqlds"); / / Find connection pool Datasource DS = (Datasource) OBJ; // Convert to DataSource
Try {string Temp; Connection Connect = DS.GetConnection (); // Get a connection in the connection pool ("Success Connect MySQL Connection Pool!");
Statement Stmt = Connect.CreateStatement (); ResultSet RS = Stmt.executeQuery ("SELECT * FROT"); while (rs.next ()) {temp = rs.getstring ("name");%>