Hi guyz!
I'm a newbie in JAVA and I have a problem.
I have 2 classes and I'm trying to call con in my 2nd class. But I get an error like this: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 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.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)
Can you plz help me...?
Thanks!.. ^_^


Reply With Quote