我是靠谱客的博主 谨慎战斗机,最近开发中收集的这篇文章主要介绍oracle官方驱动 go,go-oci8 - Go的Oracle驱动器使用database/sql,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

go-oci8

68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f6d6174746e2f676f2d6f6369383f7374617475732e73766768747470733a2f2f7472617669732d63692e6f72672f6d6174746e2f676f2d6f6369382e7376673f6272616e63683d6d617374657268747470733a2f2f676f7265706f7274636172642e636f6d2f62616467652f6769746875622e636f6d2f6d6174746e2f676f2d6f636938

Description

Golang Oracle database driver conforming to the Go database/sql interface

Installation

Install Oracle full client or Instant Client:

Install a C/C++ compiler

Install pkg-config, edit your package config file oci8.pc (examples below), then set environment variable PKG_CONFIG_PATH to oci8.pc file location (Or can use Go tag noPkgConfig then setup environment variables CGO_CFLAGS and CGO_LDFLAGS)

Go get with Go version 1.9 or higher

go get github.com/mattn/go-oci8

Try the simple select example:

If you have a build error it is normaly because of a misconfiguration, make sure to search close issues for help

oci8.pc Examples

Windows

prefix=/devel/target/XXXXXXXXXXXXXXXXXXXXXXXXXX

exec_prefix=${prefix}

libdir=C:/app/instantclient_12_2/sdk/oci/lib/msvc

includedir=C:/app/instantclient_12_2/sdk/include

glib_genmarshal=glib-genmarshal

gobject_query=gobject-query

glib_mkenums=glib-mkenums

Name: oci8

Description: oci8 library

Libs: -L${libdir} -loci

Cflags: -I${includedir}

Version: 12.2

Linux

prefix=/devel/target/XXXXXXXXXXXXXXXXXXXXXXXXXX

exec_prefix=${prefix}

libdir=/usr/lib/oracle/12.2/client64/lib

includedir=/usr/include/oracle/12.2/client64

glib_genmarshal=glib-genmarshal

gobject_query=gobject-query

glib_mkenums=glib-mkenums

Name: oci8

Description: oci8 library

Libs: -L${libdir} -lclntsh

Cflags: -I${includedir}

Version: 12.2

MacOs

Please install pkg-config with brew if not already present. Download the instant client and the sdk and unpack it e.g. in your Downloads folder and create therein a file names oci8.pc. Please replace with your actual username.

prefixdir=/Users//Downloads/instantclient_12_2/

libdir=${prefixdir}

includedir=${prefixdir}/sdk/include

Name: OCI

Description: Oracle database driver

Version: 12.2

Libs: -L${libdir} -lclntsh

Cflags: -I${includedir}

You also have to set these environment variables (e.g. permanently by adding them to your .bashrc)

export LD_LIBRARY_PATH=/Users//Downloads/instantclient_12_2

export PKG_CONFIG_PATH=/Users//Downloads/instantclient_12_2

SQL Examples

SQL examples can be found in the GoDoc reference:

And in _example:

Author

Yasuhiro Matsumoto (a.k.a mattn)

Special Thanks

Jamil Djadala

最后

以上就是谨慎战斗机为你收集整理的oracle官方驱动 go,go-oci8 - Go的Oracle驱动器使用database/sql的全部内容,希望文章能够帮你解决oracle官方驱动 go,go-oci8 - Go的Oracle驱动器使用database/sql所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部