alexbrainman / odbc

odbc driver written in go
BSD 3-Clause "New" or "Revised" License
352 stars 140 forks source link

Windows .accdb file driver error #124

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello, I recently try to open a .accdb file in Ubuntu #123 but turns out i needed a driver and there aren't free ones so I want to try it in Windows 7. I follow this video - https://www.youtube.com/watch?v=biSjA8ms_Wk&feature=youtu.be and then i try to connect to my Access database like this:

package main

import (
    "database/sql"
    "fmt"

    _ "github.com/alexbrainman/odbc"
)

func main() {

    conn := fmt.Sprintf("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DSN=teste;DBQ=smpc.accdb;")
    db, err := sql.Open("odbc", conn)
    if err != nil {
        panic(err)
    }
    err = db.Ping()
    if err != nil {
        panic(err)
    }
}

and receive this error:

panic: SQLDriverConnect: {IM002} [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

ghost commented 5 years ago

I figure out the solution for my problem, i was using 32 Bits 2007 Office System Driver: Data Connectivity Components in my windows 7 64 Bits and had to run always as administrator to create the odbc. I install Microsoft Access Database Engine 2010 64 Bits and now works fine.

alexbrainman commented 5 years ago

I install Microsoft Access Database Engine 2010 64 Bits and now works fine.

SGTM

Alex