To create a persistent space with the JDBC SA, it is necessary to provide the persistent backend relational database mapping file and the JDBC connection information.
GigaSpaces supports numerous relational databases for creating persistent databases. For each supported database, GigaSpaces provides a relevant default mapping file and connection information, located under the <GigaSpaces ROOT>/GenericJDBCProperties directory.
When having multiple persistent spaces using the JDBC SA with the same database instance – you might need to increase the amount of database maximum active connections. The example below shows how this should be done with MySQL Database:
mysql> Set global max_user_connections=500
If you do not have a relational database as part of your system, you can use the open source HSQL Database Engine database, which is bundled with the GigaSpaces platform for your persistent space backend. HSQL Database Engine database is a 100% pure Java, fast and powerful database. Since the HSQL Database can run in embedded mode, there is no need to start it as a separate server. For more information about HSQL Operating modes, see: http://hsqldb.sourceforge.net
If you deploy a large Enterprise application with many users/threads accessing the persistent space concurrently, consider creating the space on top of an external industrial database such as ORACLE or DB2. We do not recommend the HSQL Database for production environments.
If you choose to use an external database, you must ensure that the JDBC driver can be found by GigaSpaces; this is usually accomplished by adding the driver jar/zip file to the classpath in the <GigaSpaces ROOT>/bin/setenv.bat (.sh) file, or by copying it into <GigaSpaces ROOT>/lib/ext directory and restarting GigaSpaces.
Using the Space Browser
To create a persistent space via the space browser:
Start Space instance or space container.
Start the GigaSpaces Space Browser.
Right-click your container icon and select Create Space.
The Create New Space dialog opens:
Provide a space name, for example, myPersistentSpace.
Select the Persistent check box.
On the Persistence tab, select the following options:
Storage Adapter Class:
The SA URL is the location of the persistent backend relational database mapping file (type.properties) and the JDBC connection information file (jdbc.properties).
wait_timeout and interactive_timeout database settings
You might need to modify the wait_timeout and interactive_timeout database settings to avoid having stale database connections used by the space. If the space has not accessed the database for a long time, all open database connections created by the space are moved into inactive mode, preventing the space to connect to the database the next time a client performs a space operation that result a database access.
To resolve this problem, change the wait_timeout and interactive_timeout database settings to have a large value. For example, with a MySQL database, call the following commands to modify the wait_timeout and interactive_timeout database settings values:
SET GLOBAL wait_timeout=288000;
SET GLOBAL interactive_timeout=288000;
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.
Add Comment