Some points of note related to odbc.ini
entries, e.g.
[swi_prolog]
Description = SWI-Prolog Discourse
Driver = /usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcpsqlS.so
Servername = localhost
UserName = <user name>
Password = <password>
Port = 5432
Database = swi_prolog
-
The entry name,[swi_prolog]
, and Database value are currently the same:swi_prolog
My understanding is that this is not required, the entry name and the Database name can be different. This is something I plan to verify and possibly use the results to update the Wiki. -
The Driver,/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so
, and Setup,/usr/lib/x86_64-linux-gnu/odbc/libodbcpsqlS.so
, values do not require the full path. I don’t know which means the system uses to find theso
files if the directories are removed. Once I know that I can enhance the Wiki. -
The Driver,/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so
, and Setup,/usr/lib/x86_64-linux-gnu/odbc/libodbcpsqlS.so
, values might be able to use the odbcinst.ini entries, e.g.PostgreSQL ANSI
andPostgreSQL Unicode
. I have seen this done in some examples but have not tested it.Update: It seems I should not be putting the specific drivers in
odbc.ini
, e.g.
Driver = /usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcpsqlS.so
they should be in /etc/odbcinst.ini
and /etc/odbc.ini
should use Driver = PostgreSQL ANSI
(ref)
-
The
UserName
andPassword
values are currently hard coded into file and visible as plain text. This needs to be removed as these values should be options of the connect. However once they are removed fromodbc.ini
then any connect means using theodbc.ini
entry needs to pass the user name and password along. Currently the wiki demonstrates two different ways to connect via ODBC,isql
andSWI-Prolog ODCBC
. So both of those ways need to be changed to demonstrate how to pass the values. -
I currently do not understand why there are two.so
files used, I was expecting just one. -
This should add a demonstration of when the values for
Servername
is something other thanlocalhost
.
In researching for the wiki I saw way to many examples that just gave values and really did not explain why they were what they were, or used a specific subset of the name=value
settings without showing alternatives which IMHO is what makes using ODBC so hard. If you can find entries that work you are lucky but if you have do it from scratch, with so many variations, it becomes many hours of trial and error. Thus this wiki needs to explain what the options are and the pros and cons of using it.
Also it should demonstrate that their are several links in the chain and that if anyone of them is broken the chain is broken. That is why I added the use of isql
before installing the SWI-Prolog ODBC package, it shows that you can check part of your work before adding more links, e.g. SWI-Prolog ODBC, to the chain. Also for each link (part in the sequence) it should explain what that link does, how it connects to its neighbors in the sequence, choices for that link and tools to work with that link.
Another thing that was confusing is that ODBC started with Microsoft and thus the use of *.ini
files. Then in Linux they did it like Microsoft for many years and now using odbcinst seems to be the norm. Explaining how to use odbcinst
needs to be added to the wiki.
Update: Added some query examples but still many more of the odbcinst commands are not demonstrated.
The wiki also needs a companion wiki or additional section that explains how to use isql
for those really quick queries.
The wiki needs a lot more details of how to use SWI-Prolog ODBC with examples.
- The result from the example query using SWI-Prolog was
row(10082)
which was displayed as such. What would be better is to parse out the result then use just the needed parts as necessary. At present because I have not done enough examples it may be just a few simple unification patterns done as as clauses for a result predicate that gets the needed values, or it might require DCGs.
Update: Working on example that parses the words in the posts
table raw
field into words then use WordNet to check spelling mistakes at first and then expand on higher abstractions.
The wiki should show examples of error messages and how to correct them, e.g. what if you skip installing SWI-Prolog ODBC, what if you spell an entryname in odbc.ini
incorrectly, what if the *.so
files can not be found, etc.
In writing the wiki I used WSL2 and the command line only, this wiki should also note the use of GUI tools.
The main reason I wrote the wiki is because if we get Discourse running at OSU OSL then we can add plugins and such that will allow others access, initially read only, to the data for the forum stored in a PostgreSQL database and this is a crucial step that is needed. In doing a proof of concept I needed to understand this and so shared what I learned via the wiki.
The wiki should also try to add graphic representations to help explain things, e.g. the links in the chain. I plan to use GraphViz to generate such visuals and leave the dot files hidden in the post as HTML comments if possible or as link to another topic, possibly even a Discourse category holding just the Dot files.
Need to explain with values in odbc.ini
are optional.