Menu

Database_connection

Patrice Secheresse

This page gives some resources and advice about the database connection.

Using H2

Using H2 database as an Embedded database

The setup is url: jdbc:h2:/volunteerbase/volunteerDB and the driver is: org.h2.Driver
This solution is easy to set up but some file locking problems occurs. Pehaps removing the locking could be the solution (url : "jdbc:h2:/volunteerbase/volunteerDB;FILE_LOCK NO"). But it's better to use the H2 database as Network database.

Using H2 database as a Network database with Win XP

The better way is to set up the database as a service. To do it, in the directory H2_INSTALLATION_DIRECTORY\H2\service, launch the command file 1_install_service.bat. It will install the database as a service. In the settings, go to the services and start the service.

For people that are getting any special errors like this: "Cannot start service, .......".
It can always be helpfull to try to restart the pc for every change to take effect.
__

You can modify this service to start automatically so you don't have to worry about it.
The setup is url: jdbc:h2:tcp:localhost/volunteerDB driver: org.h2.Driver

Note : using the H2 console while Tomcat is running or starting Tomcat while the console is in use can lead to problem. I think H2 console use an embedded Java Web server and there are identical ports usage. The console is not necessary in this project, the access can be done directly from NetBeans.

Note2 : it seems that after installing H2 as service, tomcat resets its port to another port number and both things(H2 and Tomcat) work like expected. (Tested 19/06/2007 Johan Verlinden)//

[Image:DBconnBrowser.jpg]
Forgive me for having to show you a Dutch screenshot :) (Johan Verlinden)

Connecting to the database with NetBeans and setting the persistence configuration

Note: this should be moved to the developement section.
See Connecting to Databases tutorial.
You must change the VolunteerJPA persistence.xml file with the correct url parameter after setting the connection in the META-INF source folder.


Related

Wiki: Advanced_installation_guide

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.