GithubHelp home page GithubHelp logo

go-dbclient's Introduction

oracle client

https://zhuanlan.zhihu.com/p/371544255
https://github.com/mattn/go-oci8 https://github.com/godror/godror

试试看go-ora? 免客户端的 https://github.com/sijms/go-ora

本文採用go-ora

1 dev

 go run .\cmd\main.go -server oracle://xx:[email protected]:1522/cdrtest -sql "select * from dual"
 go run .\cmd\main.go -server oracle://xx:[email protected]:1522/cdrtest -sql "CREATE TABLE VIN_DEPT_ZW(EPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY, DNAME VARCHAR2(14))"
 
go run .\cmd\main.go -server oracle://xx:[email protected]:1522/cdrtest -sql "insert into VIN_DEPT_ZW(EPTNO,Dname) values (3,'vincentzou')"
Connection string:  oracle://xx:[email protected]:1522/cdrtest
execute sql:  insert into VIN_DEPT_ZW(EPTNO,Dname) values (3,'vincentzou')
affected result: 1

PS D:\code\go\go-oraclient> go run .\cmd\main.go -server oracle://cdrdev:[email protected]:1522/xx -sql "delete from VIN_DEPT_ZW where eptno = 3"
Connection string:  oracle://cdrdev:[email protected]:1522/cdrtest
execute sql:  delete from VIN_DEPT_ZW where eptno = 3
affected result: 1

PS D:\code\go\go-oraclient> go run .\cmd\main.go -server oracle://cdrdev:[email protected]:1522/xx -sql "select * from VIN_DEPT_ZW"
Connection string:  oracle://xx:[email protected]:1522/cdrtest
execute sql:  select * from VIN_DEPT_ZW
affected result: 0

PS D:\code\go\go-oraclient> go run .\cmd\main.go -server oracle://cdrdev:[email protected]:1522/xx -sql "DROP TABLE VIN_DEPT_ZW"   
Connection string:  oracle://xx:[email protected]:1522/cdrtest
execute sql:  DROP TABLE VIN_DEPT_ZW
affected result: 0 

2. compile

env GOOS=linux GOARCH=amd64 go build -o oractl main.go 
go build -o oractl main.go 
oractl -uname xx -password xx -host 192.168.199.177 -port 1522 -schema xx

3. make image

docker build --target oraclectl -t blueskyxi3/oraclectl:v0.0.1 -f Dockerfile .
docker build --target mysqlctl -t blueskyxi3/mysqlctl:v0.0.1 -f Dockerfile .
docker push blueskyxi3/oraclectl:v0.0.1
docker push  blueskyxi3/mysqlctl:v0.0.1
date

mysql

go run .\mysql\main.go -server "ecommapp:ecomm123@tcp(192.168.127.43:3306)/ecomm?charset=utf8mb4&parseTime=True" -sql "CREATE TABLE `testzw` (`T_ID` int(8) ,`T_NAME` varchar(8) ) ENGINE=Inn
oDB DEFAULT CHARSET=utf8 "  

go run .\mysql\main.go -server "ecommapp:ecomm123@tcp(192.168.127.43:3306)/ecomm?charset=utf8mb4&parseTime=True" -sql "insert into `testzw`(T_ID,T_NAME) values (3,'vincentzou')"

go-dbclient's People

Contributors

blueskyxi3 avatar

Watchers

James Cloos avatar  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.