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
NullPointerException using function in order by with empty resultset
Fernando Hartmann
2009-06-26 13:42:09.0
When I execute the following code I receive a Exception when the resultset is empty.
If I remove the function in the order by clause the problem don't occur.
This only happens if the resultset generated is empty.




The program:
package tests;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
*
* @author fh
*/
public class NullPointerExceptionNoData {

public static void main(String[] args) throws Exception {

String connectionUrl;
Connection con;
connectionUrl = "jdbc:dbf:/C:/TEMP/";
Class.forName("com.hxtt.sql.dbf.DBFDriver");
con = DriverManager.getConnection(connectionUrl);
String sqlError =
"SELECT f4 " +
"FROM tablex " +
"WHERE f4 = 'ZZZZZZZZZZZZZZZ' " +
"GROUP BY f4 " +
"ORDER BY count(f4) ";
String sqlOk =
"SELECT f4 " +
"FROM tablex " +
"WHERE f4 = 'ZZZZZZZZZZZZZZZ' " +
"GROUP BY f4 " +
"ORDER BY f4 ";
PreparedStatement ps = con.prepareStatement(sqlOk);
ResultSet resp = ps.executeQuery();
System.out.println("** SQL OK **************");
while (resp.next()) {
System.out.println(resp.getString("f4"));
}
resp.close();
ps = con.prepareStatement(sqlError);
resp = ps.executeQuery();
System.out.println("** SQL Error **************");
while (resp.next()) {
System.out.println(resp.getString("f4"));
}
resp.close();
ps.close();
con.close();
}
}


The Sysout

** SQL OK **************
** SQL Error **************
Exception in thread "main" java.lang.NullPointerException
at com.hxtt.sql.df.a(Unknown Source)
at com.hxtt.sql.df.a(Unknown Source)
at com.hxtt.sql.cx.new(Unknown Source)
at com.hxtt.sql.cx.next(Unknown Source)
at tests.NullPointerExceptionNoData.main(NullPointerExceptionNoData.java:60)


Re:NullPointerException using function in order by with empty resultset
HXTT Support
2009-06-26 23:11:48.0
Fixed. It'll be released in 8 hours. Thanks for your response.
Re:Re:NullPointerException using function in order by with empty resultset
Fernando Hartmann
2009-06-29 09:57:38.0
I tested and it's ok now.
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