1. Transaction failure coderanch.comHi Jeanne Yes, I noticed that and also tested it with the option 'UPDATABLE': same behavior. One thing I forgot to tell is that a use SQL strings and the executeQuery()/executeUpdate() methods to issue the commands. It's my understanding that doing so, the second parameter in the createStatament method should be irrelevant since I'm not working with the RecordSet attributes to ... |
2. Change of Isolation Level in between two transactions. coderanch.comIn SQL you can set the transaction isolation level explicitly before running a piece of SQL. Not a good thing to do for the vast majority of normal database application operations. You'd need a fairly compelling special case before its worth considering. And if you are not care ful you'll end up with weird bugs coming from dirty reads, phantom reads ... |
3. Transactions coderanch.comTake a look at java.sql.Connection.setTransactionIsolation(). However, note that not all databases support transactions, and those that do, support different levels. The level of transaction support in MySQL varies depending on the table type you are using, with the default being no transactions. You might want to find out more about your particular database installation before deciding how much to depend on ... |
4. Implementation of XA Transaction without App.Server? coderanch.com |
5. Approaches to roll back transactions coderanch.comHi, When I want to roll back a transaction I use this method: conn.setAutoCommit( false ); .... if ( error ) conn.rollback(); The problem is that I use a mySQL database and have to convert the tables from myISAM to innoDB! I dont like that, because it gives you some problem when making a copy of the database and open the ... |
6. Transaction Management Query coderanch.comIn our architecture the stateless session bean calls the service (POJO) which in turn calls the DAO which does the DB operation.Taking the classic debit/credit example how should the transaction management be controlled if either of the debit or credit operation fails? We are using stored procedure instead of direct SQL's.To clarify further we want to rollbackt the entire process of ... |
7. Transactional Non-Replicated Database Cache coderanch.comHi all, I am looking for a transactional, non replicated, (possibly open source) database cache. My App <--> Cache <--> Database Driver The intent is that my application will be TOTALLY ignorant of the transactional cache. I will just bind it with the right name in the JNDI explorer, and connect the cache to the database. What open source cache implementations ... |
8. Logging uncommitted transactions coderanch.comSaira, Transactions only apply to operations that manipulate the data in the database -- in other words when you do DELETE, INSERT or UPDATE operations. Since (in the code you posted) you are calling the "executeQuery()" method, I assume you are performing a query. Since a query does not manipulate data, the "rollback" is redundant -- or am I missing something? ... |
9. handle the Transaction on the DB side ? coderanch.com |
10. Multiple inserts in same transaction coderanch.comGuys, I am looking for some jdbc transaction mechanism. I dont want to user JTA. Here is my problem: I need to make two inserts into two different tables. boolean success = false; Connection con = getConnection();//returns con from pool PrepareStatement ps1 = con.prepareStatement("Insert 1"); if (ps1.executeUpdate() > 0) { PrepareStatement ps2 = con.prepareStatement("Insert 2"); if (ps2.executeUpdate() > 0) { success ... |
11. Invalid Transaction state coderanch.comHello, I am using Oracle ODBC for my application, while performing some operation it gives be exception : [Microsoft][Oracle ODBC]Invalid Transaction state. Can any one tell me that is the cause of this exception? I want that if data is inserted in database the it slould be reflected in all tables, and if any exception occur then no change should be ... |
12. transaction .... shmansaction coderanch.comHowdy all, I'm taking my first stab at using transactions with JDBC code. I found this article from sun, but the code's not working for me: try { con = getConnection(); con.setAutoCommit(false); Address userPersonAddress = new Address(req); userPersonAddress.save(con); Person userPerson = new Person(req, userPersonAddress.getAddressId(), -1); userPerson.save(con); // hack to test transactions if (true) throw new Exception("fake exception"); User user = new ... |
13. Please help with JDBC/DataSource transactions and primary key! coderanch.comHello, I'm trying to figure out the best way to safely handle the creation of new values for primary keys. In the database schema I have to work with, every table has a numerical primary key (an ID column). Whenever I insert a new row, the new ID must be an incrementation by one of the highest previous ID. The code ... |
14. current transaction is aborted, queries ignored until end of transaction block coderanch.comHi First guess is that you are working with transaction in your code and that's creating a problem after the number of users are increased. Please check your transaction code and timeout period of the the transaction. Please keep a eye on how your database is responding when this problem occurs. Check for the locks at the database end. Let me ... |
15. Invalid Transaction State coderanch.compublic class FAnglesDBTest { public static void main(String args[]) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String dsn = "FAnglesDB"; String url = "jdbc :-o dbc:" + dsn; Connection con = DriverManager.getConnection(url, "", ""); con.setAutoCommit(false); System.out.println("Database connection succeeded"); Statement statement; String query; ResultSet rs; statement = con.createStatement(); statement.execute("CREATE TABLE employee_tbl(emp_num integer)"); statement.execute("INSERT INTO employee_tbl values(4)"); statement.execute("SELECT emp_num FROM employee_tbl"); rs = statement.getResultSet(); System.out.println("Execute query ... |
16. What is the practical use of TRANSACTION_REPEATABLE_READ? coderanch.comI know that it ensures, that reading the same field twice should always result in the same value being read except when the transaction itself has changed the value. But what I don't get is why would one want to read the same data twice, vs. reading it once and storing it in some memory location for future use? wouldn't that ... |
17. Can I call a stored proc without wrapping it in a transaction? coderanch.comI'm using Microsoft SQL Server, but this is a general question about calling stored procs via JDBC. I want to manage transactions within my stored proc (i.e. by placing BEGIN TRAN and COMMIT TRAN around relevant pieces). But whenever I call a stored proc through JDBC it always seems to be wrapped in a transaction - either implicitly with the 'auto-commit' ... |
18. Transaction Control using CachedRowSet coderanch.com |
19. how to apply transactional insert is a scenario that 3 tables are going to change? coderanch.comHi thank you for reading my post How i can apply transaction in a scenario like this : In one of my web applicatinon page , i have 3 functions that each of them update/insert data to a table I use connection pool to retrieve a connection in each of those functions (i can use one connection for all of functions ... |
20. javax. transaction. UserTransaction - reuse coderanch.comUserTransaction usrTxn = (UserTransaction)initialCtx.lookup("java:comp/UserTransaction"); userTxn.begin(); //obtain pooled connection from datasource // execute JDBC // close connection// userTxn.commit(). [B]Now If want to execute another JDBC statement, can I just reuse the earlier userTxn.begin().... execute .... commit OR I have to create the transaction again using usrTxn = (UserTransaction)initialCtx.lookup("java:comp/UserTransaction"); before using userTxn.begin() ? [/B] |
21. Transactions coderanch.com |
22. Transaction Management coderanch.comWould this be the proper way to handle a self governing transaction? Or should the (!rs.next()) throw ex; be within the try catch as well? public void createUser(User user)throws SQLException, NamingException, CreateException{ logger.info("entering createUser"); Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try{ con = MSSQLServerDAOFactory.createConnection(AppHelper.SC_SECURITY_DS); ps = con.prepareStatement("DECLARE @userId int " + "INSERT INTO users(username, password)VALUES(?,?) ... |
23. JDBC Transactions across multiple databases coderanch.comWe need to query/write to two different databases (one mySQL, one Sybase) within the same transaction. I've been reading up on this on Sun's website and google but all the information I can find is related to global transactions running within a J2EE app server. Our application does not run on a J2EE app server and handles all the connection management ... |
24. managing transactions coderanch.com |
25. JDBC transaction concurency coderanch.comThanks, Gaurav I am just not sure about the isolation level. In fact it is part of my question. I think one connect can create multiple statements, so as I understand, the isolation is related to one connection so that when in multi-connection situation, the isolation setting is not functional. Am I right? |
26. A question about transaction and CRUD operations. coderanch.comHi Thank you for reading my post. Imagine that we just have one table to perform CRUD on it and we just have one record to insert, update or delete and multiple record for select. is there some scenario that we need to have a transactional insert, update, delete or select for this one table? Thanks |
27. how analysts can make sure that some operation need isolation level or transaction? coderanch.comHi thank you for reading my post It is more a design related question but i did not find other places to ask about this. As you know usually people who perform business requirement gathering and analyzing are usually separated from those who write the application. My question is, whether these analysts should ask questions and check for transaction requirement or ... |
28. Transaction and auto-commit question? coderanch.com |
29. should we begin and end a transaction for select statement? coderanch.com |
30. help on transactions coderanch.comHello friedns I need to run a query and based on its results to run another query. How can I implement it. Im using mysql innodb. import java.sql.*; import javax.sql.*; import javax.servlet.http.*; import java.util.*; public class QueryArticleBean{ QueryArticleBean(){ } private String adate, status, ddate, notes; private long spid; private Statement stmt = null; private Connection con = null; private ResultSet rs_01 ... |
31. java.sql.SQLException: ORA-01453: SET TRANSACTION must be first statement of transact coderanch.comHi Ranchers, I am getting the Oracle Exception java.sql.SQLException: ORA-01453: SET TRANSACTION must be first statement of transact after we upgraded the Oracle version from Oracle 9.2.0.6 to Oracle 9.2.0.7. Initially we had a Oracle Version 9.2.0.6 and the Application was working fine with it. Now the DBA has upgraded the version Oracle to 9.2.0.7 by applying a patch ("p4163445_92070_SOLARIS64"). After ... |
32. Can i have separate cache for commited and un-commited transactions coderanch.com |
33. Transaction coderanch.comHello I have a question. If I begin a transaction, (I am doing it with java, but I omit the code) 1 - I insert a value in a table 2 - now I try to insert a value in another table, I need the value I have Inserted before in table 1 because there is a referencial integrity. 3 I ... |
34. How to handle transactions when two different databases are involved. coderanch.comYou need to use distributed (global) transactions. I have no idea if this is possible without an EJB server but, even if it is, this is one case where the set up and operation would be so much easier with such a server. An EJB server would, amongst other things, bootstrap the XA resources into a it's transaction manager, manage the ... |
35. Global transaction error coderanch.comHi ranchers!!!Iam krishnanghri Can anyone help me why this global transaction error will occur.. error--"Global transaction is not supported for the commit/roll back statement".. This error is very much different.... Can any one explain me why this occur and in what circumstances.. Iam using container managed persistence... While using container managed persistence if i had a problem like this i have ... |
36. Transaction in JDBC? coderanch.com |
37. Row locks and transaction levels coderanch.com(For reference, we use MaxDB aka SapDB) Our default transaction isolation level is Connection.TRANSACTION_READ_COMMITTED and one particular operation obtains a row level lock using "select * from table where id= ? WITH LOCK EXCLUSIVE" There are two main operations causing problems, one is an update on another table which requires the row lock before hand, and the second is a read-only ... |
38. Web Transaction coderanch.comThis is coming from a bit of a Hibernate background, but one of the things we use is Open Session in View. In this type of scenario, we use a Servlet filter, or a transaction interceptor, that starts a transaction as the web request comes in. When the response is about to be sent to the client, the transaction is committed. ... |
39. Transaction not active error coderanch.comI am also getting same exception WARN: You should set hibernate.transaction.manager_lookup_class if cache is enabled SQL Error: 0, SQLState: null Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=omd.specialai.com/20619, BranchQual=, localId=20619]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=omd.specialai.com/20619, BranchQual=, localId=20619]) org.hibernate.exception.GenericJDBCException: Cannot open connection at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144) at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:123) at org.hibernate.persister.entity.AbstractEntityPersister.getDatabaseSnapshot(AbstractEntityPersister.java:1021) at ... |
40. Deadlock. Is executeBatch() one transaction? coderanch.comI'm encountering a dead lock situation (infrequent) that is narrowed down to the following scenario. One regular sql statement is calling the following, deleting possibly thousands of rows "delete mytable where date = ?" At the same time, a second job is calling the following sql using batched execution "delete mytable where date = ? and username =?" For both calls, ... |
41. Is there a limit on the number of sql statements in a single transaction? coderanch.comHello. I'm looking to insert a large set of data into a primary table but then n number of data subsets related to the primary data into a secondary table. Are there any known limits on the number of SQL inserts allowed if i wrap it all into a single transaction? Thank you. |
42. java.sql.SQLException: You cannot set autocommit during a managed transaction! coderanch.comHello Friends, I'm using a Datasource connection configured in xxx-ds.xml of Jboss Server. And used method setAutoCommet(false) after getting connection.Due to this i received the error of "java.sql.SQLException: You cannot set autocommit during a managed transaction!" My datasource file is |
79. Looking for a Application Transaction Framework coderanch.com |
80. Select query not working with Jdbc for transactional calls. coderanch.comHi, I am working on a web app which requires the user to save some web form information i(say customer) into the database using insert sql query (with PrepraredStatement api). and then load it immediately with some predefined db column values using a select query (again with PreparedStatement api). This must be made transactional. If the insert succeeds but select fails, ... |
81. java general question(transaction realted) coderanch.comHi consider i have developed a web based application. i have a page which will update an employee salary. my application is running. suppose consider two manager opened edit page to edit the employee salary. one manager thought to increase 3000$, and another manager thought to minus 2000$. the page is opened by two manager. 'Edit salary' page a combo box ... |
82. Best Practice for sharing db transaction across DAO coderanch.comPicture this: I received a SalesLead that has several SalesLeadFields. I want to save the SalesLead, get it's generated id and then save the SalesLeadFields with that generated id as the foreign key. You would expect to have a SalesLeadDAO and a SalesLeadFieldDAO. How do I ensure all of the inserts occur within the same transaction? If any insert fails I ... |
83. How to handle transaction in DAO coderanch.com |
84. JDBC Transaction in a Stored Procedure call coderanch.com |
86. Size of a Database transaction - Number of records coderanch.comHi, I have to insert approximately 96,000 rows in a table based on certain calculations. The business requirements is to have this operation in a single transaction, i.e. either all the entries are made successful or none. I am using MySQL and I could see the operation takes much more time than expected.. I shut down the operation after 4 hours ... |
87. Transaction related question coderanch.comHello all, could be a stupid question:- I have a requirement that part of the same transaction, I need to insert and subsequently make two more updates to the same records (same pk) in a single transaction. These operations have to be all or nothing. Anyway to achieve in a single transaction? or any other idea? Thanks, |
88. jdbc transaction mangement and behaviour coderanch.comHello i'm working on an old application that were using jta for transactions, i not very experienced with java and i don't know jta. Having a short time to complete the task (as usual) and being present only a few simple transaction operations, i have preferred the jdbc setAutocommit(false) method. Yet i have some doubts about connections and transaction enlisting. The ... |
89. Java in real-time high-volume web transactional systems coderanch.comhello Java Gurus, I can build basic web applications using j2ee frameworks. But wondering how to build a real time high volume web transactions systems? What points I should consider to build such a high end application and are there any other frameworks I can use to build such high standard apps? It would be great if you can point me ... |
91. Regarding transaction updates coderanch.comravindar dayachand wrote:How to maintain the JDBC call from java end I make DB update query. Based on the return value it is confirmed whether the DB is updated or not. Now i have a scenario where i make a update query and before the value is returned the db is physically disconnected how is this tracked, i mean i have ... |
92. concurrent transactions coderanch.comhello everyone, please some one clear my following doubt in concurrent transactions situation 1. 2 users open same database row to update ,say user 1 update a field RED and after a moment other user updates it to GREEN. user 1 changes will be lost .how to handle it in simple JDBC /hibernate . i have read isolation levels dirty reads ... |
93. transaction when we "select" data from db ? coderanch.comThis may strongly depend on the database. In Oracle, for example, you can start the transaction in serializable mode (or read-only mode for that matter, though JDBC does not directly support read-only transactions) and all your selects will return data as they existed at the time the transaction started. This may be important in regard to the consistency of data being ... |
96. Create Table is not allowed inside transaction Exception while executing syabse procedure coderanch.comHi all, I have some problem at hand while using "Sybase Procedure". I am suppose to do something like this: 1) Start a transaction from java code (by means of con.setAutocommit(false)) 2) Call X Procedure 3) Call Y Procedure 4) Commit/Rollback Transaction. Now problem is that Procedure Y was ever been developed, and it is "creating temp. table". because of which ... |
97. Secure transaction fail coderanch.comI'm trying to have a transaction t1: R1(a) , W1(a) and t2: R2(a), W2(a) if the sequence is R1(a) R2(a) W1(a) W2(a) I want T2 will not be committed since (a) is changed (when t2 try to write) from the first reading. I've tried to develop this thing, but doesn t work. After waiting some seconds the output is: wt1 name ... |
98. How to handle Transaction IN and OUT in Inventory using Java coderanch.comHi Everyone, I have an Inventory Database(Oracle 10g), where when the items are IN, we scan two times as we have two barcodes PartNo, SerialNo for each item. The scanned data is in .CSV file, Loaded to Oracle database using Oracle SQL Developer. The database table have 23 columns, including PartNo, SerialNo,Transaction_Status, Dt.of.Transaction, when i load the .CSV file to this ... |
99. Send a "Please Wait" Page, then send a "Transaction Completed" Page coderanch.comI am writing a servlet to perform a financial transaction. I can re-write it as several related servlets if necessary. Rather than bog down on details, I will explain what I want to accomplish, and the experienced among you will be able to advise me on how to approach this. A doPost calls my servlet, sending it about 20 parameters. The ... |
100. JDBC Transaction beginning coderanch.comI'd say the TX begins as soon as the first SQL statement is sent over the connection (assuming that setAutoCommit(false) has been called). It ends when commit() or rollback() is called. If the connection is closed without calling either, rollback() is automatically called. There is only ever a single active transaction per connection at any given time, so I don't understand ... |