Goracle is deprecated because of naming (trademark) issues. Please use github.com/godror/godror instead! You can use "sed" to change everything: sed -i -e 's,goracle "gopkg.in/goracle.v2",godror "github.com/godror/godror",g; s,gopkg.in/goracle.v2,github.com/godror/godror,g; s/"goracle"/"godror"/g; s/goracle[.]/godror./g' $(find . -type f -name '*.go') sed -i -e '/goracle.v2/d' go.mod To change everything using modules: for dn in $(fgrep -l goracle.v2 $(find . -type f -name 'go.mod') | sed -e 's,/go.mod$,,'); do (cd "$dn" && git pull && sed -i -e 's,goracle "gopkg.in/goracle.v2",godror "github.com/godror/godror",g; s,gopkg.in/goracle.v2,github.com/godror/godror,g; s/"goracle"/"godror"/g; s/goracle[.]/godror./g' $(find . -type f -name '*.go') && sed -i -e '/goracle.v2/d' go.mod && git commit -am 'goracle -> godror' && git push) done
Goracle - Go database/sql driver for connecting to Oracle Database, using the ODPI-C library
Comments
-
Context with timeout not cancelling database call
We are calling a stored procedure like so:
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() _, err := db.updateLastScheduledStmt.ExecContext(ctx, mb.ID) return err
This about 1-10 times per day, this call never returns for unknown reasons, causing our process to just hang there until our cluster kills the whole pod 30 minutes later for failing a health check.
Not sure if it matters, but
updateLastScheduledStmt
is a*sqlx.Stmt
, which was successfully prepared and used successfully in previous calls. This is in the hot path of this app, and this call is being made about once per second or more, 100% successfully except when it doesn't return those few times per day.I don't know if the issue is specific to prepared stored procedures, or if timeout-contexts generally fail to cancel all database calls.
I am using git commit 94abed0e1b9d25c4e97186353f37a8825f02a704 of goracle.
-
Support for PRELIM auth connection mode?
ODPI supports
DPI_MODE_AUTH_PRELIM
when connecting to issue privileged or maintenance operations (startup/shutdown). ref: https://oracle.github.io/odpi/doc/enums/dpiAuthMode.html#dpiauthmodeOnce implemented the oracle specific driver extensions could have
dpiConn_startupDatabase
support anddpiConn_shutdownDatabase
(or better a wrapped shutdown implementation so users dont need to call shutdown twice per the documentation ref: https://docs.oracle.com/en/database/oracle/oracle-database/18/lnoci/database-startup-and-shutdown.html#GUID-44B24F65-8C24-4DF3-8FBF-B896A4D6F3F3Has this feature been considered previously? Is it possible to add this in as an additional parameter to the jdbc style url connection string? Currently no go driver appears to implement these features so it would be great to have this so a single go driver could run all maintenance tasks. (or even build a usable alternative to sqlplus)
-
goracle.v2 build issues -- help.
CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o ./build/regi
github.com/nytm/dba-regi-propensity-ingest-go/vendor/gopkg.in/goracle.v2
vendor/gopkg.in/goracle.v2/orahlp.go:65:2: undefined: describeOnly vendor/gopkg.in/goracle.v2/orahlp.go:228:26: undefined: PlSQLArrays vendor/gopkg.in/goracle.v2/orahlp.go:251:32: undefined: VersionInfo vendor/gopkg.in/goracle.v2/orahlp.go:254:10: undefined: VersionInfo vendor/gopkg.in/goracle.v2/orahlp.go:260:32: undefined: VersionInfo vendor/gopkg.in/goracle.v2/orahlp.go:277:19: undefined: VersionInfo vendor/gopkg.in/goracle.v2/orahlp.go:278:30: undefined: ObjectType vendor/gopkg.in/goracle.v2/orahlp.go:279:31: undefined: Event vendor/gopkg.in/goracle.v2/orahlp.go:279:41: undefined: Subscription vendor/gopkg.in/goracle.v2/orahlp.go:289:27: undefined: conn vendor/gopkg.in/goracle.v2/orahlp.go:254:10: too many errors
======= Host env details ====== MAC OS: x86_64 16.7.0 Darwin Kernel Version 16.7.0
go env GOARCH="amd64" GOBIN="" GOCACHE="/Users/206062/Library/Caches/go-build" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/206062/git/go" GORACE="" GOROOT="/usr/local/Cellar/go/1.10.2/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.10.2/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y8/332tkm8n2vlg_z15c0nnyy_xs0ccb_/T/go-build596531477=/tmp/go-build -gno-record-gcc-switches -fno-common"
gcc version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.0.0 (clang-900.0.39.2) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
-
Float to int problem
Hi Tamas,
I am testing goracle.v2 with one of our apps which used goracle.v1 previously. I get the following error when mapping a number column to an int field in a go struct. I am using sqlx for mappings.
sql: Scan error on column index 3: converting driver.Value type float64 ("2.934433e+06") to a int: invalid syntax
I remember we worked on this very issue when you were developing goracle.v1 and somehow fixed it. When I tried updating to rana/ora I again had the same issue and you couldn't fix it there. Is it possible to fix this in goracle.v2 and can I be of any help?
-
Building static binaries with libc linked in
I'm trying to build a static binary using:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o main main.go
where
main.go
is:package main import ( "database/sql" _ "gopkg.in/goracle.v2" ) func main() { _, err := sql.Open("goracle", "user/pass@host:port:db") if err != nil { panic(err) } }
and I get:
# gopkg.in/goracle.v2 ../../../gopkg.in/goracle.v2/orahlp.go:60:2: undefined: describeOnly ../../../gopkg.in/goracle.v2/orahlp.go:223:26: undefined: PlSQLArrays ../../../gopkg.in/goracle.v2/orahlp.go:246:32: undefined: VersionInfo ../../../gopkg.in/goracle.v2/orahlp.go:249:10: undefined: VersionInfo ../../../gopkg.in/goracle.v2/orahlp.go:255:32: undefined: VersionInfo ../../../gopkg.in/goracle.v2/orahlp.go:272:19: undefined: VersionInfo ../../../gopkg.in/goracle.v2/orahlp.go:273:30: undefined: ObjectType ../../../gopkg.in/goracle.v2/orahlp.go:274:31: undefined: Event ../../../gopkg.in/goracle.v2/orahlp.go:274:41: undefined: Subscription ../../../gopkg.in/goracle.v2/orahlp.go:284:27: undefined: conn ../../../gopkg.in/goracle.v2/orahlp.go:249:10: too many errors
For reference,
go build
builds without any errors.Any ideas?
-
Return dataSet
Is it possible to work with dataset using this driver? I have a procedure that returns me a dataset, but I'm not able to do the mapping.
QUERY := `BEGIN MOBILE.PC_MOBILE.PQ_QT_VISITAS( p_dt_ini => :vParam1, p_dt_fim => :vParam2, p_regional => :vParam3, p_resultset => :vParam4 ); END; ` _, err := db.Exec(QUERY, oracle.PlSQLArrays, dataInicial, dataFinal, regiao, sql.Out{Dest: &maior}); if err != nil { log.Println(err) } log.Println(maior) log.Println(media)
-
Expose odpi dpiConnCreateParams.newPassword
Is your feature request related to a problem? Please describe. odpi appears to expose a method for setting passwords when you connect to an expired account, and would be helpful so expired accounts can be reset via goracle.
Describe the solution you'd like Exposing it via a URI parameter similar to the rest of the dpiConnCreateParams seems fine and discover-able. It wouldnt be usable via ezconnect or tns style connect strings, but thats fine for me.
-
Support AQ
Hi, Could you please provide some functions for comfort work with Advanced Queue in Go? I'm interested in UDT (User Defined Type) and SYS.AQ$_JMS_TEXT_MESSAGE (for move Java project to Go) data types.
-
Support for "For Update" queries with autocommit on non-tx connections
We are facing a weird condition when working with queries that use "FOR UPDATE".
Normally, a query like this would block the row until a commit or a rollback is issued to the db:
select * from data.accounts WHERE ID = 76414 FOR UPDATE;
When using
sqlplus
or similar tools, their default behaviour is to setAUTOCOMMIT
to false, so upon closing the client the transaction opened by "FOR UPDATE" is commited or rolled back depending on the status.I've found that
goracle
used to support something similar:
https://github.com/go-goracle/goracle/blob/9d7b6d9aec7223fa4eb9ad49a5f20f87be59eb68/driver.go#L290But now I cannot find it in the documentation or code.
Due to our design we would need to either have this feature somehow or to obtain the transacion object/id returned from a "FOR UPDATE" query on Oracle.
Is there a possibility to solve this with the current status of the library?
-
Goracle limiting sessions
Is it possible that in certain circumstances, when one sets the db.SetMaxOpenConns(50) in database/SQL layer, there could be actually more than 50 sessions on database end since the goracle allows upto 1000 max sessions as default.
-
SDO_GEOMETRY scanning appears broken
I'm trying to get data from an
SDO_GEOMETRY
column, but the scanning seemingly doesn't work. This program just prints 5 blank rows:package main import ( "database/sql" "fmt" _ "github.com/go-goracle/goracle" ) func main() { db, err := sql.Open("goracle", "user/pass@db") if err != nil { panic(err) } rows, err := db.Query(` SELECT SDO_GEOMETRY('POINT(1 0)', 4326) SHAPE FROM DUAL UNION ALL SELECT SDO_GEOMETRY('POINT(0 1)', 4326) SHAPE FROM DUAL UNION ALL SELECT SDO_GEOMETRY('POINT(-1 4)', 4326) SHAPE FROM DUAL UNION ALL SELECT SDO_GEOMETRY('POINT(2 -6)', 4326) SHAPE FROM DUAL UNION ALL SELECT SDO_GEOMETRY('POINT(-2 7)', 4326) SHAPE FROM DUAL`, ) if err != nil { fmt.Println(err) } for i := 0; i < 5; i++ { rows.Next() b := sql.RawBytes{} rows.Scan(&b) fmt.Printf("% x\n", b) } }
Related tags
Hexagonal architecture paradigms, such as dividing adapters into primary (driver) and secondary (driven)Hexagonal architecture paradigms, such as dividing adapters into primary (driver) and secondary (driven)
authorizer Architecture In this project, I tried to apply hexagonal architecture paradigms, such as dividing adapters into primary (driver) and second
The Container Storage Interface (CSI) Driver for Fortress Block Storage This driver allows you to use Fortress Block Storage with your container orchestrator
fortress-csi The Container Storage Interface (CSI) Driver for Fortress Block Storage This driver allows you to use Fortress Block Storage with your co
Test-csi-driver - Amazon Elastic Block Store (EBS) CSI driver
Amazon Elastic Block Store (EBS) CSI driver Overview The Amazon Elastic Block St
Nomad-driver-await-dependency - A Nomad driver that acts as blocker for subsequent task until a given Consul service has reached a given state
Nomad Skeleton Driver Plugin Skeleton project for Nomad task driver plugins. Thi
A seed repository that contains a Go project that accepts input via a REST API and saves data to an Oracle database.
rest-oracle-go-seed A seed repository that contains a Go project that accepts input via a REST API and saves data to an Oracle database. Why Oracle? T
A k8s vault webhook is a Kubernetes webhook that can inject secrets into Kubernetes resources by connecting to multiple secret managers
k8s-vault-webhook is a Kubernetes admission webhook which listen for the events related to Kubernetes resources for injecting secret directly from sec
A kubernetes cni, connecting containers to neutron virtual networks.
neutron-cni A kubernetes cni, connecting containers to neutron virtual networks. Network Topology Architecture Quick Start Build make build-dev-im
El Carro is a new project that offers a way to run Oracle databases in Kubernetes as a portable, open source, community driven, no vendor lock-in container orchestration system. El Carro provides a powerful declarative API for comprehensive and consistent configuration and deployment as well as for real-time operations and monitoring.
El Carro: The Oracle Operator for Kubernetes Run Oracle on Kubernetes with El Carro El Carro is a new project that offers a way to run Oracle database
Simple online syncing tool for Oracle Object Store
TrollBox ... use your storage with Oracle Object Store Quick Start Make sure you have the Object Storage, bucket and you know the compartment id where
Injective's Oracle with dynamic price feeds (for External Integrations)
Injective's Oracle with dynamic price feeds. Allows anyone to start their own pre-approved price submission process to the oracle module on the Injective Chain.
An Oracle Cloud (OCI) Pulumi resource package, providing multi-language access to OCI
Oracle Cloud Infrastructure Resource Provider The Oracle Cloud Infrastructure (OCI) Resource Provider lets you manage OCI resources. Installing This p
CSI Driver for dynamic provisioning of Persistent Local Volumes for Kubernetes using LVM.
OpenEBS LVM CSI Driver CSI driver for provisioning Local PVs backed by LVM and more. Project Status Currently the LVM CSI Driver is in alpha
Sample Driver that provides reference implementation for Container Object Storage Interface (COSI) API
cosi-driver-minio Sample Driver that provides reference implementation for Container Object Storage Interface (COSI) API Community, discussion, contri
Kubernetes CSI driver for QNAP NAS's
QNAP CSI This is a very alpha QNAP Kubernetes CSI driver which lets you automatically provision iSCSI volumes on a QNAP NAS. Its only been tested on a
kubequery is a Osquery extension that provides SQL based analytics for Kubernetes clusters
kubequery powered by Osquery kubequery is a Osquery extension that provides SQL based analytics for Kubernetes clusters kubequery will be packaged as
sql 语句转成 ent schema
sql2ent 该项目提供 sql 语句转化为 entgo schema 代码的命令行工具, 以提高工作效率。 前往学习entgo 功能 已完成 使用命令行批量转化 支持 mysql 计划 支持更多的数据库,例如:MariaDB、SQLite、PostgreSQL。 读取数据库,批量生成 schem
Golang CRUD using database PostgreSQL, adding some fremework like mux and pq.
Golang CRUD with PostgreSQL Table of contents ?? General info Technologies Blog Setup General info GOPOST or Go-Post is a Golang REST API made to show
Backend Project using Go with Dgraph Database and Chi as HTTP Service
Drawflow-Requests For init DGraph Database docker run --rm -it -p 8080:8080 -v ~/dgraph:/dgraph dgraph/standalone:v20.03.0 docker run --rm -it -p 8080
A simple program to automatically backup a database using git. Err handling by Sentry, Reporting by Betteruptime. Made with 🩸 , 😓 & 😭
backup What is this? A Simple program to automatically backup a database using git. Err handling by Sentry, Uses heartbeats by Betteruptime Made with