When using embedded mode, you don't need to start it. You just make a regular jdbc connection using the proper url string and the database will "start" automatically. It then shutsdown when the jvm shuts down.
See "Connecting to a Database using JDBC" in the tutorial. The features page lists the url string options. Tim On Aug 2, 6:13 pm, ye <[email protected]> wrote: > BTW, I googled some snippets, such as "new String[] { "-tcpPort", "9101" }"; > > If this is what it is missing, I am wondering whether the "Embedded Mode" > also needs to open a port? How should it look like. > > Thanks! > > Cheers, > ye > > > > On Mon, Aug 3, 2009 at 1:06 AM, ye.huang <[email protected]> wrote: > > Hi folks: > > > I am not sure whether I missed something, however, I felt difficult to > > start a h2database (embedded) from my java code, (it should be > > possible, isn't it?) > > > The H2 tutorial mentioned some code as: > > > # import org.h2.tools.Server; > > # ... > > # // start the TCP Server > > # Server server = Server.createTcpServer(args).start(); > > # ... > > # // stop the TCP Server > > # server.stop(); > > > However, it's not complete, what should I replace if I wanna start a > > embedded h2db from the java code, and close it when the work is done? > > > Best Regards, > > ye > > -- > Ye Huang, Department of Informatics > University of Fribourg / Pérolles 2 - Bld de Pérolles 90 > 1700 Fribourg, Switzerland > > e-mail: [email protected], > [email protected]http://diuf.unifr.ch/people/huangy/ > Office: +41 26 429 65 95 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
