JBuilderx + JBoss (WebLogic) Development WebServic

xiaoxiao2021-03-06  108

1. New project SQLMIDWEB_JBSS2. New EJB module SQLEJBModule3. Add a stateless session bean: SQLSession in the EJB module, and increase how the method: private sessionContext sc = null; private context ctx = null; private datasource ds = null ;. ... public void setsessionContext (sessionContext sessioncontext) {try {ctx = new initialContext (); // jboss ds = (dataource) ctx.lookup ("java: / myDataSource"); // WebLogic // DS = (Datasource) Ctx.lookup ("mydatasource");} catch (exception ex) {ex.printstacktrace ();} this.sc = sessionContext;} public string [] [] getTable (String Sqlstr, int Rowcursor, int fetchcount) {.. ..//jBoxx con = ds.getConnection ("root", "); // WebLogic // con = DS.GetConnection (" WebLogic "," WebLogic "); statement stmt = con.createstatement (); .. . 5. Add session bean sqlsession6 in the WebService model. Compile and publish jboss, WebLogic configuration DataSource is different: jboss: 1. Put the Database's JDBC driver ../server/../lib 2. Reference ... / DOCS / EXAMPLES / JCA / XML file, put the modified file copy to ../Deploy directory, note that JNDI Name is set to MyDataSourceWebLogic: 1. Add JDBC Pool 2. Add JDBC Datasource, JNDi Name Set to MyDataSource 2004 -10-20

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

New Post(0)