[REBOL] Command and ODBC connection question
From: swhite:ci:bloomington:mn:us at: 29-Oct-2009 10:58
I assume this problem is related to a userID and password that I must put somewhere,
but I am not sure where to look and I wonder if anyone can point me.
I want to write a CGI program for REBOL/Command which I have purchased, to look up a
record in a table in a database maintained by Microsoft SQL Server, through ODBC (which
I assume is the only way). I have isolated the problem with the following script:
--------------
#!c:/rebol-cmd/bin/rebcmd.exe -cs
REBOL [
]
print "content-type: text/html"
print ""
print ""
print [<HTML><BODY><PRE>]
COG-CON: open odbc://cogsdale
COG-CMD: first COG-CON
print ["Database is open"]
close COG-CMD
print ["Database is closed"]
print [</PRE></BODY></HTML>]
----------------
When I run this script at a REBOL/Command prompt, that is, not through a browser, it
works just fine, as shown by the following result:
----------------------
>> do %odbctest.r
Script: "Untitled" (none)
content-type: text/html
<HTML> <BODY> <PRE>
Database is open
Database is closed
</PRE> </BODY> </HTML>
>>
---------------------
But when I run it as a CGI program, through a little test harness that looks like this...
-----------------------
<HTML>
<HEAD>
<TITLE>Program runner</TITLE>
</HEAD>
<BODY>
<A HREF="http://10.66.250.149/cgi-bin/odbctest.r">Run ( 'http://10.66.250.149/cgi-bin/odbctest.r"
) the program</A>
</BODY>
</HTML>
----------------------
...I get the following result:
-----------------------
** Script Error: ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
for user 'COB-DOMAIN\IS-SWHITE$'.
** Near: COG-CON: open odbc://cogsdale
COG-CMD: first
------------------------
The script I run is not the actual same script in both cases because it must exist in
the cgi-bin directory and the REBOL command directory, but it IS the same, as in an exact
copy. I copied it before I ran it, and I went back and verified that they were the same
after I had run them. I am very aware, from sad experience, that this kind of situation
is a source of errors.
I know that I can put a user ID and password on this line:
COG-CON: open odbc://cogsdale
to make it like this:
COG-CON: open odbc://userid:password-cogsdale
and I tried it with the password that I believe is my Windows password. The ODBC connection
is set up to use Windows authentication. I also tried to change the ODBC connection
to NOT use Windows authentication, and the userID and password I entered in the required
boxes was rejected. (Maybe that is the key.)
So I am scratching my head a bit here and wondering if anyone can offer guidance.
Thank you.
Steven White
City of Bloomington
1800 W Old Shakopee Rd
Bloomington MN 55431-3096
USA
952-563-4882 (voice)
952-563-4672 (fax)
steven.white-ci.bloomington.mn.us