折雨的天空
golang配置oracle访问连接(exit status 3221225595问题)
2018-1-14 我好笨


参考文章地址:







http://blog.csdn.net/notbaron/article/details/78168026?ref=myrecommend



http://blog.csdn.net/mecho/article/details/24305369



https://www.cnblogs.com/ghj1976/p/3437250.html







需要下载的:







方法一:



https://github.com/wendal/go-oci8



这个地址里说的很清楚步骤:






安装最新版的git,并设置可以从命令行直接调用git命令
下载OCI最新版,存放于C:\instantclient_11_2
下载OCI SDK最新版,存放于C:\instantclient_11_2\sdk
下载MinGW最新版,安装在C:\mingw
下载pkg-config.exe和oci8.pc (已经存放在windows文件夹下)
将pkg-config.exe复制到C:\mingw\bin\下
将oci8.pc复制到C:\mingw\lib\pkg-config\下
修改系统环境变量,添加
PATH=原有PATH;C:\instantclient_11_2;C:\mingw\bin;
PKG_CONFIG_PATH=C:\mingw\lib\pkg-config
执行 go get github.com/wendal/go-oci8

我这里没有放C盘,所有的都没有放C盘










一定要注意的是mingw如果是64位的,这个instantclient也必须是64位的。







mingw我下载的是:







http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.8.2/threads-posix/seh/ 



方法二:







使用:https://github.com/rana/ora







这个配置也是需要instantclient的,不然会 报错:exit status 3221225595,instantclient的版本不对也要报错同样的错。一点都不直观







使用这个是因为,他的实例里可以读写远程的oracle,而第一个需要配tns,但是我本地又不想配TNS,所以配了这种方案,结果发现都差不多。







安装这个版本的时候,牵扯到golang 官网被屏蔽,下载包出错的情况,



package golang.org/x/sync/errgroup: unrecognized import path "golang.org/x/sync/errgroup" (https fetch: Get https://golang.org/x/sync/errgroup?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)





解决方法:







http://blog.csdn.net/AlexWoo0501/article/details/73409917







获取 golang.org/x/net 包,其实只需要以下步骤:

mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/net.git

其它 golang.org/x 下的包获取皆可使用该方法



注意,这里面的net就是一个包。比如安装ora,需要sync包,则是
git clone https://github.com/golang/sync.git

大概安装三个包就行了

发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容