static int TRANSACTION_NONE
A constant indicating that transactions are not supported.
static int TRANSACTION_READ_COMMITTED
A constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.
static int TRANSACTION_READ_UNCOMMITTED
A constant indicating that dirty reads, non-repeatable reads and phantom reads can occur.
static int TRANSACTION_REPEATABLE_READ
A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.
static int TRANSACTION_SERIALIZABLE
A constant indicating that dirty reads, non-repeatable reads and phantom reads are prevented.
A constant indicating that transactions are not supported.
static int TRANSACTION_READ_COMMITTED
A constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.
static int TRANSACTION_READ_UNCOMMITTED
A constant indicating that dirty reads, non-repeatable reads and phantom reads can occur.
static int TRANSACTION_REPEATABLE_READ
A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.
static int TRANSACTION_SERIALIZABLE
A constant indicating that dirty reads, non-repeatable reads and phantom reads are prevented.
解决方案 »
- java里面定义一个数组,不给定长度,可以使用吗?
- 在非EDT线程访问同步方法里的Swing组件安全的不?
- 刚看到一个关于java中只有值传递的帖子,关于“值”的问题,是否是个文字游戏?欢迎讨论
- Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
- java中的readline()方法问题
- 有个java面试题
- 向用AXIS的朋友请教: deploy web service with wsdd error
- jetcar一类下载工具的断点续传功能怎么做?
- 请问哪里有《数据结构与算法分析(JAVA版)》的电子书下载????
- 类应用问题
- 请教如何生成BMP格式的图片?
- 问一个网络数据报的问题,小菜鸟想了一个下午了。大家请进,谢谢
try
{
conn.setAutoCommit(false);
Statement stat = conn.createStatement();
stat.executeUpdate(command1);
stat.executeUpdate(command2);
stat.executeUpdate(command3);
. . .:
stat.addBatch(command);
上面的还可以换成是下面这样。
/*
while (. . .)
{
command = "INSERT INTO . . . VALUES (" + . . . + ")";
stat.addBatch(command);
}
int[] counts = stat.executeBatch();
*/
conn.commit();
}catch(SQLException exp)
{
conn.rollback();
}
finnally
{
conn.close();
}
try
{
...
}
catch(SQLException exp)
{
conn.rollback();//出错行
}
finnally
{
conn.close();//出错行。
}
编译时出现错误:unreported exception java.sql.SQLException;must be caught or declared to be thrown。
是不是要在conn.rollback()外面再写一次try catch 语句?这也太繁琐了吧?还是你给我得不对?