This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction with Oracle error

 
Haroldo Nascimento
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I get the error when I open the transaction in the Oracle.
This code below works in the sybase and SQL Server, but dont works to Oracle.
try{
...
dbwrapper.beginTrx(con,name);
...
dbwrapper.commitTrx(con,name);
} catch(Exception e){
dbwrapper.rollBackTrx(con,name);
}
I recieve this error:
[net.upaid.database.DBWrapper.beginTrx()] Erro:
java.sql.SQLException: ORA-00900: instru��o SQL inv�lida
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1094)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2132)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2015)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2877)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:925)
at net.upaid.database.DBWrapper.beginTrx(DBWrapper.java:39)
at net.upaid.acquirer.bradesco.BradescoRecarga.run(BradescoRecarga.java:96)
at java.lang.Thread.run(Thread.java:536)

I use this methods to Open, commit and rollback the transactions:
public void beginTrx(Connection conn, String nome) throws DBConnException {
Statement st = null;
try {
st = conn.createStatement();
st.execute("SET TRANSACTION " + nome);
st.close();
} catch (Throwable t) {
log.error("[.commitTrx()] Erro:", t);
}
}
public void commitTrx(Connection conn, String nome) throws DBConnException {
Statement st = null;
try {
st = conn.createStatement();
st.execute("COMMIT TRANSACTION " + nome);
st.close();
} catch (Throwable t) {
log.error("[.commitTrx()] Erro:", t);
}
}
public void rollBackTrx(Connection conn, String nome) {
Statement st = null;
try {
st = conn.createStatement();
st.execute("ROLLBACK TRANSACTION " + nome);
st.close();
} catch (Throwable t) {
log.error("[.commitTrx()] Erro:", t);
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic