You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Terry Polk <po...@lilly.com> on 2004/05/12 19:46:50 UTC

SqlTableModel and MySQL

Hello, this is a post similar to what Dominik Kreutz submitted in November
2003.

I'm able to attach to the database and run a query, as evidenced by the
table navigation controls (number of pages decreases if I remove rows from
the database table.)  The column headers are displayed OK too, but no data
is presented.

Here's what the catalina.out log shows:
=================================
May 12, 2004 12:22:26 PM
org.apache.tapestry.contrib.table.model.sql.SqlTableModel \
 getCurrentPageRows SEVERE: Cannot get current page rows
java.sql.SQLException: Syntax error or access violation, \
 message from server: "You have an error in your SQL syntax near \
 'OFFSET 0 ' at line 1"
=================================

I would appreciate any help on this issue.  Thank you!
-Terry


from the page's java class:
=================================
public class Home extends BasePage {
private ITableModel tableModel;

public ITableModel getTableModel() {
  if (tableModel == null) {
    ISqlConnectionSource connectionSource = new
    SimpleSqlConnectionSource("jdbc:mysql://localhost/tp", "user",
      "password");
     
  ISqlTableDataSource tableDataSource = new
    SimpleSqlTableDataSource(connectionSource, "calls");
     
  SqlTableColumnModel tableColumnModel = new
    SqlTableColumnModel(new SqlTableColumn[] {
    new SqlTableColumn("stocksym", "Stock Symbol", true),
    new SqlTableColumn("company", "Company", true)
    });
     
   tableModel = new
     SqlTableModel(tableDataSource, tableColumnModel);
  }
  return tableModel;
}
public void setTableModel(ITableModel tableModel) {
  this.tableModel = tableModel;
}
=================================

from the page specification:
=================================
<component id="myTable" type="contrib:Table">
  <binding name="tableModel" expression="tableModel"/>
</component>
=================================

from the page html:
=================================
<table jwcid="myTable" border=1/>
=================================



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org