[REBOL] Re: Command and ODBC connection question
From: swhite:ci:bloomington:mn:us at: 30-Oct-2009 12:22
I don't know if this original message made it through, but in case it did, I will report
that I managed to find the solution.
It seems that the ODBC connection I was using used Windows authentication, and the web
server (apache) must have been passing some other authentication to REBOL which was passing
it to the SQL Server, or something like that. I don't really know how any of this stuff
Anyway, the solution was to make a new user ID in SQL Server and set it up so that it
does NOT accept Windows authentication, but instead requires a user ID and password.
Then I made new ODBC data source that does not accept Windows authentication, but instead
uses a user ID and password, and made it the same user ID and password that matches those
I set up in SQL Server. Then I supplied that new ODBC data source along with its userID
and password in the REBOL line that defines the command port to the database.
Now that I have connected to the database, I am struggling along with trying to get something
out of the database, but that's another story.
>>> "Steven White" <swhite-ci.bloomington.mn.us> 10/29/2009 10:58 AM >>>
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:
print "content-type: text/html"
COG-CON: open odbc://cogsdale
COG-CMD: first COG-CON
print ["Database is open"]
print ["Database is closed"]
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)
<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...
<A HREF="http://10.66.250.149/cgi-bin/odbctest.r">Run ( 'http://10.66.250.149/cgi-bin/odbctest.r"
) the program</A>
...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
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.
City of Bloomington
1800 W Old Shakopee Rd
Bloomington MN 55431-3096