我已编写此代码,但运行时会显示错误
sql命令未正确结束
我该如何解决?
DatabasetableUI
public class DatabasetableUI extends UI {
@Override
protected void init(VaadinRequest request) {
DatabaseTableScreen screen = new DatabaseTableScreen();
try {
JDBCConnectionPool connectionPool = new SimpleJDBCConnectionPool( "oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@usadc-sdbxt21:1521:GFRWMUAT","user", "password");
screen.populate("case_upload_history", connectionPool);
} catch (SQLException e) {
//System.out.println("Application");;
throw new RuntimeException( e.getMessage());
} enter code here
setContent( screen);
}
}
DatabaseTableScreen
public class DatabaseTableScreen extends VerticalLayout {private SQLContainer container;
private Table table;
public DatabaseTableScreen() {
setMargin( true);
table = new Table();
table.setPageLength( 10);
table.setEditable( true);
table.setSizeFull();
enter code here
//table.addGeneratedColumn("",new RemoveItemColumnGenerator());
addComponent(table);
}
public void populate( String tableName, JDBCConnectionPool connectionPool) {
QueryDelegate query = new TableQuery( tableName, connectionPool);
try {
container=new SQLContainer(query);
table.setContainerDataSource( container);
} catch (SQLException e) {
throw new RuntimeException( e);
}
}
}
答案 0 :(得分:2)
使用TableQuery
构造函数的第三个参数,如下所示:
QueryDelegate query = new TableQuery( tableName, connectionPool, new OracleGenerator());