ODBC/Methods/Connect

From J Wiki
Jump to: navigation, search
ODBC: Data Sources | Handles | 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 'dsn=jdata'
30545248

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

   $cols=: 'tdata' ddcol ch
7 19

   3 4 7{"1 cols
+-----------+---------+-------------+
|COLUMN_NAME|DATA_TYPE|BUFFER_LENGTH|
+-----------+---------+-------------+
|NAME       |12       |30           |
+-----------+---------+-------------+
|SEX        |12       |2            |
+-----------+---------+-------------+
|DEPT       |12       |8            |
+-----------+---------+-------------+
|DOB        |4        |4            |
+-----------+---------+-------------+
|DOH        |4        |4            |
+-----------+---------+-------------+
|SALARY     |4        |4            |
+-----------+---------+-------------+