Cannot Insert Data using Java Connector

Good Day! I’m currently developing a Scheduling Module, and the loading of data works very well! However, I cannot add activity or insert new activity to the database!

newgantt.html

[code]

How to Start with dhtmlxGantt
[/code]

JsonGanttDataServlet:

[code]
import java.sql.Connection;
import java.sql.DriverManager;

import com.dhtmlx.connector.*;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = “JSONDataServlets”, urlPatterns = {"/data1"})
public class JsonGanttDataServlet extends ThreadSafeConnectorServlet{
@Override
protected void configure(HttpServletRequest req, HttpServletResponse res) {
Connection conn=null;
try {
Class.forName (“com.mysql.jdbc.Driver”).newInstance ();
conn = DriverManager.getConnection(“jdbc:mysql://127.0.0.1:3306/gantt”, “devweb”, “qwerty”);
} catch (Throwable e) {
e.printStackTrace();
}

  JSONGanttConnector gantt = new JSONGanttConnector(conn, DBType.MySQL);
  gantt.servlet(req, res);
  
  
 
  gantt.render_links("gantt_links", "id", "source,target,type");
  gantt.render_table("gantt_tasks", "id", "start_date,duration,text,progress,parent");

}
}[/code]

Note: if I update an activity, it works! But I cannot add an activity

okay! I already solved my own problem! You just have to make sortorder, parent and duration to not null in the database :slight_smile: