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
Query causes NullPointerException
Patrick
2007-01-16 12:07:33.0
Hi,
I'm trying to run a basic query which causes a NullPointerException somewhere within the HXTT JDBC code. I can run the same query against the same database using the Java SE's built-in ODBC JDBC driver without a problem.

Here is the code:

String url = "jdbc:dbf:/f:/pathToDBC/";
Properties properties = new Properties();
properties.setProperty("user", "patrick");
properties.setProperty("password", "");
properties.setProperty("lockType", "VFP");
properties.setProperty("versionNumber", "30");
properties.setProperty("OtherExtensions", "true");
properties.setProperty("MissingMemoFile", "ignore");
properties.setProperty("loadIndices", "false");
properties.setProperty("Default Index Suffix", "cdx");
cn = DriverManager.getConnection(url, properties);
cn.setAutoCommit(false);

Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, -180);

int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH) + 1;
int dom = cal.get(Calendar.DAY_OF_MONTH);

int i = 1;
StringBuffer sql = new StringBuffer();
sql.append(" select ");
sql.append(" so.orderkey, "); int SO_PK = i++;
sql.append(" soil.orditmkey, "); int SO_IL_PK = i++;
sql.append(" soil.idcode, "); int SO_IL_ITEM_CODE = i++;
sql.delete(sql.length() - 2, sql.length());
sql.append(" from ");
sql.append(" arorditm as soil ");
sql.append(" inner join arord as so ");
sql.append(" on soil.orderkey = so.orderkey ");
sql.append(" where ");
sql.append(" so.lastupdate >= ");
sql.append(" {ts '");
sql.append(year);
sql.append("-");
if (month < 10) sql.append("0");
sql.append(month);
sql.append("-");
if (dom < 10) sql.append("0");
sql.append(dom);
sql.append(" 00:00:00.000");
sql.append("'}");
sql.append(";");

log.debug(sql);

Statement statement = null;
ResultSet rs = null;

try
{
statement = cnDSYS.createStatement();
rs = statement.executeQuery(sql.toString());

while (rs.next())
{
Long soPK = rs.getLong(SO_PK);
}

rs.close();
rs = null;
statement.close();
statement = null;

cn.commit();
}
catch (SQLException e)
{
e.printStackTrace();
try { cn.rollback(); } catch (SQLException sqle) {}
}
finally
{
if (statement != null) try { statement.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}

try
{
cn.close();
}
catch (SQLException e)
{}

Here is the result:
2007-01-16 12:07:43,245 DEBUG [SyncSalesOrder] select so.orderkey, soil.orditmkey, soil.idcode from arorditm as soil inner join arord as so on soil.orderkey = so.orderkey where so.lastupdate >= {ts '2006-07-20 00:00:00.000'};
java.sql.SQLException: java.lang.NullPointerException
at com.hxtt.sql.dbf.i.do(Unknown Source)
at com.hxtt.sql.ce.a(Unknown Source)
at com.hxtt.sql.aw.if(Unknown Source)
at com.hxtt.sql.dc.a(Unknown Source)
at com.hxtt.sql.dc.a(Unknown Source)
at com.hxtt.sql.dc.a(Unknown Source)
at com.hxtt.sql.bm.a(Unknown Source)
at com.hxtt.sql.bm.a(Unknown Source)
at com.hxtt.sql.ag.a(Unknown Source)
at com.hxtt.sql.ag.a(Unknown Source)
at com.hxtt.sql.ag.executeQuery(Unknown Source)
at com.vanbelle.utility.syncimport.SyncSalesOrder.sync(SyncSalesOrder.java:
at com.vanbelle.utility.syncimport.Application.main(Application.java:91)

at com.hxtt.global.SQLState.SQLException(Unknown Source)
at com.hxtt.sql.bm.a(Unknown Source)
at com.hxtt.sql.ag.a(Unknown Source)
at com.hxtt.sql.ag.a(Unknown Source)
at com.hxtt.sql.ag.executeQuery(Unknown Source)
at com.vanbelle.utility.syncimport.SyncSalesOrder.sync(SyncSalesOrder.java:58)
at com.vanbelle.utility.syncimport.Application.main(Application.java:91)
Re:Query causes NullPointerException
HXTT Support
2007-01-17 09:19:34.0
Hi,

Accord your sql, i create two simple and insert few records ,
then run this sql, it works fine.

So, please download the latest HXTT DBF JDBC Package and retry, if it doesn't work normal, please compress your file and send it to us.


Re:Re:Query causes NullPointerException
Patrick
2007-01-17 09:31:30.0
Strange,
On a whim I changed one of the connection properties to:

properties.setProperty("loadIndices", "true");

and now it works.
Re:Re:Re:Query causes NullPointerException
HXTT Support
2007-01-24 21:26:19.0
Recurred your issue. You can download a new version after 24 hours. Thanks.

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