Corrupted index on foxpro table |
Rob Gansevles |
2013-05-30 23:51:59 |
Hi,
We are using the dbf driver from Servoy and one of our customers reports issues with index corruption.
It can be reproduced with a table called pdaten (structure with 104 fields p_nr autoinc with index, name character...) (I can send you the table if needed) using the sample program shown below.
Scenario:
1. Started java program
2. Created one record in the program (id 1)
3. Checked index in the table (id 1): ok
4. Created 5 records in the table with foxpro (id 2 to 6)
5. Checked index (id 2 to 6): ok
6. Created one record with the java program (id 7)
7. Checked index in the table (id1) : ok
8. Checked index in the table (id2) : set filter to p_nr = 2 results no record
9. Checked index in the table (id3) : set filter to p_nr = 3 results no record
10. Checked index in the table (id4) : set filter to p_nr = 4 results no record
11. Checked index in the table (id5) : set filter to p_nr = 5 results no record
12. Checked index in the table (id6) : set filter to p_nr = 6 results no record
13. Checked index in the table (id7) : ok
I hope you have enough information to investigate this error.
Regards,
Rob Gansevles,
Servoy
////// sample program ///////
public static void main(String[] args) throws Exception
{
String url = "jdbc:DBF:/C:/DBFTest?lockType=VFP";
String tableName = "pdaten";
String inccol = "p_nr";
String othercol = "name";
Class.forName("com.hxtt.sql.dbf.DBFDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection(url, "", "");
connection.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_COMMITTED);
connection.setAutoCommit(false);
while (true)
{
System.out.print("Hit RETURN to insert a new value");
if (System.in.read() <= 0)
{
break;
}
java.sql.PreparedStatement ps = connection.prepareStatement("insert into " + tableName + " (" + othercol + ") values ('test')");
ps.executeUpdate();
ps.close();
ps = connection.prepareStatement("select currval('" + tableName + "','" + inccol + "')");
java.sql.ResultSet rs = ps.executeQuery();
if (rs.next())
{
System.out.println("generated: " + rs.getInt(1));
}
else
{
System.err.println("no result");
}
rs.close();
ps.close();
System.out.print("Hit RETURN to commit");
if (System.in.read() <= 0)
{
connection.rollback();
System.out.println("Rolled back");
break;
}
connection.commit();
System.out.println("Committed");
System.out.println();
}
connection.close();
System.out.println("Done");
}
|
Re:Corrupted index on foxpro table |
HXTT Support |
2013-05-31 06:37:15 |
Passed test according to your description.
First
create table pdaten (p_nr int auto_increment primary key, name varchar(12));
Then run your sample, and commited one row with p_nr=1
Now open VFP 9.0,
run
USE pdaten SHARED
SET INDEX TO pdaten.idx
browse
and insert 5 rows ( p_nr=2,3,4,5,6)
Now continue run Java sample ,and insert one row with p_nr=7
set filter to p_nr = 2(1,3...7) ok.
|
Re:Re:Corrupted index on foxpro table |
Rob Gansevles |
2013-05-31 07:20:02 |
Thanks for the quick response.
I have sent a zipfile with dbf files in a separate email to support@hxtt.com
Regards,
Rob
|
Re:Re:Re:Corrupted index on foxpro table |
HXTT Support |
2013-05-31 20:01:55 |
Still work normally with CDX sample. Please download the latest version, and check whether you will meet issue.
|
Re:Re:Re:Re:Corrupted index on foxpro table |
M. Harms Briese Schiffahrts GmbH & Co.KG |
2013-06-02 23:23:08 |
Hello,
have you received the pdaten.dbf from Rob Gansevles (Servoy)? This file containes 104 fields. Can you test it with this file?
I have tested it with this file several times. This index file will always be corrupt (we are using Windows 7 x64).
1. Started java program
2. Created one record in the program (id 1)
3. Foxpro: use pdaten shared, browse. We can see all records
In Foxpro 9 SP3: set filter to p_nr = 1: found the record
4. Created 5 records in the table with foxpro (id 2 to 6)
5. browse. We can see all records
In Foxpro 9 SP3: set filter to p_nr = 2: found the record
In Foxpro 9 SP3: set filter to p_nr = 3: found the record
In Foxpro 9 SP3: set filter to p_nr = 4: found the record
In Foxpro 9 SP3: set filter to p_nr = 5: found the record
In Foxpro 9 SP3: set filter to p_nr = 6: found the record
6. Created one record with the java program (id 7)
7. Foxpro: browse. We can see all records
In Foxpro 9 SP3: set filter to p_nr = 1: found the record
In Foxpro 9 SP3: set filter to p_nr = 2: no record found
In Foxpro 9 SP3: set filter to p_nr = 3: no record found
In Foxpro 9 SP3: set filter to p_nr = 4: no record found
In Foxpro 9 SP3: set filter to p_nr = 5: no record found
In Foxpro 9 SP3: set filter to p_nr = 6: no record found
In Foxpro 9 SP3: set filter to p_nr = 7: found the record
|
Re:Re:Re:Re:Re:Corrupted index on foxpro table |
HXTT Support |
2013-06-03 05:40:12 |
>Can you test it with this file?
Tested normally on XP.
Please let us know your HXTT DBF version.
|
Re:Re:Re:Re:Re:Re:Corrupted index on foxpro table |
M. Harms Briese Schiffahrts GmbH & Co.KG |
2013-06-03 06:11:41 |
We have Version 5.1.137 on May 13, 2013.
Where can I find the file to test? Can you send it to edv@briese.de?
|
Re:Re:Re:Re:Re:Re:Re:Corrupted index on foxpro table |
HXTT Support |
2013-06-03 07:54:45 |
Sent the test sample. If you can recur that issue, please email support at hxtt.com the sample too.
|
Re:Re:Re:Re:Re:Re:Re:Re:Corrupted index on foxpro table |
HXTT Support |
2013-06-05 03:31:06 |
2013-06-05 fixed an insert bug for VFP compatible mode on CDX index file which contains more than one indexed expression.
|