Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
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
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT DBF
Problem with a date-field
Tobi
2009-01-16 05:37:20.0
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.0
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.0
Thanks, it works.

Search Key   Search by Last 50 Questions




Google
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap