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 Json v1.0
  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
Problem with a date-field
Tobi
2009-01-16 05:37:20
Hi everybody,

thanks for the great work and the quick bug-fixes. Unfortunatelly I have another problem with your JDBC-DBF-Driver. I have a table with a date-field and have SQL-Statements like

SELECT * FROM t WHER datefield='2009-16-01'

But in the resultset, there are only entries with the date '2009-17-01'

Example in Java:

-------------------------------
import java.io.File;
import java.sql.*;

public class MinimalClass {
public static void main(String[] args) {
String pathToDBF = "c:/dbf";
String connectionUrl;
Connection con;
Statement stmt;
String sSQL;

connectionUrl = "jdbc:dbf:/" + pathToDBF;

try {
// Delete the dbf-File if necessary
File file = new File(pathToDBF + "/t1.dbf");
if (file.exists()) {
file.delete();
}

Class.forName("com.hxtt.sql.dbf.DBFDriver");
con = DriverManager.getConnection(connectionUrl);
stmt = con.createStatement();

// create a Table
sSQL = "CREATE TABLE IF NOT EXISTS t1 (key INT, dt DATE)";
stmt.executeUpdate(sSQL);

// fill with values
sSQL = "INSERT INTO t1 (key, dt) VALUES (1,'2009-01-16')";
stmt.executeUpdate(sSQL);
sSQL = "INSERT INTO t1 (key, dt) VALUES (2,'2009-01-17')";
stmt.executeUpdate(sSQL);

// Output
sSQL = "SELECT * FROM t1 WHERE dt='2009-01-16'";
ResultSet rs = stmt.executeQuery(sSQL);
while (rs.next()) {
System.out.println("key: " + rs.getInt("key") + ", dt: " + rs.getDate("dt"));
}
rs.close();

stmt.close();

} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------------------------

Is it my fault?
Re:Problem with a date-field
HXTT Support
2009-01-17 01:14:32
That issue was resulted by mixture using gmt calendar and local canlendar since v4.2.020.
If you used "SELECT * FROM t1 WHERE dt={d '2009-01-16'};", you will get the correct result.
BTW, the latest package will skip that issue. That package will be availabe after about 2 hours.
Re:Re:Problem with a date-field
Tobi
2009-01-21 03:28:12
Thanks, it works.

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 | Refund | Sitemap