使用dbf_jdbc问题写入dbf文件
执行以下代码后无法重命名文件:
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,但在我们的情况下它不是最佳选择。
有什么想法可能导致问题吗?
File can not be renamed after the following code execution:
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" ) );
If you remove ps.executeUpdate();
file is renamed. The problem appeared only on last Friday the 13th. It worked fine before. dbf_jdbc, Java, tomcat versions have not been changed. The problem appeared on several boxes at the same time. As a workaround I can use javadbf, but it's not the best choice in our case.
Any ideas what may be a cause of problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
//delayedClose 表示关闭事务的延迟秒数。该选项用于避免后续 SQL 的频繁关闭/打开表操作。当delayedClose<=60s时,自动临时索引被禁用。您可以使用 0~120 秒。默认值:3。
//delayedClose Indicates the delayed seconds for close transaction. That option is used to avoid frequent close/open table operations for following sqls. Automatic temporary index is disabled when delayedClose<=60s. You can use 0~120 seconds. Default: 3.