Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v7.1
  HXTT Cobol v5.0
  HXTT DBF v7.1
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v6.1
  HXTT Paradox v7.1
  HXTT PDF v2.0
  HXTT Text(CSV) v7.1
  HXTT Word v1.1
  HXTT XML v4.0
Offshore Outsourcing
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)

HXTT DBF
Drop column after insert with transaction isolationlevel read-committed
Rob Gansevles
2011-12-06 01:40:56.0
Hi,

Another test failed in our suite.
We modify data (autocommit on) and then drop a column.
When transaction isolation level is set to read-committed, this throws an exception (Exception in thread "main" java.sql.SQLException: Failed to acquire table tst:
java.lang.InterruptedException: Timeout Interrupted Exception: beyond 1000 msecs.)

This used to work with the driver we downloaded a few months ago.

See sample program below.

Rob

public static void main(String[] args) throws Exception
{
Class.forName("com.hxtt.sql.dbf.DBFDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:dbf:////tmp/test_hxtt_dbf?lockType=VFP", "", "");

// NOTE: when transaction isolation is not set, the test works OK!
connection.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_COMMITTED);

try
{
exec(connection, "drop table tst");
}
catch (Exception e)
{
}
exec(connection, "create table tst (tst_id integer not null, tst_f integer null, primary key (tst_id))");
exec(connection, "insert into tst (tst_id, tst_f) values (1,0)");
exec(connection, "alter table tst drop tst_f");

System.out.println("OK");
}

public static int exec(java.sql.Connection connection, String sql) throws Exception
{
java.sql.PreparedStatement ps = null;
try
{
ps = connection.prepareStatement(sql);
return ps.executeUpdate();
}
finally
{
if (ps != null) ps.close();
}
}
}
Re:Drop column after insert with transaction isolationlevel read-committed
HXTT Support
2011-12-06 03:50:30.0
Supported now. Please download the latest package. It's still an issue relative with new code cache.
Re:Re:Drop column after insert with transaction isolationlevel read-committed
Rob Gansevles
2011-12-06 07:48:29.0
Hi,

This example works, but one over 2 connections still does not.
This worked before with the driver from some months ago.

See sample code below, the same error is thrown.

Rob

public class DBFTest
{
public static void main(String[] args) throws Exception
{
Class.forName("com.hxtt.sql.dbf.DBFDriver");
String url = "jdbc:dbf:////tmp/test_hxtt_dbf?lockType=VFP";
java.sql.Connection connection = java.sql.DriverManager.getConnection(url, "", "");

try
{
exec(connection, "drop table tst");
}
catch (Exception e)
{
}
exec(connection, "create table tst (tst_id integer not null, tst_f integer null, primary key (tst_id))");
exec(connection, "insert into tst (tst_id, tst_f) values (1,0)");

java.sql.Connection connection2 = java.sql.DriverManager.getConnection(url, "", "");
exec(connection2, "alter table tst drop tst_f");

connection2.close();
connection.close();
System.out.println("OK");
}

public static int exec(java.sql.Connection connection, String sql) throws Exception
{
java.sql.PreparedStatement ps = null;
try
{
ps = connection.prepareStatement(sql);
return ps.executeUpdate();
}
finally
{
if (ps != null) ps.close();
}
}
}
Re:Re:Re:Drop column after insert with transaction isolationlevel read-committed
HXTT Support
2011-12-06 19:04:35.0
>This example works, but one over 2 connections still does not.
>This worked before with the driver from some months ago.
Because JDK1.6 provides Statement.setPoolable, so that we met issue for your request.
If you use

public static int exec(java.sql.Connection connection, String sql) throws Exception {
java.sql.Statement ps = null;
try {
ps = connection.createStatement();
return ps.executeUpdate(sql);
} finally {
if (ps != null) {
ps.close();
}
}
}

Or

public static int exec(java.sql.Connection connection, String sql) throws Exception {
java.sql.PreparedStatement ps = null;
try {
ps = connection.prepareStatement(sql);
ps.setPoolable(false);
return ps.executeUpdate();
} finally {
if (ps != null) {
ps.close();
}
}
}

Or

java.util.Properties properties=new java.util.Properties();
properties.setProperty("delayedClose", "0");
java.sql.Connection connection = java.sql.DriverManager.getConnection(url,properties);


your issue will disappear.

That new poolable switch will result delayed close cache parsed sql and table object on connection level.

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap