Now I use the BMP to insert record into Oracle databse. But after run my program, I find no data in my DB. I have set a datasource in my Jboss. And not any wrong to be reported. Could you tell me the reason.
My code:
public class Test2Bean implements SessionBean {
//my romote method
......
public void insertData() {
try {
String mySQL = "insert into test values('abc')";
Context ictx = new InitialContext();
testDS = (DataSource)ictx.lookup("java:/LeaderqDS");
testConn = testDS.getConnection();
testStmt = testConn.createStatement();
testStmt.executeUpdate(mySQL);
testStmt.close();
testConn.close();
} catch(Exception e) {
e.printStackTrace();
}
......
}
you need to run the insert within a tx (method declared as transaction required). your data is not committed otherwise.
lars