ODBC Driver for DB2

Build 24.0.9060

Connecting

To connect to DB2, you can use either a DSN or an ODBC connection string. Both of these methods use the sql package's Open function.

Connect to a DSN

To connect using a DSN:

db, _ := sql.Open("odbc", "DSN=CData DB2 Sys;")
defer db.Close()

Provide a Driver Connection String

To connect using an ODBC connection string:

db, _ := sql.Open("odbc", "DRIVER={CData ODBC Driver for DB2};Server=10.0.1.2;Port=50000;User=admin;Password=admin;Database=test;")
defer db.Close()

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060