Hi to all... Joget is a very powerfull WorkFlow prrogram.

I install joget in UBUNTU SERVER 12.04 using MySQL DB. No problem during installation and all work fine.

I try to build a form inside a new app. In this form i' can put a select box and populate it with (E.G.) the user id stored in table dir_user. I do this with the jdbc connector.. and it work..

There is a way to load data from a MSSQL server on a different server?

E.G. with my installation on mysql, i would like to populate a select box with the code of our customer, stored in a table on a mssql server on a differet server..

It's possible??

Thank's in advance

  • No labels

4 Comments

  1. In your Select Box, choose Bean Shell as the Options Binder. In the Bean Shell plugin, write all the codes that you need to connect to your database, then return the data in the manner found in the "load" method in Form Options Binder Plugin Example.

  2. Hi Walter. Thank for replay.

    I try to write some java code to connect joget to my mssql server.. But i think something is wrong...

    import org.joget.apps.form.model.*;
    import org.joget.apps.form.service.*;
    import java.sql.*;
    import java.util.*;
    
    Connection con = null;
    
    Class.forName("com.sqlserver.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:sqlserver://IP_MSSQL_SERVER:1433;databaseName=db name;user=mssql_user;password=mssql_password");
    
    FormRowSet select_box_name = new FormRowSet();
    select_box_name.setMultiRow(true);
    
    if(!con.isClosed()){
    	PreparedStatement stmt = con.prepareStatement("select a.cardcode, a.cardcode from ocrd a where a.cardtype = 'c'");
    	ResultSet rs = stmt.executeQuery();
    
    
    	while (rs.next()){
    		FormRow code_row = new FormRow();
    		code_row.put(FormUtil.PROPERTY_VALUE, rs.getString(1));
    		code_row.put(FormUtil.PROPERTY_LABEL, rs.getString(2));
    		select_box_name.add(code_row);
    	}
    }
    
    return select_box_name;

    can you help me to setup the code?

    Thank in advance and sorry for my english...

    1. Hi there,

      Can you check what error you get in the server log when you execute the code?

      Cheers

      1. catalina_2013-03-19.pdf

        Hi Hugo and thank a lot for replay.

        In catalina.2013-03-19.log i can find this cup of lines..

        WARNING: Error executing script
        Sourced file: inline evaluation of: ``import org.joget.apps.form.model.*; import org.joget.apps.form.service.*; import . . . '' : Method Invocation Class.forName : at Line: 8 : in
        file: inline evaluation of: ``import org.joget.apps.form.model.*; import
        org.joget.apps.form.service.*; import . . . '' : Class .forName ( "com.sqlserver.jdbc.Driver" )
        Target exception: java.lang.ClassNotFoundException: com.sqlserver.jdbc.Driver

        In the attached file catalina_2013-03-19.pdf you can see the full log file for the 19_03_2013..

        Thank's in advance for the help..

        Have a nice day