Skip to content

ninthclowd/netsuiteodbc

Repository files navigation

Go NetSuite ODBC connector for unixodbc

License: MIT Build CodeQL

This topic provides instructions for installing, running, and modifying the go netsuiteodbc driver for connecting to NetSuite ODBC databases through unixodbc.

Notice of Non-Affiliation and Disclaimer

This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with NetSuite, Oracle, or any of its subsidiaries or its affiliates. The official NetSuite website can be found at https://www.netsuite.com.

The names NetSuite and Oracle as well as related names, marks, emblems and images are registered trademarks of their respective owners.

Prerequisites

The following software packages are required to use the go unixodbc driver.

Go

The latest driver requires the Go language 1.20 or higher.

This connector requires go unixodbc and it's corresponding dependencies.

NetSuite ODBC Driver

The NetSuite ODBC driver must be installed and configured with unixodbc according to NetSuite documentation.

Configuration

Token Based Authentication

To connect to the ODBC database with token based authentication, use netsuiteodbc.NewConnectionStringer with a netsuiteodbc.Config to create a dynamic connection string for use in unixodbc.Connector:

package main

import (
	"github.com/ninthclowd/unixodbc"
	"github.com/ninthclowd/netsuiteodbc"
	"database/sql"
	"time"
)

func main() {
	//connect to the database using TBA
	db = sql.OpenDB(&unixodbc.Connector{
		ConnectionString: netsuiteodbc.NewConnectionStringer(netsuiteodbc.Config{
			ConnectionString: "DSN=NetSuite",
			ConsumerKey:    "<hex consumer key>",
			ConsumerSecret: "<hex consumer secret>",
			TokenId:        "<hex token id>",
			TokenSecret:    "<hex token secret>",
			AccountId:      "123456_SB1",
		}),
	})
	// set connection timeout to expected lifetime of token
	db.SetConnMaxLifetime(5 * time.Minute)
}

Development

The developer notes are hosted with the source code on GitHub.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages