This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
tutorials:simple_flatfile [2009/12/05 18:12] tdo created |
tutorials:simple_flatfile [2012/10/26 14:46] (current) |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| <html><div align="center"><span style="color:red">DRAFT</span></div></html> | <html><div align="center"><span style="color:red">DRAFT</span></div></html> | ||
| ====== Simple Flat File ====== | ====== Simple Flat File ====== | ||
| + | ==== Step 1 - Creating the Omnidex Environment Source DDL ==== | ||
| + | Omnidex uses the SQL Standard Data Definition Statement (DDL) for defining the Omnidex metadata used to connect to a data store. | ||
| + | |||
| + | The following sample Environment Catalog Source is the minimum set of statements that will compile into an Omnidex Compiled Environment. | ||
| + | |||
| + | <code> | ||
| + | CREATE ENVIRONMENT in "first.xml" | ||
| + | |||
| + | CREATE DATABASE tinydb | ||
| + | TYPE flatfile | ||
| + | in "first.xml" | ||
| + | |||
| + | CREATE TABLE table1 | ||
| + | (myseq DATATYPE INTEGER omnidex, | ||
| + | mytext DATATYPE CHAR(60) quicktext) | ||
| + | in "first.xml" | ||
| + | </code> | ||
| + | |||
| + | Although these DDL statements can be entered directly in OdxSQL, they are typically created in an editor. So use Notepad or any other text editor to create the Omnidex Environment DDL source file. You can also select, cut and paste the text from this documentation to create the file. | ||
| + | |||
| + | This creates an Omnidex Environment named "first.xml" with a single Database named "tinydb" with one table named "table1". Because the DATABASE TYPE is "flatfile", the name of the underlying operating system file for this table is "table1". Typically a filespec location would be used. Copy and save this environment as "first.src". | ||
| + | |||
| + | ==== Step 2 - Compile the Omnidex Environment source into XML Environment Catalog ==== | ||
| + | |||
| + | os> odxsql | ||
| + | odxsql> use first.sql | ||
| + | odxsql> exit | ||
| + | |||
| + | ==== Step 3 - Use OdxSQL to test, verify and manipulate the Environment ==== | ||
| + | |||
| + | OdxSQL accepts a command line argument to specify the Omnidex Environment. | ||
| + | |||
| + | os> odxsql first.xml | ||
| + | |||
| + | Alternatively, OdxSQL can be run and then a CONNECT command can be issued. | ||
| + | |||
| + | os> odxsql | ||
| + | > connect first.xml | ||
| + | |||
| + | > create file table1 | ||
| + | |||
| + | OdxSQL contains several commands that facilitate with working with the underlying operating system without leaving OdxSQL. | ||
| + | |||
| + | > insert into table1 values (1, 'my text') | ||
| + | |||
| + | Standard SQL INSERT statements are supported. | ||
| + | |||
| + | > select * from table1 | ||
| + | |||
| + | <code> | ||
| + | |||
| + | |||
| + | C:\dev\odx\tiny>odxsql first.xml | ||
| + | ODXSQL - Omnidex SQL Mon Nov 30 21:41:59 2009 | ||
| + | (c) Dynamic Information Systems Corp. 1981-2009 5.0 Build 1H | ||
| + | Microsoft Windows XP Professional SP 3 (2600) TDO830/TDO | ||
| + | ** Trial Copy ** | ||
| + | |||
| + | |||
| + | Connected to C:\dev\odx\tiny\tiny.env | ||
| + | > create file table1 | ||
| + | File table1 created | ||
| + | |||
| + | > insert into values (1, 'lions, tigers, and bears') | ||
| + | 1 row inserted into TABLE1 | ||
| + | > insert into values (2, 'lions, tigers, kittys, cougars') | ||
| + | 1 row inserted into TABLE1 | ||
| + | > insert into valu (3, 'The teddy bears are having a picnic') | ||
| + | 1 row inserted into TABLE1 | ||
| + | |||
| + | > select * from table1 | ||
| + | |||
| + | MYSEQ MYTEXT | ||
| + | ----------- ------------------------------------------------------------ | ||
| + | 1 lions, tigers, and bears | ||
| + | 2 lions, tigers, kittys, cougars | ||
| + | 3 The teddy bears are having a picnic | ||
| + | |||
| + | |||
| + | 1 row returned | ||
| + | > | ||
| + | </code> | ||
| + | ==== Step 4 - Build Indexes with DBINSTAL ==== | ||
| + | |||
| + | <code> | ||
| + | os> odxsql first | ||
| + | odxsql> update indexes | ||
| + | </code> | ||
| + | |||
| + | ==== Step 5 - Develop an Application with ODBC, JDBC or Stored Procedures ==== | ||
| + | |||
| + | After creating an Omnidex Environment and adding Omnidex indexes via DBINSTAL, applications can be developed using the DISC provided ODBC and JDBC drivers. | ||
| + | |||
| + | Create an ODBC or JDBC datasource using the Windows Client DataSource Editor (DSEDIT). | ||
| + | |||
| + | Name the file as "first.dsn". | ||
| + | |||
| + | Or modify the following text file and save as tiny.dsn. | ||
| + | Change the following lines to the correct path and filenames. | ||
| + | |||
| + | Change these three lines with: | ||
| + | * Host= Change this value to the name of computer being used for this test. | ||
| + | * ODBCDSNFILE= Change this value to the path and file name of the dsn file. | ||
| + | * FileSpec= Change this value to the path and filename of the Omnidex Environment file. | ||
| + | |||
| + | Cut and paste this text as "tiny.dsn" with the modifications and save in the same directory as the "tiny.env" Omnidex Environment file. | ||
| + | |||
| + | <code> | ||
| + | Host=tdo830 | ||
| + | ODBCDSNFILE=C:\dev\odx\first.dsn | ||
| + | FileSpec=c:\dev\odx\first.xml | ||
| + | </code> | ||
| + | |||
| + | <code> | ||
| + | ODBC] | ||
| + | DRIVER=DISC OMNIDEX OdxNet Driver | ||
| + | ODBCDSNFILE=C:\dev\odx\first.dsn | ||
| + | ODBCDSNNAME=firstdsn | ||
| + | [DataSources] | ||
| + | tinydsn=DataSource Edit Wizard Generated | ||
| + | [DataSource firstdsn] | ||
| + | Dictionary=firstdsn | ||
| + | DisplayWindow=NONE | ||
| + | [Dictionaries] | ||
| + | tinydsn=DataSource Edit Wizard Generated | ||
| + | [Dictionary firstdsn] | ||
| + | Server=Server1 | ||
| + | NetworkServices=OdxNet | ||
| + | Type=OmniAccess | ||
| + | FileSpec=c:\dev\odx\first.env | ||
| + | HostOAConnectOptions= | ||
| + | Password=!~ | ||
| + | AccessOptions=Write | ||
| + | [Servers] | ||
| + | Server1=DataSource Edit Wizard Generated | ||
| + | [Server Server1] | ||
| + | Host=tdo830 | ||
| + | Port=7555 | ||
| + | </code> | ||
| + | ==== Step 6 - Simulate a client server environment using OdxNet with ODBC or JDBC ==== | ||
| + | |||
| + | Start a new command window as odxnet will run and await connections in the new command window. | ||
| + | |||
| + | os> odxnet | ||
| + | |||
| + | Go back to the original command window and do the following: | ||
| + | |||
| + | os> odxsql first.dsn -odbc | ||
| + | |||
| + | or run an ODXNET listener from within OdexSQL using the -odxnet command line option. | ||
| + | |||
| + | os> odxsql -odxnet | ||
| + | > connect first.dsn using odbc | ||
| + | | ||
| + | <code> | ||
| + | > select * from table1 where mytext = 'bears' | ||
| + | |||
| + | MYSEQ MYTEXT | ||
| + | ----------- ------------------------------------------------------------ | ||
| + | 1 lions, tigers, and bears | ||
| + | 3 The teddy bears are having a picnic | ||
| + | </code> | ||
| + | |||
| + | ### Note that Omnidex will do a quick text (Keyword) retreival automatically ## | ||
| + | ==== Step 7 - Insert a new row to see that it is indexed ==== | ||
| + | |||
| + | > insert into table1 values (4, 'Da Bears') | ||
| + | 1 row inserted into TABLE1 | ||
| + | |||
| + | <code> | ||
| + | > select * from table1 where mytext = 'bears' | ||
| + | |||
| + | MYSEQ MYTEXT | ||
| + | ----------- ------------------------------------------------------------ | ||
| + | 1 lions, tigers, and bears | ||
| + | 3 The teddy bears are having a picnic | ||
| + | 4 Da Bears | ||
| + | </code> | ||
| + | |||
| + | ==== Tutorial Summary ==== | ||
| + | By following these tutorial steps, you should have successfully: | ||
| + | * Created a Flat File Environment | ||
| + | * Created the file and inserted data. | ||
| + | * Used DBINSTAL to specify and build the Omnidex indexes. | ||
| + | * Performed Omnidex retrievals. | ||
| + | * Simulated a client/server environment with ODBC and OdxNet Network Services. | ||
| + | |||
| {{page>:bottom_add&nofooter&noeditbtn}} | {{page>:bottom_add&nofooter&noeditbtn}} | ||