Comments (6)
I appreciate you writing that page for us Mac users 😄 Unfortunately I did actually follow those directions, and the weird part that really confuses me is that go get
succeeded without errors but then actually trying to use the package only partly succeeded (with warnings).
However, the actual issue is now immaterial for me because Informix, which I am burdened with using, stopped making the ODBC driver for Mac, and the latest one they have doesn't work with recent versions of OSX 😓
from odbc.
This error comes from cgo. If you installed unixODBC libraries, then cgo should be able to find unixODBC sql.h file. Can you build small C program that uses unixODBC package?
Alex
from odbc.
You need install unixodbc package. For example, on Ubuntu you would need to do:
sudo apt install unixodbc-dev
from odbc.
I'm getting the same error and am rather confused by it...
go get github.com/alexbrainman/odbc/api # works fine
go get github.com/alexbrainman/odbc # works fine
Then if I execute:
mkdir odbctest
cd odbctest
go mod init odbctest
then put this in main.go in that folder:
package main
import (
"database/sql"
_ "github.com/alexbrainman/odbc"
)
func querySources() {
sourceDB, err := sql.Open("odbc", "DSN=my_dsn_goes_here")
if err != nil {
panic(err)
}
defer sourceDB.Close()
}
func main() {
querySources()
}
Then run go build
from that directory, it fails with:
# github.com/alexbrainman/odbc/api
../../go/pkg/mod/github.com/alexbrainman/[email protected]/api/api_unix.go:15:11: fatal error: 'sql.h' file not found
#include <sql.h>
^~~~~~~
1 error generated.
Here's proof that I have it:
$ find /opt/homebrew -iname 'sql.h'
/opt/homebrew/include/sql.h
/opt/homebrew/Cellar/mailutils/3.17/include/mailutils/sql.h
/opt/homebrew/Cellar/zig/0.13.0/lib/zig/libc/include/any-windows-any/sql.h
/opt/homebrew/Cellar/unixodbc/2.3.12/include/sql.h
$ brew info unixodbc
==> unixodbc: stable 2.3.12 (bottled)
ODBC 3 connectivity for UNIX
https://www.unixodbc.org/
Conflicts with:
virtuoso (because both install `isql` binaries)
Installed
/opt/homebrew/Cellar/unixodbc/2.3.12 (47 files, 2.3MB) *
Poured from bottle using the formulae.brew.sh API on 2023-08-16 at 16:35:33
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/u/unixodbc.rb
License: LGPL-2.1-or-later
==> Dependencies
Required: libtool ✔
==> Analytics
install: 18,758 (30 days), 57,966 (90 days), 304,584 (365 days)
install-on-request: 2,108 (30 days), 6,370 (90 days), 34,881 (365 days)
build-error: 5 (30 days)
from odbc.
Running this command gets me a working executable, but prints out warnings:
$ CGO_CFLAGS="-I/opt/homebrew/Cellar/unixodbc/2.3.12/include" CGO_LDFLAGS="-L/opt/homebrew/Cellar/unixodbc/2.3.12/lib" go build
# inventory
ld: warning: ignoring duplicate libraries: '-lodbc'
ld: warning: search path '/usr/local/opt/unixodbc/lib' not found
from odbc.
I don't use Mac OS myself.
But try following https://github.com/alexbrainman/odbc/wiki/GettingStartedOnOSX , perhaps it will help.
Alex
from odbc.
Related Issues (20)
- Implement QueryerContext interface HOT 1
- Implement RowsColumnTypeDatabaseTypeName HOT 1
- error when build from linux HOT 2
- only half of unicode string is inserted.
- Issue with Unixodbc-2.3.7 for master and for_issue_88 branch HOT 1
- 向 varchar字段保存中文中会被截断 HOT 12
- Maintain releases HOT 5
- The package is returning a panic instead of an error HOT 4
- Issues with parametrized queries Windows/DuckDB HOT 2
- abount microsoft access long binary data type HOT 1
- Unrecognized Data Type on Column
- random errors when doing the db.query using Denodo odbc driver HOT 1
- Does this package support `-buildmode=c-shared` HOT 1
- Error : unrecognized import path "golang.zx2c4.com/go118/netip" HOT 2
- connect db2 when column is NULL, parsing data error execution an error occurred is {wrong column #1 length 4294967295 returned, 16 expected} HOT 3
- (duckdb ODBC) Cannot Insert INTEGER HOT 3
- Cannot Update Golang Bool value to TINYINT column HOT 1
- QueryContext raises `panic: send on closed channel` HOT 2
- When Querying Tally ERP Through ODBC Certain Fields Cause A Wrong Column Error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odbc.