Skip to content

How to enable load extension #1311

Closed
Closed
@playaround88

Description

@playaround88

Hi, I use gorm sqlite(underlay use go-sqlite3) as my project's sql driver , and when I try to load an extension like below

db, err = gorm.Open(sqlite.Open(conf.Dsn), &gorm.Config{})
if err != nil {
	fmt.Println(err)
	panic(err)
}
db.Exec("SELECT load_extension('" + path.Join(execDir, "libsqliteipv4.so") + "')")

I got an error.

2025/01/02 11:01:08 /**/app/dao/db.go:58 not authorized
[0.026ms] [rows:0] SELECT load_extension('/**/libsqliteipv4.so')

but when I connect db file use shell cmd, use .dbconfig can see load_extension is default on, and exec SELECT load_extension('./libsqliteipv4.so') is OK!

sqlite>.dbconfig
      ...
     load_extension on

I have check that go-sqlite default is enabled load extension, but why I got this exception? and how can I fix, pls help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions