Bean shell form store binder store insert into db
Hi all,
I wish to insert values inside custom db with bean shell store binder. I am using the following code.
I am not getting any errors in the log.
import org.joget.apps.app.service.*;
import org.joget.apps.app.model.*;
import org.joget.apps.form.model.*;
import org.joget.apps.form.service.*;
import java.sql.*;
import java.util.*;
public void StoreUsingJDBC(Element element, FormRowSet rows, FormData formData, String id) {
Connection con = null;
if (results == null) {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jogettest", "root", "root");
if(!con.isClosed()){
String sql = "Insert into po(poId) values('4040')";
PreparedStatement stmt = con.prepareStatement(sql);
stmt.executeUpdate();
}
} catch (Exception ex) {
System.err.println("Exception: " + ex.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
return storeData();
Am I doing something wrong here?