Giter VIP home page Giter VIP logo

dmtest's Introduction

go 操作dm数据库

windows

windows上连接dm,安装dm时默认安装配置了odbc,所以可以直接连接

linux

  1. go get odbc 测试,缺少sql.sh即需要安装odbc
$go get github.com/alexbrainman/odbc
go: writing go.mod cache: mkdir /home/lurenjia/gopath/pkg/mod/cache/download/github.com/jackc/fake: permission denied
go: writing go.mod cache: mkdir /home/lurenjia/gopath/pkg/mod/cache/download/github.com/jackc/pgx/@v: permission denied
go: writing go.mod cache: open /home/lurenjia/gopath/pkg/mod/cache/download/github.com/denisenkom/go-mssqldb/@v/v0.0.0-20190707035753-2be1aa521ff4.mod496193015.tmp: permission denied
go: downloading github.com/alexbrainman/odbc v0.0.0-20200426075526-f0492dfa1575
go: downloading golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
# github.com/alexbrainman/odbc/api
../../../../gopath/pkg/mod/github.com/alexbrainman/[email protected]/api/api_unix.go:14:11: fatal error: sql.h: No such file or directory
 // #include <sql.h>
           ^~~~~~~
compilation terminated.
  1. 安装odbc
 apt-get install unixodbc unixodbc-bin unixodbc-dev
  1. 编写驱动信息
root@lurenjia:# cat /etc/odbcinst.ini
[DM8 ODBC DRIVER]
Description = ODBC DRIVER FOR DM8
Driver = /opt/dmdbms/drivers/odbc/libdodbc.so
root@lurenjia:# cat /etc/odbc.ini
[dm]
Description = DM ODBC DSN
Driver = DM8 ODBC DRIVER
SERVER = localhost
UID = SYSDBA
PWD = SYSDBA
TCP_PORT = 5236
  1. 测试连接
 isql -v dm SYSDBA SYSDBA
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>

结果如上图,即为测试成功

可参考《DM程序员手册》

dmtest's People

Contributors

lurenjia528 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.