Session EJB: connection.createStatement error [message #165615] |
Fri, 31 March 2006 01:23 |
agodoy
Messages: 2 Registered: March 2006
|
Junior Member |
|
|
From a session bean I am trying to update two table, of which one has a sequence generated primary key. I try to connect to the Database to obtain the next number in the sequence (all under a transaction). But when I intend o using the conection I get the following message:
Error:
06/03/30 17:28:30 java.sql.SQLException: SystemException: Failed to add the resource due to error in the resource
06/03/30 17:28:30 at com.evermind.sql.OrionCMTConnection.tryToDelistEnlist(OrionCMTConnection.java:313)
06/03/30 17:28:30 at com.evermind.sql.OrionCMTConnection.intercept(OrionCMTConnection.java:126)
06/03/30 17:28:30 at com.evermind.sql.FilterConnection.createStatement(FilterConnection.java:270)
06/03/30 17:28:30 at com.evermind.sql.OrclCMTConnection.createStatement(OrclCMTConnection.java:985)
06/03/30 17:28:30 at com.saniline.catweb.ejb.session.usuarios.UsuariosSessionBean.getNewId(UsuariosSessionBean.java:136)
06/03/30 17:28:30 at com.saniline.catweb.ejb.session.usuarios.UsuariosSessionBean.InsertarUsuario(UsuariosSessionBean.java:75)
06/03/30 17:28:30 at UsuariosSession_StatelessSessionBeanWrapper150.InsertarUsuario(UsuariosSession_StatelessSessionBeanWrapper150.java:82)
06/03/30 17:28:30 at com.saniline.catweb.servlet.***.***_editSSUserServlet.doPageService(***_editSSUserServlet.java:155)
06/03/30 17:28:30 at com.saniline.catweb.servlet.CatalogoWebServlet.doPageService(CatalogoWebServlet.java:168)
06/03/30 17:28:30 at com.saniline.snfw.servlet.SnFwSessionServlet.doPageService(SnFwSessionServlet.java:83)
06/03/30 17:28:30 at com.saniline.snfw.servlet.SnFwServlet.service(SnFwServlet.java:70)
06/03/30 17:28:30 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
06/03/30 17:28:30 at com.saniline.snfw.servlet.SnFwServlet.service(SnFwServlet.java:54)
06/03/30 17:28:30 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
06/03/30 17:28:30 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
06/03/30 17:28:30 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
06/03/30 17:28:30 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
06/03/30 17:28:30 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
06/03/30 17:28:30 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
06/03/30 17:28:30 at java.lang.Thread.run(Thread.java:534)
Datasource:
<data-source name="jdev-connection-sn_cat"
class="com.evermind.sql.OrionCMTDataSource"
location="jdbc/sn_catCoreDS"
xa-location="jdbc/xa/sn_catXADS"
ejb-location="jdbc/sn_catDS"
pooled-location="jdbc/sn_catPooledDS"
connection-driver="oracle.jdbc.xa.client.OracleXADataSource"
username="sn_cat"
password="sn_cat"
url="jdbc:oracle:thin:@w2kaddevenor:1521:DEV"
inactivity-timeout="30" />
Code:
try {
connect = dataSource. getConnection();
statement = connect.createStatement();
statement.execute(alterSeq + new Integer(range).toString());
statement.executeQuery("select " + getSequenceName() + ".nextval from DUAL");
results = statement.getResultSet();
if ((results != null) && (results.next())) {
maxKey = results.getInt(1);
lastKey = maxKey - range;
} else {
throw new CreateException ("ejbCreate: sequence failed to return a value");
}
|
|
|