• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Transaction with Oracle error

 
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);
}
}
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!