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
Query causes NullPointerException
Patrick
2007-01-16 12:07:33
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
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
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
Recurred your issue. You can download a new version after 24 hours. Thanks.

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