Hi,
I have a problem which has cropped up during stress testing of my app.
I'm using jboss (pre new year version) with Oracle, but not the oracle
XADataSource classes (couldn't get this to work, some PL-SQL error from
the DB). As part of the process of creating a new user (an Entity EJB),
I make calls to a separate security library which I've written before
and which creates logon and access control information. Part of that
codecreates roles for the user and looks like this:
private final void insertRoles(Connection con, String userId, String[]
roles) throws SQLException, SMIBException {
String query = "INSERT INTO ACCESSCONTROL (USERID, ROLEID) VALUES ('"
+ userId + "', ?)";
_log.debug("Query is: " + query);
PreparedStatement ps = null;
try {
ps = con.prepareStatement(query);
for (int i = 0; i < roles.length; i++) {
Integer id = (Integer)_roleNamesToIds.get(roles[i]);
if (id == null) {
throw new SMIBException("No such role " + roles[i]);
}
ps.setInt(1, id.intValue());
ps.executeUpdate();
}
}
catch (SQLException se) {
throw se;
}
finally {
cleanUp(null, ps); // closes the statement
}
}
This works fine when I run the unit tests for the library by itself,
using the internal ConnectionPoolDataSource from the oracle JDBC
drivers classes12.zip file - I can create 1000 users and delete them
gain without any problems. However, calling the same code from JBoss
leads to a maximum cursors error after about 100 iterations (against
the same database) with this query in each one. If I change the code to
use two parameters for the prepared statement, i.e.
String query = "INSERT INTO ACCESSCONTROL (USERID, ROLEID) VALUES (?,
?)";
and set them both each time, then the problem goes away.
Anyone (Oracle/EJB experts out there) got any ideas why this might
happen?
Cheers,
Luke.
--
Luke Taylor.
PGP Key ID: 0x57E9523C
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]