Hi, The is not the correct way to use the server. You can't supply the database URL when starting the server. Try:
server = Server.createTcpServer().start(); and then connect to the database using the database URL "jdbc:h2:tcp://localhost/mem:test_mem". Regards, Thomas On Thu, Aug 15, 2013 at 3:40 PM, Derek Price <[email protected]> wrote: > I am new to H2 and was testing it out using a JUnit test and an in-memory > database. I would like to be able to query the in-memory database during > debugging and I saw another post or the help mentioning to use the TCP > Server. > > In my test, I have some very basic code like this: > > Class.forName("org.h2.Driver"); > conn = > DriverManager.getConnection("jdbc:h2:mem:test_mem;DB_CLOSE_DELAY=-1", "sa", > "sa"); > > server = Server.createTcpServer(new String[] { "-baseDir", > "jdbc:h2:tcp://localhost/mem:test_mem;DB_CLOSE_ON_EXIT=FALSE" > }).start(); > > preparedStatement = conn.prepareStatement("drop table if exists Test;"); > preparedStatement.executeUpdate(); > > preparedStatement = conn.prepareStatement("create table Test(Id int > primary key, Name varchar(255));"); > preparedStatement.executeUpdate(); > > preparedStatement = conn.prepareStatement("insert into Test values(1, > 'Hello');"); > preparedStatement.executeUpdate(); > resultSet.next(); > assertEquals(resultSet.getInt("Id"), 1); > assertEquals(resultSet.getString("Name"), "Hello"); > > > If I set a breakpoint on the one of the assertEquals(), is it possible to > query the database via the TCP server from either the command line, web or > external tool like SQL Workbench <http://www.sql-workbench.net/>? > > Thanks, > Derek > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/groups/opt_out.
