with the same code
................
Statement stmt = getConnectionStatement(var,from);
stmt.setMaxRows(1);
stmt.setFetchSize(1);
t = System.currentTimeMillis();
rs = stmt.executeQuery(query);
System.out.println(System.currentTimeMillis()-t);
.............
the driver "single server licence" answers slowly (in the same conditions)respect to HXTT Access_JDBC30 trial version.
"single server licence" about 0.1 to 0.14 ms
"trial version" about 0.000 to 0.001ms
I use only in this mode the driver and I by the product because the trial work very well.
|
Because MS Access format database need to query and load some other tables for the first query, you can find the quicker speed for the following 2nd, 3rt, ..., queries. Trial version won't load system tables. BTW, what's your query?
|
my query is
s="empty";
long t=System.nanoTime();
rs = stmt.executeQuery("SELECT ID FROM Tabella1 WHERE ID = 1");
if(rs.next()) s = rs.getString(1);
float endTime=(float)(System.nanoTime()-t)/1000000F;
System.out.println(s+" "+endTime+"ms");
t=System.nanoTime();
rs = stmt.executeQuery("SELECT testo1 FROM Tabella1 WHERE ID = 2");
if(rs.next()) s = rs.getString(1);
endTime=(float)(System.nanoTime()-t)/1000000F;
System.out.println(s+" "+endTime+"ms");
t=System.nanoTime();
rs = stmt.executeQuery("SELECT testo2 FROM Tabella1 WHERE ID = 5");
if(rs.next()) s = rs.getString(1);
endTime=(float)(System.nanoTime()-t)/1000000F;
System.out.println(s+" "+endTime+"ms");
t=System.nanoTime();
rs = stmt.executeQuery("SELECT testo3 FROM Tabella1 WHERE ID = 7");
if(rs.next()) s = rs.getString(1);
endTime=(float)(System.nanoTime()-t)/1000000F;
System.out.println(s+" "+endTime+"ms");
OUTPUT:if I use Access_JDBC30 "single server licence"
1 138.34972ms
Red 132.63976ms
Black 154.41237ms
Yellow 131.41167ms
OUTPUT:if I use Access_JDBC30 "trial"
1 1.546286ms
Red 1.053765ms
Black 2.633854ms
Yellow 1.034489ms
OUTPUT:if I use ODBC_JDBC SUN
1 6.090719ms
Red 1.193447ms
Black 1.058794ms
Yellow 1.033372ms
OS NAME = Windows XP
OS ARCHITECTURE = x86
OS VERSION = 5.1
JVM imp. VERSION = 1.6.0-beta2-b86
JVM imp. VENDOR = Sun Microsystems Inc.
JRE spec. VERSION = 1.6
I want the work mode of the trial version.
|
According to my test, there's no speed difference between trial version and "single server licence".
For 50,000 rows with index on id:
OUTPUT:if I use Access_JDBC30 "single server licence"
1 266.19165ms
Red2 63.30609ms
Black5 50.930775ms
Yellow7 48.80704ms
OUTPUT:if I use Access_JDBC30 "trial"
1 265.7307ms
Red2 65.10297ms
Black5 51.105377ms
Yellow7 49.561607ms
For 50,000 rows without index on id:
OUTPUT:if I use Access_JDBC30 "single server licence"
1 611.6582ms
Red2 304.97058ms
Black5 349.75284ms
Yellow7 283.64246ms
OUTPUT:if I use Access_JDBC30 "trial"
1 677.4755ms
Red2 309.27365ms
Black5 348.48758ms
Yellow7 280.99408ms
I used the following test code with JDK1.6.0-rc-b104
import java.sql.*;
import java.util.Properties;
public class testAccessSpeed5 {
public static void main(String argv[]) {
try {
Class.forName("com.hxtt.sql.access.AccessDriver");
String url = "jdbc:Access:/d:/temp";
Connection con = DriverManager.getConnection(url, new Properties());
if (false) { //init database
Statement astat = con.createStatement();
astat.execute("create database testspeed");
astat.executeUpdate(" create table testspeed.Tabella1 (id int unique, testo1 varchar(10), testo2 varchar(20),testo3 varchar(30));");
astat.close();
con.setCatalog("testspeed.mdb");
PreparedStatement ps = con.prepareStatement(
"insert into Tabella1 (id, testo1,testo2,testo3) values(?,?,?,?);");
for (int i = 1; i <= 50000; i++) {
ps.setInt(1, i); //id
ps.setString(2, "Red" + i); //testo1
ps.setString(3, "Black" + i); //testo2
ps.setString(4, "Yellow" + (i % 100)); //testo3
ps.executeUpdate();
}
ps.close();
}
con.setCatalog("testspeed.mdb");
Statement stmt = con.createStatement();
String s;
ResultSet rs;
s="empty";
long t=System.nanoTime();
rs = stmt.executeQuery("SELECT ID FROM Tabella1 WHERE ID = 1");
if(rs.next()) s = rs.getString(1);
float endTime=(float)(System.nanoTime()-t)/1000000F;
System.out.println(s+" "+endTime+"ms");
t=System.nanoTime();
rs = stmt.executeQuery("SELECT testo1 FROM Tabella1 WHERE ID = 2");
if(rs.next()) s = rs.getString(1);
endTime=(float)(System.nanoTime()-t)/1000000F;
System.out.println(s+" "+endTime+"ms");
t=System.nanoTime();
rs = stmt.executeQuery("SELECT testo2 FROM Tabella1 WHERE ID = 5");
if(rs.next()) s = rs.getString(1);
endTime=(float)(System.nanoTime()-t)/1000000F;
System.out.println(s+" "+endTime+"ms");
t=System.nanoTime();
rs = stmt.executeQuery("SELECT testo3 FROM Tabella1 WHERE ID = 7");
if(rs.next()) s = rs.getString(1);
endTime=(float)(System.nanoTime()-t)/1000000F;
System.out.println(s+" "+endTime+"ms");
stmt.close();
con.close();
}
catch (SQLException sqle) {
do {
System.out.println(sqle.getMessage());
System.out.println("Error Code:" + sqle.getErrorCode());
System.out.println("SQL State:" + sqle.getSQLState());
sqle.printStackTrace();
}
while ( (sqle = sqle.getNextException()) != null);
}
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
|
I have tested your code.
On my system when I use the Access_JDBC30 "single server licence" the code go in error at:
astat.executeUpdate(" create table testspeed.Tabella1 (id int unique, testo1 varchar(10), testo2 varchar(20),testo3 varchar(30));");
java.sql.SQLException: Failed to load database testspeed! For more information, please use SQLException.getNextException().
at com.hxtt.global.SQLState.SQLException(Unknown Source)
at com.hxtt.sql.access.g.try(Unknown Source)
at com.hxtt.sql.access.g.new(Unknown Source)
if I use the Access_JDBC30 "trial" it work but go in error after 25 record.
But if I open the database with MS Access I can not find the Table tabella1.
If I create the database with MS Access without the Table and after ececute your code without astat.execute("create database testspeed"); your code work also with Access_JDBC30 "single server licence" and the table Tabella1 is visible in MS Access.
After I have download the new version of the Access_JDBC30 "trial" and this version work in the same mode of the Access_JDBC30 "single server licence".
SAME SPEED.
My version of the Access_JDBC30 "trial" not have the manifest, the length is (I have read in DOS)851.686
If you test this version this version is very fast with this type of query
Thank You for your Help
|
>java.sql.SQLException: Failed to load database testspeed! For more
> information, please use SQLException.getNextException().
if (false) { //init database
You need to set false to true once to get a test datbase case. Then begin to use false for speed test.
>My version of the Access_JDBC30 "trial" not have the manifest, the length is
> (I have read in DOS)851.686
java -cp com.hxtt.sql.access.AccessDriver should print the version information.
It should be a v1.1. version.
>If you test this version this version is very fast with this type of query
You can compare the speed difference between old version and new version.
|
We have found that issue which resulted slow speed:)
Because v2.0.035 supports cascading updates and cascading deletes of MS Access, which do more slow check. We will quicken it soon.
You see:
# v2.0.043 utilizes constant DEFAULT value for create table sql and insert sql.
# v2.0.041 supports fully ALTER TABLE sql.
# v2.0.041 supports DROP INDEX sql.
# v2.0.035 supports cascading updates and cascading deletes of MS Access.
We're doing our best to provide an only best driver for MS Access. HXTT wish you will continue to using our driver, and enjoy our prompt support.
|
In our latest test, the speed is:
1 391ms
Red2 16ms
Black5 0ms
Yellow7 0ms
You can download the latest package after 2 hours. Thanks for your patience.
|
Now you can download the fixed package. Thanks for your response.
|
Thank You,
the driver is very fast and work also astat.executeUpdate(" create table testspeed.Tabella1.......
I am much satisfying
You are much professional.
E. De Filippis from Italy
|