Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 Using SQL.

Similar presentations


Presentation on theme: "1 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 Using SQL."— Presentation transcript:

1 1 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BASIS This demonstration will use SQL functions to access data from a BASIS file and a similar ACCESS data file.

2 2 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BASIS First, we must set up the ODBC access to the files. This is the ODBC Manager screen for the BASIS demonstration file.

3 3 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BASIS This is a similar setup for the ACCESS database.

4 4 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BASIS There is a ACCESS version of the Chile Company Customer file located below: \basisdemo\vpro5\tools\chiledd\data

5 5 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BASIS Use the sqlopen verb to open the respective databases. The sqllist(0) command will render a list of databases available through ODBC in this case.

6 6 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BASIS Once an ODBC database has been opened, the SQL query can be built and assigned using the SQLPREP verb. Below is an example; SQLPREP(1)"select * from CUSTOMER where CURRENT_BAL>0" For the purposes of this example, we’ll use that syntax. Feel free to experiment!

7 7 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BASIS Dimension a string to capture the data and execute the SQL statement with the SQLEXEC verb. Place the data into the string variable CUST$ with the SQLFETCH command.

8 8 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BASIS Notice the results of the two identical queries from the two identical databases. The only discrepancies are in the field-level formatting, but the values are the same.

9 9 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BBj – JDBC In order to do the same thing using the JDBC driver, do the following: Make sure you have a reference to the sql.ini file in the config file you are launching BBj with. In the config: SQL=C:\Program Files\basis\cfg\sql.ini Make sure that the sql.ini is fully qualified for file access. In the sql.ini: [BASIS Data Sources] ChileCompanyJDBC [ChileCompanyJDBC] url=jdbc:basis:localhost?database=ChileCompany&user=guest **Where the database is called “ChileCompany” in the Enterprise Manager and the account “guest” has access.

10 10 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 E-mail: info@basis.com www.basis.com Using SQL in BBj – JDBC Notice that the file access is the same using JDBC as it is with ODBC.


Download ppt "1 ©1985-2003 BASIS International Ltd. All rights reserved. Sales: 505.938.6101 Tech Support: 505.345.5021 Using SQL."

Similar presentations


Ads by Google