<div dir="ltr"><div>See my replies inline below.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 22, 2024 at 3:56 PM Jon Raiford <<a href="mailto:raiford@labware.com">raiford@labware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class="msg6127566652375419783">
<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_6127566652375419783WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">What exactly do you mean by not working? Is it not able to open the shared library? Or it is not able to connect to a database? The first thing that happens is allocating the environment by either calling
SQLAllocHandle() (current versions of ODBC) or SQLAllocEnv() (old versions of ODBC).</span></p></div></div></div></blockquote><div><br></div><div>I'll describe what I have tried below, but I'm not claiming that I have finished investigating this. It's just my progress so far.</div><div><br></div><div>1. Run the Homebrew command "<span style="color:rgb(0,0,0);font-family:monospace">brew install unixodbc</span>" to install the ODBC dynamic library.</div><div><font face="monospace"><span style="color:rgb(0,0,0);font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial"><br></span></font></div><div><span style="color:rgb(0,0,0);font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, sans-serif">That gives me the following files in /usr/local/lib:</font></span></div><div><font face="monospace"><span style="color:rgb(0,0,0);font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial"><br></span></font></div><div>libodbc.2.dylib<br>libodbc.a<br>libodbc.dylib<br>libodbccr.2.dylib<br>libodbccr.a<br>libodbccr.dylib<br>libodbcinst.2.dylib<br>libodbcinst.a<br>libodbcinst.dylib<font face="monospace"><span style="color:rgb(0,0,0);font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial"><br></span></font></div><div><br></div><div>2. Run the command <font face="arial, sans-serif">"</font><span class="ex" style="box-sizing:border-box;color:rgb(0,59,79);white-space:pre"><font face="monospace">brew</font></span><span style="color:rgb(0,59,79);white-space:pre;background-color:rgba(233,236,239,0.65)"><font face="monospace"> install sqliteodbc</font><font face="arial, sans-serif">" to install the SQLite-specific shared library.</font></span></div><div><span style="color:rgb(0,59,79);white-space:pre;background-color:rgba(233,236,239,0.65)"><font face="arial, sans-serif"><br></font></span></div><div><span style="color:rgb(0,59,79);white-space:pre;background-color:rgba(233,236,239,0.65)"><font face="arial, sans-serif">That gives me the file </font></span><span style="font-family:Consolas,Monaco,"Andale Mono","Ubuntu Mono",monospace;word-spacing:normal;color:rgb(84,84,84);background-color:rgb(254,254,254)">/usr/local/lib/libsqlite3odbc.dylib</span></div><div style="orphans: 2; widows: 2;"><font color="#545454" face="arial, sans-serif"><span style="background-color:rgb(254,254,254)">I'm not certain I need this file, but I reference it below.</span></font></div><div><span style="font-size:16px;color:rgb(0,0,0);font-family:monospace;font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial"><br></span></div><div>3. Create the file /usr/local/etc/odbc.ini containing the following which refers to a dynamic library that exists and SQLite database file that exists.</div><div><pre class="gmail-language-text" style="background:repeat rgb(254,254,254);color:rgb(84,84,84);word-break:normal;line-height:1.5;padding:1em;margin-top:0.5em;margin-bottom:0.5em;overflow:auto;border-radius:0.3em;font-size:medium;font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial"><code class="gmail-language-text" style="background-image:none;background-position:0% 0%;background-size:auto;background-repeat:repeat;background-origin:padding-box;background-clip:border-box;word-spacing:normal;word-break:normal;line-height:1.5">[TodoDSN]<br>Description = SQLite ODBC Driver<br>Driver = /usr/local/lib/libsqlite3odbc.dylib<br>Database = /Users/volkmannm/Documents/dev/lang/smalltalk/Cuis-Smalltalk-Dev-UserFiles/todos.db<br>Timeout = 2000</code></pre></div><div>4. Clone the GitHub repository at <a href="https://github.com/Cuis-Smalltalk/DatabaseSupport.git">https://github.com/Cuis-Smalltalk/DatabaseSupport.git</a> into the same directory that holds the Cuis-Smalltalk-Dev directory.</div><div><br></div><div>5. Change the file <font face="monospace">RunCuisOnMacTerminal.sh</font> to the following:</div><div><br></div><font face="monospace">export DYLD_LIBRARY_PATH="$(brew --prefix)/lib:${DYLD_LIBRARY_PATH}"<br></font><div><font face="monospace">./CuisVM.app/Contents/MacOS/Squeak CuisImage/Cuis?.?-????.image -u</font></div><div><br></div><div>5. Run that script.</div><div><br></div><div>6. Open a "File List", navigate to the DatabaseSupport directory, select <a href="http://ODBC.pck.st">ODBC.pck.st</a>, and click "install package".</div><div><br></div><div>7. Open a Workspace and evaluate the following:</div><div><pre class="gmail-language-smalltalk" style="background:repeat rgb(254,254,254);color:rgb(84,84,84);word-break:normal;line-height:1.5;padding:1em;margin-top:0.5em;margin-bottom:0.5em;overflow:auto;border-radius:0.3em;font-size:medium;font-variant-ligatures:normal;text-decoration-style:initial;text-decoration-color:initial"><code class="gmail-language-smalltalk" style="background-image:none;background-position:0% 0%;background-size:auto;background-repeat:repeat;background-origin:padding-box;background-clip:border-box;word-spacing:normal;word-break:normal;line-height:1.5">conn <span class="gmail-token gmail-operator" style="color:rgb(0,128,0)">:=</span> ODBCConnection dsn<span class="gmail-token gmail-punctuation">:</span> 'TodoDSN' user<span class="gmail-token gmail-punctuation">:</span> '' password<span class="gmail-token gmail-punctuation">:</span> ''<span class="gmail-token gmail-punctuation">.</span></code></pre></div><div>This gives the error "External module not found". See the attached screenshot.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class="msg6127566652375419783"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="m_6127566652375419783WordSection1"><p class="MsoNormal"><span style="font-size:11pt"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">I don’t have an easy way to test that old ODBC code at the moment, but it should be easy enough to find the library class. It is a subclass of ExternalLibrary. From there you can find the alloc call and walk
back through senders to figure out how it is called. From there you can see the order things are called.</span></p></div></div></div></blockquote><div><br></div><div>I only see one subclass of ExternalLibrary and it is ODBCLibrary. I think the alloc call you are referring to is the one in the attached screenshot, but I haven't been able to determine which external module it can't find. The line that fails is:</div><div><br></div><div><font face="monospace"><cdecl: int16 'SQLAllocEnv' (SQLHENV*)><br></font></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class="msg6127566652375419783"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="m_6127566652375419783WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">One annoying thing to note is that you cannot use the debugger to step through an FFI call. It will always say there is an invalid module or something like that. I’ve spoken to Eliot about this and we should
be able to get it fixed at some point. But for now just put a self halt after the call and then look at the return code.</span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Arranging a call would be difficult at the moment. I’m already burning the candle at both ends so not much time unfortunately.</span></p></div></div></div></blockquote><div><br></div><div>I understand. </div></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">R. Mark Volkmann</font></div><div><span style="font-size:12.8px"><font face="arial, helvetica, sans-serif">Object Computing, Inc.</font></span></div></div></div></div></div></div></div></div></div>