Dear Statalisters,
I am trying to load data from SQL into Stata with a commands of the
following form:
local db "DRIVER={MySQL ODBC 5.1
Driver};SERVER=myserver;DATABASE=mydatabase;UID=jenzhen;PWD=jenzhenspassword;"
local SQL_statement "SELECT DISTINCT var1, var2, var3, FROM table1
WHERE var1=5 AND year(date)=´2000´;"
odbc load, exec("`SQL_statement'") conn("`db'")
This worked perfectly well when I ran this on the Stata IC 11.2 on my
Windows 7 64-bit laptop.
However, when I run the same commands on a Stata IC 11 on a cluster, I
get the error
"dsn() required
r(198);"
This is strange because I believe all information on the
datasourcename dsn should already be included in the local "db" I
entered into the conn option
and because I did not get that very same error when running the
command on another computer.
Is this because in some versions of Stata or the system I need to
specify the options differently
(I could specify -dsn(mydatabase)- but Stata won't take the dsn and
conn options at the same time, so I would need to leave out the conn
option, but then I how do I tell it all the other information on the
driver, server, username and password?),
or is it that maybe some necessary module/adofile is not installed on
the cluster?
Thanks so much and a good weekend,
JZ
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/