Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Another question on -odbc load-


From   Jen Zhen <jenzhen99@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Another question on -odbc load-
Date   Sat, 17 Nov 2012 18:28:25 +0100

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index