Cache support for Mysql

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

Cache support for Mysql

Postby Sudha » Mon Aug 22, 2011 4:39 am

Hi,

Can you provide support for cache in mysql database in DatabaseTable Model.? Currently its showing out of memory exception while we try to load huge records from mysql.



Thanks,
Sudha.
Sudha
 
Posts: 1
Joined: Sun Aug 21, 2011 11:51 pm

Re: Cache support for Mysql

Postby JIDE Support » Mon Aug 22, 2011 12:13 pm

Will put it in our job list and let you know if we have any progress.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Cache support for Mysql

Postby eliquious » Fri Mar 09, 2012 10:39 am

Hi,

Any progress? Perhaps another solution would be to add a constructor to the DatabaseTableModel passing in either a ResultSetTableModel or simply a ResultSet. This would allow the coders to apply the fix for the driver on the MySQL website. Otherwise, we have to wrap the ResultSetTableModel with our own IFilterableTableModel and ISortableTableModel implementations.

Thanks,

Max
eliquious
 
Posts: 6
Joined: Fri Jan 07, 2011 12:07 pm

Re: Cache support for Mysql

Postby JIDE Support » Fri Mar 09, 2012 2:22 pm

If this is a solution, please give the following code a try. You could now override DatabaseTableModel#refreshData() to add the cache on your end.
Code: Select all
        return new DatabaseTableModel(_connection, "*", "sales") {
            private Statement prepareStatement(String sql) throws SQLException {
                Statement statement = adjustStatement(_statement, sql);
                if (statement == null) {
                    statement = _statement;
                }
                return statement;
            }

            public void refreshData(SortItemSupport sortItemSupport, FilterItemSupport filterItemSupport) throws SQLException {
                String countStatement = createCountStatement(filterItemSupport);

                if (_statement == null) {
                    _statement = createStatement();
                }

                Statement statement = prepareStatement(countStatement);
                ResultSet countRs = statement.executeQuery(countStatement);
                countRs.next();
                int rowCount = countRs.getInt(1);

                StringBuffer s = createSqlStatement(_preStatement, _selectStatement, _fromStatement, sortItemSupport, filterItemSupport);

                String sql = s.toString();
                statement = prepareStatement(sql);
                ResultSet resultSet = statement.executeQuery(sql);
                if (_resultSetTableModel != null) {
                    _resultSetTableModel.close();
                }
                _resultSetTableModel = createResultSetTableModel(resultSet, rowCount);

                configureConverterContexts();

                fireTableDataChanged();
            }
        };

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Cache support for Mysql

Postby eliquious » Tue Mar 13, 2012 8:54 am

Thanks! That did get me started in the right direction.

Max
eliquious
 
Posts: 6
Joined: Fri Jan 07, 2011 12:07 pm


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 6 guests

cron