go-dblib
is a shared library for go-ase
and
cgo-ase
. These are driver-implementations for the
database/sql
package of Go (golang) to
provide access to SAP ASE instances.
SAP ASE is the shorthand for SAP Adaptive Server Enterprise, a relational model database server originally known as Sybase SQL Server.
The package go-dblib
is a shared library for the
driver-implementations of go-ase
and cgo-ase
. Thus, one of
these implementations is required.
The packages in this repo can be go get
and imported as usual.
go get github.com/SAP/go-dblib/<package>
By importing go-dblib
there are several use-cases. For example, the
dsn
-package can be used to set up DSN information that is required to
connect to the ASE-database by using a connector.
package main
import (
"database/sql"
"github.com/SAP/go-dblib/dsn"
"github.com/SAP/go-ase"
)
func main() {
d := dsn.NewInfo()
d.Host = "hostname"
d.Port = "4901"
d.Username = "user"
d.Password = "pass"
connector, err := ase.NewConnector(*d)
if err != nil {
log.Printf("Failed to create connector: %v", err)
return
}
db, err := sql.OpenDB(connector)
if err != nil {
log.Printf("Failed to open database: %v", err)
return
}
defer db.Close()
if err := db.Ping(); if err != nil {
log.Printf("Failed to ping ASE: %v", err)
}
}
Unit tests for the packages are included in their respective directories
and can be run using go test
.
The list of known issues is available here.
Feel free to open issues for feature requests, bugs, or general feedback here.
Any help to improve this library is highly appreciated.
For details on how to contribute please see the contribution file.
Copyright (c) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache License 2.0 except as noted otherwise in the LICENSE file.