JDD/Methods/Connect

From J Wiki
< JDD
Jump to: navigation, search
JDD: Driver Locale | Handles | Data Sources | Data Driver | Error Messages | API: Connect Read Update Create Bulk Insert

The ddcon command connects to a data source returning a connection handle, using the form:

   [ch=. ddcon__db 'database=jdata;uid=root;pwd=****'
30545248

Actual format and parameters for ddcon will depend on individual JDD driver, please refer to test scripts in addons packages.

We have now connected to a data source, but not yet to a table. The table we will use is tdata, and the next statement uses ddcol to retrieve the column names and attributes for this table:

   $cols=: 'tdata' ddcol__db ch
8 18

   3 4 7{"1 cols
+-----------+---------+-------------+
|COLUMN_NAME|DATA_TYPE|BUFFER_LENGTH|
+-----------+---------+-------------+
|NAME       |12       |45           |
+-----------+---------+-------------+
|SEX        |12       |3            |
+-----------+---------+-------------+
|DEPT       |12       |12           |
+-----------+---------+-------------+
|DOB        |91       |10           |
+-----------+---------+-------------+
|DOH        |91       |10           |
+-----------+---------+-------------+
|SALARY     |3        |8            |
+-----------+---------+-------------+
|PHOTO      |_4       |_1           |
+-----------+---------+-------------+