Difference between revisions of "SQLSTRINGCONNECT()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
− | Connect to a data source | + | Connect to a data source |
==Syntax== | ==Syntax== | ||
Line 9: | Line 9: | ||
==Description== | ==Description== | ||
− | The SQLSTRINGCONNECT() function is used to connect to a data source | + | The SQLSTRINGCONNECT() function is used to connect to a data source and return a statement handle for use by other SQL functions. |
{| class="wikitable" | {| class="wikitable" | ||
Line 17: | Line 17: | ||
True (.T.) Connection created is shared | True (.T.) Connection created is shared | ||
|- | |- | ||
− | |cConnectString||The data source gateway connection string | + | |cConnectString||The data source gateway connection string. |
− | + | ||
|- | |- | ||
|} | |} | ||
Line 61: | Line 60: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
// Store the return value to use as the nStatementHandle for subsequent function calls | // Store the return value to use as the nStatementHandle for subsequent function calls | ||
// Specify connection should be shared | // Specify connection should be shared |
Revision as of 13:03, 19 December 2012
Contents
Purpose
Connect to a data source
Syntax
SQLSTRINGCONNECT([<lShared>,] [<cConnectString> [, <lShared>]])
See Also
SQLCANCEL(), SQLCOLUMNS(), SQLCOMMIT(), SQLCONNECT(), SQLDISCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP(), SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLTABLES()
Description
The SQLSTRINGCONNECT() function is used to connect to a data source and return a statement handle for use by other SQL functions.
Keywords | Description |
---|---|
lShared | False (.F.) Connection created is not shared (default)
True (.T.) Connection created is shared |
cConnectString | The data source gateway connection string. |
cConnectString:
Parameter | Description |
---|---|
Server | Database server name or abbreviation, e.g. mys or mysql. |
Nodename | IP Address or hostname of the machine on which the database resides. |
Username | Username to log in to the external database. |
Password | Password for username above. |
Database | Database to connect to. |
Protocol | The network protocol. TCP/IP is assumed. |
Driver:DataSource | ODBC, OLEDB or JDBC server side data source in the format:
odbc:odbc_data_source_name_on_server oledb:oledb_connection_string_on_server jdbc:dbc_driver_path_on_server;jdbc:Lianja:args |
Return values:
Return Value | Description |
---|---|
> 0 | The workarea in which the gateway data source has been opened |
–1 | Connection creation error |
Example
// Store the return value to use as the nStatementHandle for subsequent function calls // Specify connection should be shared nStatHand = SQLSTRINGCONNECT("mysql@linux1:user1/pass1-database1.tcpip",.T.) // OLEDB DataSource nStatHand = SQLSTRINGCONNECT ("oledb:Provider=vfpoledb.1;" +; "Data Source=C:Data;Collating Sequence=general",.T.)