# Upgrade SQLite3 binding version?

**URL:** <https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384>\
**Category:** Help & Support\
**Created:** [June 13, 2021, 9:44pm UTC](https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384 "2021-06-13T21:44:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![noahlh](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/noahlh/32/126_2.png) [@noahlh](https://forum.crystal-lang.org/u/noahlh)\
**Post date:** [June 13, 2021, 9:44pm UTC](https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384/1 "2021-06-13T21:44:31Z")

</div>

I’ve given it the requisite hour of googling and experimentation to no avail, so I seek guidance from the experts :)

I’m trying to use the latest version of SQLite3 with a Crystal project, and I can’t figure out how to upgrade the version of the C binding that crystal-sqlite3 uses (sorry if I’m using the wrong terminology).

I was able to get the actual ‘sqlite3’ command to upgrade, but when I execute queries via the crystal-sqlite3 shard, queries are still running against an old version.

Any hints?

---

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [June 13, 2021, 10:38pm UTC](https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384/2 "2021-06-13T22:38:03Z")

</div>

How are you installing the updated sqlite3 package?

`$ crystal build --verbose ...` should show you the link command used. That will probably reveal the paths where the libsqlite3 is looked at.

You can try either:

- remove the old package or,
- tweak the `LIBRARY_PATH` to include the expected library location
- tweak the `CRYSTAL_LIBRARY_PATH` to include the expected library location
- change the crystal-sqlite3 shard to allow pkg\_config config lookup (and setup the `PKG_CONFIG_PATH` variable to include the location of the .pc file)

---

<div class="post-metadata">

**Author:** ![noahlh](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/noahlh/32/126_2.png) [@noahlh](https://forum.crystal-lang.org/u/noahlh)\
**Post date:** [November 20, 2021, 11:08pm UTC](https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384/3 "2021-11-20T23:08:39Z")

</div>

@bcardiff sorry for the absurdly long response - but I hate leaving threads hanging like this.

Thank you for the response and advice!!

I ended up avoiding the problem on my newer Mac which, when installed fresh, started with the latest version of sqlite3 (3.36.0). Sadly I didn’t get the satisfaction of actually fixing the old issue. But leaving this comment as a placeholder in case I run into this problem again in the future.

---

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [November 21, 2021, 1:32am UTC](https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384/4 "2021-11-21T01:32:45Z")

</div>

I’m glad you have a new machine and things are working. I just created [Allow pkg-config to determine library location · Issue #73 · crystal-lang/crystal-sqlite3 · GitHub](https://github.com/crystal-lang/crystal-sqlite3/issues/73) to have a simpler workaround for the next time.

---

<div class="post-metadata">

**Author:** ![chillfox](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/chillfox/32/1870_2.png) [@chillfox](https://forum.crystal-lang.org/u/chillfox)\
**Post date:** [November 22, 2021, 12:13am UTC](https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384/5 "2021-11-22T00:13:56Z")

</div>

This does seem to come up a few times a year.

Would it be worth adding a mini-tutorial or video to the SQLite shards readme?

I am thinking it could cover how to compile SQLite and link it.

I posted this last time I saw it come up: [How to statically link SQLite extension? - #7 by chillfox](https://forum.crystal-lang.org/t/how-to-statically-link-sqlite-extension/3441/7)

---

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [November 26, 2021, 1:19am UTC](https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384/6 "2021-11-26T01:19:57Z")

</div>

Sure thing! We can drop a .md in the repo or wiki, or if someone publishes an article in dev.to or similar we can link it from the readme directly.

---

<div class="post-metadata">

**Author:** ![chillfox](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/chillfox/32/1870_2.png) [@chillfox](https://forum.crystal-lang.org/u/chillfox)\
**Post date:** [November 26, 2021, 3:45am UTC](https://forum.crystal-lang.org/t/upgrade-sqlite3-binding-version/3384/7 "2021-11-26T03:45:08Z")

</div>

Ok, I will write it up over the weekend.

Edit: [Pull request](https://github.com/crystal-lang/crystal-sqlite3/pull/74) for a basic doc on compiling and linking SQLite.
