solidDB Help : Samples : Grid with JDBC sample
  
Grid with JDBC sample
This sample shows how to use the solidDB grid functionality with a JDBC application.
The files for the sample are located in the soliddb-installdir\samples\grid_jdbc directory. For general information about running the samples, see Samples.
Note To run the samples, you must install JDK 1.7 or later and set the PATH and CLASSPATH settings for the Java compiler.
The sample application (GridSample.java) completes the following actions:
1 Insert rows into a partitioned table by using a grid connection (all inserts succeed). Then attempt to insert rows into the same table by using a standard JDBC connection; inserts only succeed if the node hosts the primary replication unit (primary partition) for the row.
2 Insert rows into a non-partitioned (shared) table by using a grid connection (all inserts are directed to grid leader and succeed). Then attempt to insert rows into the same table by using a standard JDBC connection to a node that is not the leader node (no inserts succeed).
3 Drop a node from the grid and demonstrate that, for the partitioned table, the data on the dropped node is distributed to other nodes in the grid. Insert more rows into both tables to show that the grid continues to function.
4 Re-add the node to the grid and demonstrate that, for the partitioned table, the data is redistributed in the grid to include the restarted node. Insert more rows into both tables to show that the grid functions as it did originally.
Running the sample
Run the runme script (runme.bat on Windows) to compile the application, start four servers, create a grid from the servers, run the application, and shut down the servers.
Go up to
Samples