Hello Vadim,
Thanks for your answer. Ok i will delete this connect() method from my code.
But do you know why my datasource object does not containt columns of my product table ? Why datasource does not retrieve automatically associated column of my SQL request ?
In my report I have my Product datasource but there is no associated columns.
You can see here the code :
Code: Select all
public void onNewReportTemplate(StiReport report, HttpServletRequest request) {
//create database
String oracleConnection = "server=SERVER;database=DB;user=USER;password=PASSWORD;";
report.getDictionary().getDatabases().add(new StiOracleDatabase("OracleConnection", oracleConnection));
//create datasource for this database
StiOracleSource productDS = new StiOracleSource("OracleConnection", "PRODUCT", "PRODUCT", "SELECT * FROM PRODUCT");
report.getDataSources().add(productDS);
System.out.println(report.getDataSources().get("PRODUCT").getColumns().size());
}
In this code, the size of the columns array is 0.
if a create manually my columns like this, it works fine. But colums are not automatically retrieved...Please, Is there a way to do it ?
Code: Select all
StiOracleSource productDS = new StiOracleSource("OracleConnection", "PRODUCT", "PRODUCT", "SELECT * FROM PRODUCT");
productDS.setDictionary(report.getDictionary());
report.getDataSources().add(productDS);
productDS.columns.add(new StiDataColumn("PRICE", "PRICE", StiSystemType.getSystemType("System.Int32")));
productDS.columns.add(new StiDataColumn("STATUS", "STATUS", StiSystemType.getSystemType("System.Int32")));
productDS.columns.add(new StiDataColumn("WEIGHT", "WEIGHT", StiSystemType.getSystemType("System.Int32")));
Thanks for your helps.