Re: [racket-users] querying MS SQL Server with db-lib (ODBC)

2020-09-21 Thread Jin-Ho King
Thanks, Ryan, for working through this with me.

In response to your questions, (1) my connection string does not have any 
non-ASCII characters, and it does not have any backslashes (nor does it need 
any), and (2) yes, I’ve been using Racket CS. Here is the output from Racket BC:

Allocating env handle... done: 0
0
Setting ODBC version... done: 0
0
Allocating db handle... done: 0
0
Connecting... done: -1
odbc-driver-connect: 
  SQLSTATE: 
  context...:
   /Applications/Racket v7.8/collects/db/private/generic/interfaces.rkt:170:0: 
raise-sql-error
   /Applications/Racket 
v7.8/share/pkgs/db-lib/db/private/odbc/connection.rkt:781:0: handle-status*
   "/Users/jinho/git/eoddata-rkt/test-odbc.rkt": [running body]
   temp35_0
   for-loop
   run-module-instance!
   perform-require!

We might be approaching a dead end, but I appreciate your help!

~ Jin-Ho.

--
"Ad astra per alia porci"

> On Sep 19, 2020, at 7:07 PM, Ryan Culpepper  wrote:
> 
> 
> So, it seems that there are two problems: (1) the connection fails (even 
> though it works with pyodbc) and (2) retrieving the diagnostic information 
> after the error hangs with the MS driver. I don't see an obvious reason for 
> either problem, but I have two thoughts.
> 
> Does your connection string have any non-ASCII characters? A difference in 
> string conversion is one of the few things I can imagine distinguishing 
> odbc-driver-connect's behavior from pyodbc, since IIUC both just pass the 
> connection string to SQLDriverConnect without any processing. Also, 
> double-check backslashes.
> 
> It looks like you're using Racket CS. Could you try the program with Racket 
> BC too? It's possible that there's some difference in the FFI's behavior 
> between the two versions that the db library is not accounting for.
> 
> Ryan
> 
> 
>> On Sat, Sep 19, 2020 at 10:06 PM Jin-Ho King  wrote:
>> Hi Ryan, thanks so much for your suggestions. Here is the output from 
>> running your program with my original connection string, which works in 
>> python using pyodbc:
>> 
>> Allocating env handle... done: 0
>> 0
>> Setting ODBC version... done: 0
>> 0
>> Allocating db handle... done: 0
>> 0
>> Connecting... done: -1
>> 
>> This is where it hangs.
>> 
>> Based on your suggestions about trying different drivers, I tried switching 
>> drivers from the "ODBC Driver 17 for SQL Server” that I had been using to 
>> the FreeTDS driver the example in your program uses. I was able to 
>> successfully connect using the FreeTDS driver in python using pyodbc. Using 
>> the same connection string, I ran your program again. This time, running 
>> your program didn't hang, but the output was not promising either:
>> 
>> Allocating env handle... done: 0
>> 0
>> Setting ODBC version... done: 0
>> 0
>> Allocating db handle... done: 0
>> 0
>> Connecting... done: -1
>> odbc-driver-connect:
>>   SQLSTATE:
>>   context...:
>>.../generic/interfaces.rkt:170:0: raise-sql-error
>>.../odbc/connection.rkt:781:0: handle-status*
>>call-with-values
>>call-in-empty-metacontinuation-frame
>>body of "/Users/jinho/git/eoddata/test-odbc.rkt"
>>temp35_0
>>run-module-instance!
>>perform-require!
>>namespace-require+
>>proc
>>call-in-empty-metacontinuation-frame
>>thunk_10
>>call-in-empty-metacontinuation-frame
>>call-with-empty-metacontinuation-frame-for-swap
>> 
>> I also confirmed using odbc-driver-connect directly that no connection is 
>> actually made. Do you have any other suggestions? Thanks again!
>> 
>> 
>> --
>> "Ad astra per alia porci"
>> 
>>> On Sep 19, 2020, at 8:12 AM, Ryan Culpepper  wrote:
>>> 
>>> The last time I tested connecting to MS SQL Server on Windows (several 
>>> years ago), I think I was able to connect using some drivers but not 
>>> others. I was simultaneously trying to figure out authentication and the 
>>> connection string format, so once I got a working configuration I stopped 
>>> investigating. Lately I've been testing using the Docker image on Linux.
>>> 
>>> I've attached a program you can run to find out where the connection 
>>> process hangs. If you can report the results of running the program that 
>>> should help narrow down the problem.
>>> 
>>> Ryan
>>> 
>>> 
 On Sat, Sep 19, 2020 at 12:25 AM Jin-Ho King  wrote:
 Does anyone have experience using Racket to query a MS SQL Server? I'm 
 attempting to use the db-lib package (https://docs.racket-lang.org/db/) 
 and odbc-driver-connect, but running the method just hangs, with no 
 feedback. By contrast, using the same connection string, I can 
 successfully connect using python and pyodbc. 
 
 Any suggestions or tips would be appreciated!
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 "Racket Users" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 To view this discussion on the web 

Re: [racket-users] querying MS SQL Server with db-lib (ODBC)

2020-09-19 Thread Ryan Culpepper
So, it seems that there are two problems: (1) the connection fails (even
though it works with pyodbc) and (2) retrieving the diagnostic information
after the error hangs with the MS driver. I don't see an obvious reason for
either problem, but I have two thoughts.

Does your connection string have any non-ASCII characters? A difference in
string conversion is one of the few things I can imagine distinguishing
odbc-driver-connect's behavior from pyodbc, since IIUC both just pass the
connection string to SQLDriverConnect without any processing. Also,
double-check backslashes.

It looks like you're using Racket CS. Could you try the program with Racket
BC too? It's possible that there's some difference in the FFI's behavior
between the two versions that the db library is not accounting for.

Ryan


On Sat, Sep 19, 2020 at 10:06 PM Jin-Ho King  wrote:

> Hi Ryan, thanks so much for your suggestions. Here is the output from
> running your program with my original connection string, which works in
> python using pyodbc:
>
> Allocating env handle... done: 0
> 0
> Setting ODBC version... done: 0
> 0
> Allocating db handle... done: 0
> 0
> Connecting... done: -1
>
>
> This is where it hangs.
>
> Based on your suggestions about trying different drivers, I tried
> switching drivers from the "ODBC Driver 17 for SQL Server” that I had been
> using to the FreeTDS driver the example in your program uses. I was able to
> successfully connect using the FreeTDS driver in python using pyodbc. Using
> the same connection string, I ran your program again. This time, running
> your program didn't hang, but the output was not promising either:
>
> Allocating env handle... done: 0
> 0
> Setting ODBC version... done: 0
> 0
> Allocating db handle... done: 0
> 0
> Connecting... done: -1
> odbc-driver-connect:
>   SQLSTATE:
>   context...:
>.../generic/interfaces.rkt:170:0: raise-sql-error
>.../odbc/connection.rkt:781:0: handle-status*
>call-with-values
>call-in-empty-metacontinuation-frame
>body of "/Users/jinho/git/eoddata/test-odbc.rkt"
>temp35_0
>run-module-instance!
>perform-require!
>namespace-require+
>proc
>call-in-empty-metacontinuation-frame
>thunk_10
>call-in-empty-metacontinuation-frame
>call-with-empty-metacontinuation-frame-for-swap
>
>
> I also confirmed using odbc-driver-connect directly that no connection is
> actually made. Do you have any other suggestions? Thanks again!
>
>
> --
> "Ad astra per alia porci"
>
> On Sep 19, 2020, at 8:12 AM, Ryan Culpepper 
> wrote:
>
> The last time I tested connecting to MS SQL Server on Windows (several
> years ago), I think I was able to connect using some drivers but not
> others. I was simultaneously trying to figure out authentication and the
> connection string format, so once I got a working configuration I stopped
> investigating. Lately I've been testing using the Docker image on Linux.
>
> I've attached a program you can run to find out where the connection
> process hangs. If you can report the results of running the program that
> should help narrow down the problem.
>
> Ryan
>
>
> On Sat, Sep 19, 2020 at 12:25 AM Jin-Ho King  wrote:
>
>> Does anyone have experience using Racket to query a MS SQL Server? I'm
>> attempting to use the db-lib package (https://docs.racket-lang.org/db/)
>> and odbc-driver-connect, but running the method just hangs, with no
>> feedback. By contrast, using the same connection string, I can successfully
>> connect using python and pyodbc.
>>
>> Any suggestions or tips would be appreciated!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/58e03456-b76e-4212-a170-82e1fc4fb178n%40googlegroups.com
>> 
>> .
>>
> 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33qkuK%2B%2Beg8_vZT0bE5NfvzXxB52uGzOcOWumA7DK4Zfu-Q%40mail.gmail.com.


Re: [racket-users] querying MS SQL Server with db-lib (ODBC)

2020-09-19 Thread Jin-Ho King
Hi Ryan, thanks so much for your suggestions. Here is the output from running 
your program with my original connection string, which works in python using 
pyodbc:

Allocating env handle... done: 0
0
Setting ODBC version... done: 0
0
Allocating db handle... done: 0
0
Connecting... done: -1

This is where it hangs.

Based on your suggestions about trying different drivers, I tried switching 
drivers from the "ODBC Driver 17 for SQL Server” that I had been using to the 
FreeTDS driver the example in your program uses. I was able to successfully 
connect using the FreeTDS driver in python using pyodbc. Using the same 
connection string, I ran your program again. This time, running your program 
didn't hang, but the output was not promising either:

Allocating env handle... done: 0
0
Setting ODBC version... done: 0
0
Allocating db handle... done: 0
0
Connecting... done: -1
odbc-driver-connect:
  SQLSTATE:
  context...:
   .../generic/interfaces.rkt:170:0: raise-sql-error
   .../odbc/connection.rkt:781:0: handle-status*
   call-with-values
   call-in-empty-metacontinuation-frame
   body of "/Users/jinho/git/eoddata/test-odbc.rkt"
   temp35_0
   run-module-instance!
   perform-require!
   namespace-require+
   proc
   call-in-empty-metacontinuation-frame
   thunk_10
   call-in-empty-metacontinuation-frame
   call-with-empty-metacontinuation-frame-for-swap

I also confirmed using odbc-driver-connect directly that no connection is 
actually made. Do you have any other suggestions? Thanks again!


--
"Ad astra per alia porci"

> On Sep 19, 2020, at 8:12 AM, Ryan Culpepper  wrote:
> 
> The last time I tested connecting to MS SQL Server on Windows (several years 
> ago), I think I was able to connect using some drivers but not others. I was 
> simultaneously trying to figure out authentication and the connection string 
> format, so once I got a working configuration I stopped investigating. Lately 
> I've been testing using the Docker image on Linux.
> 
> I've attached a program you can run to find out where the connection process 
> hangs. If you can report the results of running the program that should help 
> narrow down the problem.
> 
> Ryan
> 
> 
> On Sat, Sep 19, 2020 at 12:25 AM Jin-Ho King  > wrote:
> Does anyone have experience using Racket to query a MS SQL Server? I'm 
> attempting to use the db-lib package (https://docs.racket-lang.org/db/ 
> ) and odbc-driver-connect, but running the 
> method just hangs, with no feedback. By contrast, using the same connection 
> string, I can successfully connect using python and pyodbc. 
> 
> Any suggestions or tips would be appreciated!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/58e03456-b76e-4212-a170-82e1fc4fb178n%40googlegroups.com
>  
> .
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/17E4ACF8-8920-4FD2-A10E-09DF8EEB2624%40gmail.com.


Re: [racket-users] querying MS SQL Server with db-lib (ODBC)

2020-09-19 Thread Ryan Culpepper
The last time I tested connecting to MS SQL Server on Windows (several
years ago), I think I was able to connect using some drivers but not
others. I was simultaneously trying to figure out authentication and the
connection string format, so once I got a working configuration I stopped
investigating. Lately I've been testing using the Docker image on Linux.

I've attached a program you can run to find out where the connection
process hangs. If you can report the results of running the program that
should help narrow down the problem.

Ryan


On Sat, Sep 19, 2020 at 12:25 AM Jin-Ho King  wrote:

> Does anyone have experience using Racket to query a MS SQL Server? I'm
> attempting to use the db-lib package (https://docs.racket-lang.org/db/)
> and odbc-driver-connect, but running the method just hangs, with no
> feedback. By contrast, using the same connection string, I can successfully
> connect using python and pyodbc.
>
> Any suggestions or tips would be appreciated!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/58e03456-b76e-4212-a170-82e1fc4fb178n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33qmKHvD7NrR7N5NZXCsGxy2beuPTw%2BPqDHsvmJo5t%3DLqgA%40mail.gmail.com.


test-odbc.rkt
Description: Binary data


[racket-users] querying MS SQL Server with db-lib (ODBC)

2020-09-18 Thread Jin-Ho King
Does anyone have experience using Racket to query a MS SQL Server? I'm 
attempting to use the db-lib package (https://docs.racket-lang.org/db/) and 
odbc-driver-connect, but running the method just hangs, with no feedback. 
By contrast, using the same connection string, I can successfully connect 
using python and pyodbc. 

Any suggestions or tips would be appreciated!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/58e03456-b76e-4212-a170-82e1fc4fb178n%40googlegroups.com.