无法在执行以下代码后重命名文件:
private static final String URL = "jdbc:DBF:/C:\\TEST";
private static final String TABLE = "create table SAMPLE ( "
+ " SM VARCHAR(10), "
+ " PRIM VARCHAR(10) " + ")";
...
Properties properties = new Properties();
properties.setProperty( "charSet", "cp866" );
properties.setProperty( "CODEPAGEID", "66" );
// instantiate it
Class.forName( "com.hxtt.sql.dbf.DBFDriver" ).newInstance();
Connection dbfConn = DriverManager.getConnection( URL, properties );
Statement stmt = dbfConn.createStatement();
stmt.executeUpdate( TABLE );
stmt.close();
PreparedStatement ps = dbfConn.prepareStatement( "INSERT INTO SAMPLE (SM, PRIM) VALUES (?,?);" );
ps.setString( 1, "test11" );
ps.setString( 2, "test12" );
ps.executeUpdate();
ps.close();
dbfConn.close();
new File( "C:\\TESTarj\\SAMPLE.DBF").renameTo( new File( "C:\\TESTarj\\SAMPLE_renamed.DBF" ) );如果删除ps.executeUpdate();文件,则重命名。这个问题只出现在上周五的,13日的上。以前效果很好。dbf_jdbc、Java、tomcat的版本没有更改。这个问题同时出现在几个盒子上。作为一种解决办法,我可以使用javadbf,但在我们的情况下,这不是最好的选择。
有什么问题的原因吗?
发布于 2012-01-20 15:54:30
properties.setProperty( "delayedClose", "0" );//delayedClose表示关闭事务的延迟秒。该选项用于避免以下sql频繁的关闭/打开表操作。在delayedClose<=60s时禁用自动临时索引。你可以用0~120秒。违约: 3。
https://stackoverflow.com/questions/8942054
复制相似问题