solidDB Help : solidDB Grid : Grid application considerations : Connecting to a grid
  
Connecting to a grid
Note Check the solidDB Release Notes for any limitations that are associated with using a grid in the current release.
You can connect to a grid by using drivers or utilities.
Drivers
You can use the ODBC or JDBC driver to connect to a grid by using grid-aware connect strings (a grid connection) or by using a direct connection to a specific grid node.
After the connection is established, the application cannot determine whether the connection is a grid connection or a direct connection.
If the connection is a grid connection, it has the following characteristics:
Statements or commands that work only on a grid leader node (for example, DDL statements) are routed to the leader.
Prepared statements that are executed based on parameter values are routed to the appropriate node for execution.
The application cannot determine which node will execute the statement.
If the connection is a direct connection, it has the following characteristics:
The behavior of statements that depend on where they are executed is determined by the role of the grid node (leader or follower) or by the parameter values of the statement.
The statement behavior might seem erratic unless the reason is understood. The statement might succeed or might generate error messages like the following examples:
SOLID Grid Error 18503: DDL operation not allowed in current grid node.
SOLID Table Error 13630: Writes are allowed only in Grid primary partition.
If a command must be executed in a specific grid node, you must use a direct connection.
ODBC
The grid option for the solidDB ODBC driver is enabled by using the keyword grid at the start of the driver connect string, see Connect strings for ODBC clients. For example:
SQLConnect(hDBC, "grid tcp myhost1 1964, tcp myhost2 1323, tcp 2323")
If a driver connect string (that does not use the grid keyword) is used to connect to a grid node, the driver does not use the grid configuration metadata to identify the correct grid node for an operation. Instead, the operation attempts to execute on the node that is defined in the connection string.
If a driver connect string (that uses the grid keyword) is used to connect to a standalone solidDB server, an error is returned.
JDBC
The grid option for the solidDB JDBC driver is enabled by setting the solid_grid_connection connection property to YES, in the driver connect string, see Connect strings for JDBC clients. For example:
Connection c = DriverManager.getConnection(
"jdbc:solid://nodeA:1313,nodeB:2323?solid_grid_connection=YES");
Utilities
solexp, solloado, solsql, and soldd use the ODBC grid-aware driver for communicating with the solidDB grid in the same way that they use the standalone ODBC driver to communicate with a standalone solidDB server. The utilities use the same connection string format as ODBC, for example:
solsql "grid tcp myhost1 1964" dba dba
solexp uses the distributed query mechanism for reading data from partitioned tables into a regular export file. The exported data can be loaded into any solidDBgrid or standalone installation, regardless of the topology.
solloado uses a special mode for the grid-enabled driver that allows larger batches of data to be inserted into grid nodes in a single transaction, which increases the throughput of a load operation.
solsql can update both non-partitioned (shared) tables and partitioned tables in any grid node. If solsql is started with the driver in non-grid mode, solsql can update only data that is on the node to which the driver is connected, but can read data from any grid node by using distributed queries.
Note When running SQL statements with solsql you must use bound parameters instead of literals for columns that are part of the partitioning key.
soldd creates tables and indexes but does not move any C Replicator objects that are related to internal replication objects in the grid. You can use soldd to restore data definitions in a grid that has already been set up.
Go up to
Grid application considerations