| Name | Size | Mode | Actions |
|---|---|---|---|
| close.html | 1476 | 0644 | editdlrm |
| conne.html | 5034 | 0644 | editdlrm |
| dsn.html | 2652 | 0644 | editdlrm |
| gloss.html | 20114 | 0644 | editdlrm |
| index.html | 277 | 0644 | editdlrm |
| intro.html | 2374 | 0644 | editdlrm |
| navi.html | 1023 | 0644 | editdlrm |
| odbc.css | 6801 | 0755 | editdlrm |
| query.html | 3600 | 0644 | editdlrm |
| resul.html | 6956 | 0644 | editdlrm |
/usr/share/doc/unixODBC/doc/ProgrammerManual/Tutorial/conne.html (5034B)
| Connecting to a Datasource | ||
First thing you will need is a variable of type
If you have allocated the handle you need to define which version of ODBC to use. Therefore
you should call Next thing to do is to create a handle for the database connection which is of the type
Then you may choose to modify the connection attributes, mainly the timeout for any given
action on the connection. You do this by calling
Finally we are able to connect to the database via SQL_SUCCESS, SQL_SUCCESS_WITH_INFO
if all went smoothly or SQL_ERROR or SQL_INVALID_HANDLE in case of an error. We will have a look on how to get diagnostic messages a little later.
So let's have a look at the code: |