Skip to content

Commit c0e80ff

Browse files
committed
[README.md] Add doc for odbc transport
1 parent 8957bb4 commit c0e80ff

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [idb-connector](#idb-connector)
1414
- [REST](#rest)
1515
- [SSH](#ssh)
16+
- [ODBC](#odbc)
1617
- [ProgramCall](#programcall)
1718
- [Example](#example)
1819
- [CommandCall](#commandcall)
@@ -39,7 +40,7 @@ Before installing, download and install Node.js
3940
The Connection class is used to transport xml input and return xml output.
4041

4142
#### Transports
42-
Supported transports include [idb-connector](https://github.com/IBM/nodejs-idb-connector), REST, and SSH.
43+
Supported transports include [idb-connector](https://github.com/IBM/nodejs-idb-connector), REST, SSH, and ODBC.
4344

4445
##### idb-connector
4546
The [idb-connector](https://github.com/IBM/nodejs-idb-connector) transport establishes a database connection and calls XMLSERVICE stored procedure.
@@ -126,6 +127,59 @@ const connection = new Connection({
126127
});
127128
```
128129

130+
##### ODBC
131+
The [ODBC](https://github.com/wankdanker/node-odbc/tree/v2.0) transport establishes a database connection and calls XMLSERVICE stored procedure.
132+
133+
Before using the ODBC transport ensure all dependencies are installed.
134+
135+
Ensure the IBM i Access ODBC driver is installed where you will be running Node.js.
136+
137+
`TODO document installation`
138+
139+
On the client side ensure `unixODBC` and `unixODBC-devel` are both installed.
140+
141+
On IBM i this can be done with:
142+
143+
`yum install unixODBC unixODBC-devel`
144+
145+
Refer to [node-odbc](https://github.com/wankdanker/node-odbc/tree/v2.0#installation) for how this is done your OS.
146+
147+
Also on the client side ensure the `IBM i Access ODBC Driver` is installed.
148+
149+
`TODO document installation`
150+
151+
To use the `ODBC` transport create an instance of Connection with:
152+
153+
```javascript
154+
const connection = new Connection({
155+
transport: 'odbc',
156+
transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword'}
157+
});
158+
```
159+
160+
Alternatively you can specify a [DSN](https://support.microsoft.com/en-us/help/966849/what-is-a-dsn-data-source-name) to use.
161+
162+
Create an `.odbc.ini` file within your home directory and add additional configuration options.
163+
164+
Refer to the [knowledge center](https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzaik/connectkeywords.htm) for a list of valid options.
165+
166+
A simple .odbc.ini file:
167+
168+
```
169+
[*LOCAL]
170+
Driver=IBM i Access ODBC Driver
171+
UserID=myuser
172+
Password=mypass
173+
System=localhost
174+
```
175+
To use the `ODBC` transport with a DSN create an instance of Connection with:
176+
177+
```javascript
178+
const connection = new Connection({
179+
transport: 'odbc',
180+
transportOptions: { dsn: '*LOCAL'}
181+
});
182+
```
129183
### ProgramCall
130184
The ProgramCall class is used to call IBM i programs and service programs.
131185

0 commit comments

Comments
 (0)