Creating Persistent Space with JDBC SA

  GigaSpaces 5.X

Documentation Home
Quick Start Guide
Release Notes

Previous release

  Search Here
Searching GigaSpaces Platform 5.X Documentation

                                               

Summary: Providing the persistent backend relational database mapping file and the JDBC connection information.

This page is specific to:
GigaSpaces 5.x

If you're interested in another version, click it below:
GigaSpaces 6.0
GigaSpaces 6.5

Overview

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:

  1. Start Space instance or space container.
  2. Start the GigaSpaces Space Browser.
  3. Right-click your container icon and select Create Space.
    The Create New Space dialog opens:
  4. Provide a space name, for example, myPersistentSpace.
  5. Select the Persistent check box.
  6. On the Persistence tab, select the following options:
    Storage Adapter Class:
    com.j_spaces.sadapter.GenericJDBC.JDBCStorageAdapter

    Storage Adapter URL:

    /GenericJDBCProperties/HSQLProperties
  7. Click the Advanced button at the bottom of the dialog.
  8. On the Performance tab, select the Native Serialization option.
  9. On the Memory Management tab select the LRU Cache policy.
  10. Press the Create button.
  11. The Schema Name Definition window opens:
  12. Enter a name for your newly created space schema and click OK. This will generate a new space that persists its data into the HSQL database.

Using the Command Line

createSpace <container name> <space name> -p <SA URL>

For example:

createSpace mycontainer myPersistentSpace -p c:\GigaSpaces5.0EAG\GenericJDBCProperties\HSQLProperties

The SA URL is the location of the persistent backend relational database mapping file (type.properties) and the JDBC connection information file (jdbc.properties).

For more information, refer to: Persistency Configuration Files.
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;

For more details, refer to:


Wiki Content Tree


Your Feedback Needed!

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.

Labels

 
(None)