# Connecting Prolog to a SQL Database to Store facts

**URL:** <https://swi-prolog.discourse.group/t/connecting-prolog-to-a-sql-database-to-store-facts/7348>\
**Category:** Data Structure\
**Created:** [April 2, 2024, 2:38pm UTC](https://swi-prolog.discourse.group/t/connecting-prolog-to-a-sql-database-to-store-facts/7348 "2024-04-02T14:38:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MERABET](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@MERABET](https://swi-prolog.discourse.group/u/MERABET)\
**Post date:** [April 2, 2024, 2:38pm UTC](https://swi-prolog.discourse.group/t/connecting-prolog-to-a-sql-database-to-store-facts/7348/1 "2024-04-02T14:38:05Z")

</div>

I wish to store multiple sets of different facts in a database. Do you have any idea or example that could help me connect Prolog to an SQL database to then retrieve these facts, so that an expert system coded can utilize them?

Thank’s in advance!

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 2, 2024, 6:02pm UTC](https://swi-prolog.discourse.group/t/connecting-prolog-to-a-sql-database-to-store-facts/7348/2 "2024-04-02T18:02:26Z")

</div>

See library(odbc). Setting up odbc can be a bit of a challenge ☹
