Newbie in JAVA. Help plz..
Hi guyz!
I'm a newbie in JAVA and I have a problem.
Code:
record2 rec = new record2();
rec.connect();
rec.getClass();
Error here>>>>> stmt = rec.con.createStatement();
String sqlFind = "SELECT * FROM tblSample WHERE ID = 1";
This one too>>> ResultSet rst = stmt.executeQuery(sqlFind);
I have 2 classes and I'm trying to call con in my 2nd class. But I get an error like this:
Code:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The local variable rst may not have been initialized
Unhandled exception type SQLException
at Record.main(Record.java:44)
I have no problem in creating a connection if i use one class. But it kinda sucks having a lot of code in the class so I'm trying to make a new one.
Can you plz help me...?
Thanks!.. ^_^
Re: Newbie in JAVA. Help plz..
I think this exception is caused by another part of your code. If you'd post more code perhaps I could help