Joget DX Preview Release Available for Download

Check out Joget DX, the next generation successor to Joget Workflow for faster, simpler digital transformation.

Skip to end of metadata
Go to start of metadata
  • No labels

1 Comment

  1. import org.joget.apps.form.model.*;
    import org.joget.apps.form.service.*;
    import java.sql.*;
    import java.util.*;
    
    Connection con = null;
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://localhost:3306/DB_NAME?useUnicode=true&characterEncoding=UTF-8", "USERNAME", "PASSWORD");
    
    if(!con.isClosed()){
       PreparedStatement stmt = con.prepareStatement("select id,name from projects");
       ResultSet rs = stmt.executeQuery();
       FormRowSet f = new FormRowSet();
       f.setMultiRow(true);
       while (rs.next()) { 
          FormRow vRow = new FormRow(); 
          vRow.put(FormUtil.PROPERTY_VALUE, rs.getString(1)); 
          vRow.put(FormUtil.PROPERTY_LABEL, rs.getString(2)); 
          f.add(vRow);
       }
       return f;
    }