Difference between revisions of "Lianja ODBC Driver on Windows"
From Lianjapedia
Yvonne.milne (Talk | contribs) (Created page with "==Using the Lianja ODBC Driver== Before using the Lianja ODBC Driver, complete the following steps: # [http://www.lianja.com/component/rsfiles/files Download] and install the ...") |
Yvonne.milne (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | ==Using the Lianja ODBC Driver== | + | ==Before Using the Lianja ODBC Driver== |
Before using the Lianja ODBC Driver, complete the following steps: | Before using the Lianja ODBC Driver, complete the following steps: | ||
# [http://www.lianja.com/component/rsfiles/files Download] and install the driver. The driver is included in the Lianja SQL Server distribution and a client driver-only Lianja ODBC Driver distribution. The driver requires a local or remote Lianja SQL Server to operate. | # [http://www.lianja.com/component/rsfiles/files Download] and install the driver. The driver is included in the Lianja SQL Server distribution and a client driver-only Lianja ODBC Driver distribution. The driver requires a local or remote Lianja SQL Server to operate. | ||
Line 6: | Line 6: | ||
# Make sure the Lianja SQL Server [[Lianja SQL Server Manager#Service Manager|service is running]]. | # Make sure the Lianja SQL Server [[Lianja SQL Server Manager#Service Manager|service is running]]. | ||
# Create a DSN for your data source in the [[Lianja ODBC Manager]] and [[Lianja ODBC Manager#Connection_Information|test the connection]]. | # Create a DSN for your data source in the [[Lianja ODBC Manager]] and [[Lianja ODBC Manager#Connection_Information|test the connection]]. | ||
+ | |||
+ | ==Using ODBC Data Sources in the Lianja App Builder== | ||
+ | Your Lianja ODBC DSN, and other third-party ODBC data sources, can be accessed from the Lianja App Builder in the following ways: | ||
+ | |||
+ | * Using the [[SQL Remote Data Connectivity Functions]] | ||
+ | * Using the [[USE|USE...CONNSTR]] NoSQL Command | ||
+ | * By creating a [[CREATE VIRTUALTABLE|Virtual Table]] in a local database | ||
+ | * In the ODBC Console | ||
+ | [[{{ns:file}}:odbc_console.png|150px|thumb|left|ODBC Console]] | ||
+ | <br clear=all> | ||
+ | * By Importing the data into a new local database | ||
+ | [[{{ns:file}}:ImportODBCDatabase.png|150px|thumb|left|Import ODBC Database]] | ||
+ | <br clear=all> | ||
+ | |||
+ | ==Lianja ODBC Driver Additional Functionality== | ||
+ | Full Lianja SQL documentation can be found here: [[:Category:SQL|SQL]]. | ||
+ | |||
+ | ===Calling Stored Procedures=== | ||
+ | Stored Procedures can be called using the '''CALL''' command. Stored procedures are .prg script files residing in a database's directory. For example, the script sp_demo.prg has been created in the southwind database in the Lianja App Builder: | ||
+ | [[{{ns:file}}:StoredProcedure.png|150px|thumb|left|Stored Procedure]] | ||
+ | It takes a parameter, selects data and returns the data as a resultset: | ||
+ | |||
+ | <code lang="recital"> | ||
+ | lparameters lcState | ||
+ | select account_no, state from example; | ||
+ | where state = lcState; | ||
+ | into cursor curExample | ||
+ | return setresultset("curExample")</code> | ||
+ | <br clear=all> | ||
+ | After being [[Deploying to Local Directory|deployed]] to the Lianja SQL Server database directory, it can be called when an ODBC connection to the southwind database is active: | ||
+ | <code lang="recital"> | ||
+ | nhand = sqlconnect("Lianja_Southwind") | ||
+ | if nhand > 0 | ||
+ | nret = sqlexec(nhand,"call sp_demo('MA')","mycursor") | ||
+ | if nret > 0 | ||
+ | select mycursor | ||
+ | browse | ||
+ | endif | ||
+ | sqldisconnect(nhand) | ||
+ | endif</code> |
Revision as of 07:11, 7 February 2013
Contents
Before Using the Lianja ODBC Driver
Before using the Lianja ODBC Driver, complete the following steps:
- Download and install the driver. The driver is included in the Lianja SQL Server distribution and a client driver-only Lianja ODBC Driver distribution. The driver requires a local or remote Lianja SQL Server to operate.
- Select your Lianja database or create it in the Lianja App Builder Data Workspace or using SQL.
- Copy or Deploy your database to the Lianja SQL Server Database directory.
- Make sure the Lianja SQL Server service is running.
- Create a DSN for your data source in the Lianja ODBC Manager and test the connection.
Using ODBC Data Sources in the Lianja App Builder
Your Lianja ODBC DSN, and other third-party ODBC data sources, can be accessed from the Lianja App Builder in the following ways:
- Using the SQL Remote Data Connectivity Functions
- Using the USE...CONNSTR NoSQL Command
- By creating a Virtual Table in a local database
- In the ODBC Console
- By Importing the data into a new local database
Lianja ODBC Driver Additional Functionality
Full Lianja SQL documentation can be found here: SQL.
Calling Stored Procedures
Stored Procedures can be called using the CALL command. Stored procedures are .prg script files residing in a database's directory. For example, the script sp_demo.prg has been created in the southwind database in the Lianja App Builder:
It takes a parameter, selects data and returns the data as a resultset:
lparameters lcState select account_no, state from example; where state = lcState; into cursor curExample return setresultset("curExample")
After being deployed to the Lianja SQL Server database directory, it can be called when an ODBC connection to the southwind database is active:
nhand = sqlconnect("Lianja_Southwind") if nhand > 0 nret = sqlexec(nhand,"call sp_demo('MA')","mycursor") if nret > 0 select mycursor browse endif sqldisconnect(nhand) endif