Free Support Forum - aspose.com

Regarding the use of ResultSet while using with WorkbookDesigner

Hi,

Is it mandatory to use a ResultSet that is set to TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATABLE while passing it to the WorkbookDesigner.setDataSource() method. I’m using it with Java for populating a spreadsheet with smart markers. Is there any other way to work with the same. Code snippet is:

WorkbookDesigner designer = new WorkbookDesigner();
designer.open(filePath);
designer.setDataSource(“Datasource”,resultSet);


Thanks

Hi,

Well, you may also try to utilize ResultSet.TYPE_SCROLL_SENSITIVE with ResultSet.CONCUR_READ_ONLY attributes to create and fill your resultset object

Thank you.

Hi,

Thanks for the reply.
But i’am unable to use it in the following way:

Connection c = DriverManager.getConnection( url, usr, pwd);
Statement s = c.createStatement();
ResultSet r =s.executeQuery(query);
WorkbookDesigner designer = new WorkbookDesigner();
designer.open(filePath);
designer.setDataSource(“Datasource”,resultSet);

Until unless i set the characteristics of result set in the Statement, i’m unable to get the Smart markers replaced by actual values. Please let me know how to get the above logic to work without setting result set characteristics.

Thanks.

Hi,

Well, if you don't set the ResultSet attributes, if will be TYPE_FORWARD_ONLY by default, which is not supported in this context.

You need to utilize one of the following options.

1. Statement s = c.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);

2. Statement s = c.createStatement ( ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);

Thank you.