I had thought about doing this also, but am unsure how to, I use
Spring to do all this and am using a 'LocalSessionFactoryBean' to
create the schema, but this does not allow me to name the schema.
Does anyone have any ideas for an easy alternative where I could name
the schema ?
Thanks in advance,
-- Ross
On Dec 9 2009, 6:27 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:
Why can't you use the default schema?
Regards,
Thomas
Unfortunately the codebase requires two schema's, both specifically
named.
-- Ross
On Jan 23, 6:43 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:
> Unfortunately the codebase requires two schema's, both specifically
> named.
I still don't understand. Why does the codebase require two specially
named schemas, but doesn't create them?
Regards,
Thomas
Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
The most flexible solution is probably ";INIT=<list of SQL
statements>". The problem is that the ";" to delimit SQL statements
can't be used (unless there is some way to escape it; currently there
isn't).
There is a workaround I didn't think about first: to use the database
event listener. The problem is that there is currently no way to pass
the user and password to it, however it does work:
url += ";DATABASE_EVENT_LISTENER='"+ Init.class.getName() + "'";
Connection conn = DriverManager.getConnection(url, "sa", "sa");
Statement stat = conn.createStatement();
stat.execute("select * from test");
conn.close();
public class Init implements DatabaseEventListener {
private String databaseUrl;
public void init(String url) {
databaseUrl = url;
}
public void opened() {
try {
Connection conn =
DriverManager.getConnection(databaseUrl, "sa", "sa");
Statement stat = conn.createStatement();
stat.execute("create table if not exists test(id int)");
conn.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
...
Regards,
Thomas