Configuration of JBoss3.0-Tomcat 4.03 - 4 (configuration of the database)

xiaoxiao2021-03-06  57

The configuration of the database of JBoss3.0-Tomcat4.03 (Take Oracle as an example) 1. Add classes12.zip to classpath. Second, please resume the HSQLDB-Service.xml file to write an ORACLEDB-Service.xml file, open the HSQLDB-Service.xml file under the Server / Default / Deploy directory, which is an example in which the database connection is implemented under jboss3.0_tomcat4.03, It is the following contents of the HSQL database:

sa sa jboss.jca: service = LocalTxCM, name = hsqldbDS NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the module-option name = "managedConnectionFactoryName "must match the object name of the ConnectionManager you are configuring here -.> <-! uncomment out this line if you are using the DB2DbRealm above HsqlDbRealm ->

DefaultDS jdbc: hsqldb: hsql: / / localhost: 1476 org.hsqldb.jdbcDriver SA < ! - Below here are advanced properties -> <- hack -> jboss.jca:! service = RARDeployment, name = JBoss LocalTransaction JDBC Wrapper < Depends> jboss: service = hypersonic

<-! Embedded mbean -> 0 50 5000 15 <-!. criteria indicates if Subject (from security domain) or app supplied parameters (such as from getConnection (user, pw)) are used to distinguish connections in the pool Choices are ByContainerAndApplication (use both), ByContainer (use Subject), ByApplication (use app supplied params only), ByNothing (all connections are equivalent, usually if adapter supports reauthentication) -> ByContainer < depends optional-attribute-name = "CachedConnectionManager"> jboss.jca: service = CachedConnectionManager jboss.security:service=JaasSecurityManager

Java: / TransactionManager

jboss.jca: service = rarDeployer

1476 True < Attribute name = "database"> default false in some instructions in use between , so Remove this instructions after rewriting an XML file for the service of the Oracle database is OracleDB-Service.xml

OracleDS jdbc: oracle: thin: @ CUIPENG: 1521: ORA8 Oracle.jdbc.driver.OracleDriver system manager < / attribute> jboss.jca: service = RARDeployment, name = JBoss LocalTransaction JDBC Wrapper

0 50 5000 15 ByContainer jboss.jca: service = CachedConnectionManager

jboss.security:service=JaasSecurityManager java: / TransactionManager

jboss.jca: service = rarDeployer

Please compare the difference between the two files, it is easy to write the access service of other databases. The main thing is the following part of the

Oracleds CONFIG-PROPERTY NAME = "ConnectionURL" type = "java.lang.string"> JDBC: Oracle: Thin: @cuipeng: 1521: ORA8 Oracle.jdbc.driver.OracleDriver system manager jboss.jca: service = RARDeployment, name = JBoss localtransaction jdbc wrapper is also the name of each part name Name = ORACLEDS three, the connection of the test data (I use JSP) You must write .war or .ear bag to test one The simple practice is: 1. Establish an Oracle-Test.war directory in the deploy directory. Second, establish a web-inferry in the Oracle-Test.war directory, two files jboss-web.xml and web.xml content are the Web.xml content is 3, establish a new file in Oracle-Test.war directory Index.jsp whose content is <% @ page contenttype =" Text / html "%> <% @ page import =" java.sql. *, javax.sql.datasource, javax.naming.initialcontext "%>

Test Oracle DB

<%

InitialContext CTX = New InitialContext (); DataSource DS = (Datasource) CTX.lookup ("Java: / ORACLEDS"); // Note Here and Front Corresponding Connection Conn = DS.GetConnection (); Statement Stmt = Conn.createstatement ResultSet RS = Stmt.executeQuery ("SELECT * from Tab");

While (rs.next ()) {out.println (Rs.getstring ("TNAME") "
");}

CONN.CLOSE ();

%> Four, please visit http: // localhost: 8080 / Oracle-test All test OK, if there is anything wrong, please refer, I am also learning. This is a quick configuration method, I have some time I will show every property to everyone.

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

New Post(0)