Rounak Kumar
Rounak Kumar

Reputation: 1

Fetching data from Database And Display on the Screen using vaadin

I've written this code, but when run, it shows the error

sql command not properly ended

How can I fix it?

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);
        }
    }
}

Upvotes: 0

Views: 639

Answers (1)

user6082532
user6082532

Reputation:

Use the third argument to the TableQueryconstructor, like this:

QueryDelegate query = new TableQuery( tableName, connectionPool, new OracleGenerator());

Upvotes: 2

Related Questions