select DB in mysql

Hello Vaadin People,

i have a little problem that drives me crazy.
Where can i select a DB after establishing the connection with the connectionpool class?

In the following case no tablequery works beacause no DB is selected.


connectionPool = new SimpleJDBCConnectionPool(
				        "com.mysql.jdbc.Driver",
				        "thecorrectURI", "user", "pass");

TableQuery tq = new TableQuery("items", connectionPool);
SQLContainer itemTableContainer = new SQLContainer(tq);

At that point it always causes the exception:
“java.lang.IllegalArgumentException: Table with the name “items” was not found. Check your database contents.”

And trust me, the table “items” does exist.

I already added a StringDecorator(“","”) - not working.
I also checked the connection. It gets established.

Whan i use this java standard code, it works:


ResultSet result = stmt.executeQuery("USE thedbname");				
result = stmt.executeQuery("SELECT * FROM items");

I couldnt find any solution in the whole vaadin documentation.

Thank you for your help.

You should include the DB name in the connection URI, e.g.

[code]
jdbc:mysql://localhost:3306/YourDBName

[/code]As far as I know you can’t change it afterwards without creating a new connection pool.

thanks alot!