Should it not perhaps be while(k < 100) since you start from 0 and post-increment?
What value does k have when you get the NPE? -----Original Message----- From: Bob M [mailto:[email protected]] Sent: 10 February 2014 09:20 To: [email protected] Subject: accessing records problem Hi I am calling derby within a larger java program.................... Step1: I allocate a database "Connection" object Step2: I allocate a "Statement" object in the connection Step 3: I execute a SQL SELECT query, the query result is returned in a "ResultSet" object so far so good (I update the latest database record, I add a new record and I delete the oldest record I then call a data mining program [Weka] I setup a few Weka models etc...... I then wish to look at the last 100 records in my database, one at a time The code I have currently is as follows:- *********************** try { Statement s = null; ResultSet rs = null; rs = s.executeQuery ("SELECT".................); int k = 0 while (k < 101) { rs.next(); ... ... } k++; } } catch (Exception e) { myConsole.getOut().println(e); } I get the following error:- java.lang.NullPointerException do I need to do something further to read my 100 records? Bob M -- View this message in context: http://apache-database.10148.n7.nabble.com/accessing-records-problem-tp136964.html Sent from the Apache Derby Users mailing list archive at Nabble.com. This message may contain confidential and privileged information. If it has been sent to you in error, please reply to advise the sender of the error and then immediately delete it. If you are not the intended recipient, do not read, copy, disclose or otherwise use this message. The sender disclaims any liability for such unauthorized use. PLEASE NOTE that all incoming e-mails sent to Weatherford e-mail accounts will be archived and may be scanned by us and/or by external service providers to detect and prevent threats to our systems, investigate illegal or inappropriate behavior, and/or eliminate unsolicited promotional e-mails (spam). This process could result in deletion of a legitimate e-mail before it is read by its intended recipient at our organization. Moreover, based on the scanning results, the full text of e-mails and attachments may be made available to Weatherford security and other personnel for review and appropriate action. If you have any concerns about this process, please contact us at [email protected].
