Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

transaction in java mysql

try(Connection conn = DriverManager.getConnection(dbURL,dbUser,dbPassword);){
   conn.setAutoCommit(false);
	
   // perform operations such as insert, update, delete here
   // ..
	
   // if everything is OK, commit the transaction
   conn.commit();

} catch(SQLException e) {
   // in case of exception, rollback the transaction
   conn.rollback();
}
Code language: Java (java)
Source by www.mysqltutorial.org #
 
PREVIOUS NEXT
Tagged: #transaction #java #mysql
ADD COMMENT
Topic
Name
1+1 =