Hi. I’m trying to display data in a table from database.
My Java connector looks like this.
package model;
================
Connector Servlet
==================
import com.dhtmlx.connector.ConnectorServlet;
import com.dhtmlx.connector.DBType;
import com.dhtmlx.connector.GridConnector;
import static java.lang.System.out;
import java.sql.Connection;
import java.sql.DriverManager;
/**
* The Class BasicConnector.
*/
public class rewardmsg extends ConnectorServlet {
@Override
protected void configure() {
//obtain DB connection
Connection conn=null;
try {
String connectionURL = "jdbc:sqlserver://MZAAIMANWRK\\\\SQLEXPRESS:7720;databaseName=msdb";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
conn = DriverManager.getConnection(connectionURL, "Spago", "Delta123");
} catch (Throwable e) {
out.println("Error at con->");
e.printStackTrace();
}
//Initializes connector
GridConnector c = new GridConnector(conn,DBType.MSSQL);
// c.servlet(req, res);
c.render_table("RewardUsers", "id", "NAME, LASTNAME, [ROLE], BRANCH");
}
}
========
this is the view portion in my jsp.
=========
{
view:"datatable",
url:"rewardmsg",
datatype:"JSON", /// i have tried all types.******
on:{
onBeforeLoad:function(){
webix.message("trigger");
this.showOverlay("Loading...");
},
onAfterLoad:function(){
this.hideOverlay();
}
}
},
============================
With this setup i get no errors, just a blank table.
============================
When i change the connector potion to this.===
GridConnector c = new GridConnector(conn);
// c.servlet(req, res);
c.render_table("RewardUsers", "id", "NAME, LASTNAME, [ROLE], BRANCH");
then i get an error.
Severe: com.dhtmlx.connector.ConnectorOperationException: Invalid SQL: SELECT id,NAME,LASTNAME,[ROLE],BRANCH FROM RewardUsers
The requested operation is not supported on forward only result sets.
Please help.