I have a problem here. When im inserting a query im getting a nullpointerexception. Im using jdk1.8, eclipse neon ee, postgresql9.4, tomcat8.5. It is stated in the exception that i have a problem on the execute method although my code is correct and it works on later versions of eclipse, postgresql8.1, tomcat7.
This the code from the execute1.jsp
<%
clsDatabaseManager obj = new clsDatabaseManager();
obj.openConnection();
String stud_id = request.getParameter("stud_id");
String stud_name = request.getParameter("stud_name");
String stud_password = request.getParameter("stud_password");
String contact = request.getParameter("contact");
String address = request.getParameter("address");
String course = request.getParameter("course");
String query = "INSERT INTO tbl_student(stud_id,stud_name,stud_password,contact,address,course) VALUES('"+stud_id+"','"+stud_name+"','"+stud_password+"','"+contact+"','"+address+"','"+course+"')";
obj.execute(query);
obj.closeConnection();
String site = new String("View.jsp");
response.setStatus(response.SC_MOVED_TEMPORARILY);
response.setHeader("Location", site);
//try to block to handle code that amy cause exception
%>
Connectable.java Code
package finals.project;
import java.sql.SQLException;
import java.util.Vector;
public interface Connectable {
void openConnection();
void closeConnection() throws SQLException;
boolean execute(String q) throws SQLException;
String getSingleValue(String q) throws SQLException;
boolean checkExist(String q) throws SQLException;
Vector<String> getVectorList(String query, int itemCount) throws SQLException;
Vector<String> getSingleVectorList(String query) throws SQLException;
}
And here is my clsDatabaseManager.java code because it is long here is the link https://www.dropbox.com/s/dc8be3jhuj9dr0e/clsDatabaseManager.java?dl=0