Hello all,
I am new to Java. I have a simple Java program which selects text from an Oracle database table (a Varchar2 column), then prints it to a file.
Here's an extract from the code:
.....
import Java.lang.*;
.....
String recom = null;
String recomf = null;
.....
query = "select recom from recom_logic where labno = " + labno;
rs1 = stmt1.executeQuery(query);
while (rs1.next()){
recom = rs1.getString("RECOM");
}
if (recom.endsWith(";")){
recomf = recom.substring(0, recom.length() - 1);
}
.....
the program then goes on to print the data...
the program compiles successfully.
HOWEVER, when running the program, it gives the following error:
Exception in thread "main" java.lang.NullPointerException
I understand it has something to do with my String vars. What am I doing wrong?
Thanks in advance.