Hi Thomas, Sorry I didn't mention I'm connecting to a tcp database.
In you test above, Change url to "jdbc:h2:tcp://localhost:9092/ mem:test;database_event_listener='" + TestSimpleDb.class.getName() +"'"; Obviously make sure the TestSimpleDb class is in the Server's classpath. Regards, Anthony On May 6, 11:28 pm, Thomas Mueller <[email protected]> wrote: > Hi, > > I can't reproduce the problem. In my test case, the database URL is > correct. I wonder if the database event listener is the right tool for > what you need. By the way, the script in INIT=RUNSCRIPT ... might be > in the classpath using the resource > URL:http://h2database.com/html/advanced.html#file_system"To read a stream > from the classpath, use the prefix classpath:, as in > classpath:/org/h2/samples/newsfeed.sql." > > My test case:http://h2database.com/p.html#5edb5768e4e6f7a3008a7673e403f1c1 > and below. > > Regards, > Thomas > > package db; > > import java.sql.Connection; > import java.sql.DriverManager; > import java.sql.SQLException; > import org.h2.api.DatabaseEventListener; > > public class TestSimpleDb implements DatabaseEventListener { > > public static void main(String... args) throws Exception { > String url = "jdbc:h2:mem:test;database_event_listener='" + > TestSimpleDb.class.getName() +"'"; > Class.forName("org.h2.Driver"); > Connection conn = DriverManager.getConnection(url); > conn.close(); > } > > public void closingDatabase() { > } > > public void diskSpaceIsLow() { > } > > public void exceptionThrown(SQLException e, String sql) { > } > > public void init(String url) { > System.out.println("init " + url); > } > > public void opened() { > } > > public void setProgress(int state, String name, int x, int max) { > } > > > > } -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
