2013年11月24日

connection.close() without rollback or commit

摘要: 事务不commit或rollback直接close connection,据目前查找的资料(参照database分类中的文章)会产生以下后果:1.如果直接使用jdbc,则具体的实现取决于不同的数据库。比如,oracle会commit,而sql server会rollback.2.如果使用数据库连接池,还取决于数据库连接池的实现。 阅读全文

posted @ 2013-11-24 20:47 优雅的码农 阅读(1022) 评论(0) 推荐(0)

Does Connection.close() result in commit or rollback ?

摘要: Earlier today I saw a transaction question targeted for a completely different audience pop up as the first headline news item on a well known java news site. Besides giving me and my colleagues a good laugh about bugs and transactions it also touched upon one of the questions that have given me a c 阅读全文

posted @ 2013-11-24 20:31 优雅的码农 阅读(633) 评论(0) 推荐(0)

When should we call connection.rollback() method?

摘要: Please let me know when do we require to call the method connection.rollback();try{ connection = getConnection(); connection.setAutoCommit(false); pstmt1 = connection.preparedstatement (...);... pstt1.executeUpdate(); pstmt2 = connection.preparedstatement (...);... pstt2.executeUpdate(); conn... 阅读全文

posted @ 2013-11-24 20:19 优雅的码农 阅读(161) 评论(0) 推荐(0)

Why is it bad style to `rescue Exception => e` in Ruby?

摘要: Ryan Davis’sRuby QuickRefsays (without explanation):Don’t rescue Exception. EVER. or I will stab you.Why not? What’s the right thing to do?Exceptionis the root of Ruby's exception hierarchy, so when yourescue Exceptionyou rescue fromeverything, including subclasses such asSyntaxError,LoadError, 阅读全文

posted @ 2013-11-24 20:11 优雅的码农 阅读(246) 评论(0) 推荐(0)

ruby Exception and StandardError

摘要: It is important to understand the place of StandardError in the hierarchy of ruby exceptions:class TestException1 < StandardErrorend class TestException2 < Exceptionend begin begin raise TestException1 rescue puts $!.class.name end begin raise TestException2 rescue puts $!.class.na... 阅读全文

posted @ 2013-11-24 20:04 优雅的码农 阅读(339) 评论(0) 推荐(0)

导航