Difference between revisions of "CREATE CONNECTION"

From Recital Documentation Wiki
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
==Class==
 
Data Connectivity
 
 
 
 
==Purpose==
 
==Purpose==
 
Create a gateway connection file
 
Create a gateway connection file
Line 161: Line 157:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL]]
 
[[Category:SQL]]
 
[[Category:Commands]]
 
[[Category:Commands]]

Latest revision as of 15:30, 10 November 2009

Purpose

Create a gateway connection file


Syntax

CREATE CONNECTION <filename> | (<expC1>) | ?

[DATASOURCE <cNode> [USERID <cUser>] [PASSWORD <cPass>] [DATABASE <cDatabase>]]

| [CONNSTRING <cConnstring>]

| [AS <cKeyPairString>]


See Also

Configuration Files, DROP CONNECTION, REMOTE DATA CONNECTIVITY FUNCTIONS, SET SQL


Description

The CREATE CONNECTION command is used to create a gateway connection file to an external SQL database. The connection file can be used by the SQLCONNECT() and SQLSTRINGCONNECT() remote data connectivity functions to establish a connection for SQL access to the database.


Keywords Description
filename The name of the gateway connection. If no file extension is specified, then .gtw is used.
(<expC>) A character expression, enclosed in round brackets, that returns a valid filename for the gateway connection.
? Displays a Select a File dialog allowing an existing connection file to be selected and modified. This is only applicable for Recital Terminal Developer.


If the optional clauses are not specified, the CREATE GATEWAY worksurface provides a full screen facility for gateway connection file creation in Recital Terminal Developer. The following elements can be defined for the gateway connection:


Server Element Description
Name The remote database server name, e.g. RECITAL
Network Node Name The node name or IP address of the server
Protocol Type The connection protocol, TCP/IP
Login Username The login for the database server
Login Password The login password for the database server
Database Name The full name (including path if applicable) of the database


Information relating to individual tables is not required and is relevant only when gateway files are being used within the Recital forms system rather than with the remote data connectivity functions via cursor access.


Server Element Description
Table Name The table name from the database
Table Primary Key The primary index key for the table
Table Restriction An optional SQL SELECT…WHERE clause


Client Element Description
Structure Name The name of the matching Recital structure table
Alias Name The alias name for the client table
Default Form Name The default screen form to be used


The connection details can be supplied using the DATASOURCE or CONNSTRING clauses:


Keyword Description
DATASOURCE <cNode> Specify the node name or IP address of the server
USERID <cUser> Specify the login for the database server
PASSWORD <cPass> Specify the login password for the database server
DATABASE <cDatabase> Specify the name of the database
CONNSTRING <cConnstring> Specify an ODBC connection string


The remote database server name defaults to RECITAL.

The AS <cKeyPairString> is defined using the following key pairs:


Key Pair Description
TYPE=<cType> Specify the connection type: ODBC, JDBC, OLEDB, ORACLE, INGRES, MYSQL, POSTRGRESQL, RECITAL
NODE=<cNode> Specify the node name or IP address of the server
USERID=<cUser> Specify the login for the database server
PASSWORD=<cPass> Specify the login password for the database server
DATABASE=<cDatabase> Specify the name of the database
CONNECTION=<cConnstring> Specify an ODBC, JDBC or OLEDB connection string
TABLE=<cTable> Specify the database table name
PRIMARYKEY=<cKey> Specify the primary key for the database table
SQLSELECT=<cSelect> Specify an optional SQL SELECT…WHERE clause


Each key pair is separated by a semi-colon, ';'.


Example

// config.db
set sql to vfp
set sql on
// end of config.db
 
CREATE CONNECTION conn1 DATASOURCE "server1" USERID "user1";
  PASSWORD "pass1" DATABASE "/usr/recital/data/demo"
nStatHand = SQLCONNECT("conn1.gtw")
if nStatHand < 1
    dialog box [Could not connect]
else
    nTabEnd = SQLTABLES(nStatHand)
    if nTabEnd = 1
        select sqlresult
        browse
    endif
    SQLDISCONNECT(nStatHand)
endif


Products

Recital Server, Recital