Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: odbc


From   "Patrick Mcelduff" <[email protected]>
To   [email protected]
Subject   Re: st: odbc
Date   Sat, 26 Jun 2004 11:28:56 +0100

Dear all

Thanks very much Joseph 

You diagnoses was correct and I found your instructions easy to 
follow.

Patrick

> Patrick Mcelduff wrote:
> 
> >I am trying to use the odbc command to read data from an Access
> >database - without any luck at all. I am stuck at the first hurdle.
> >The database is called pat and the table is called cared. I thought
> >the following command should work - but it doesn't. The problem is
> >with dsn. 
> >
> >odbc load, dsn("pat") table("cared")
> >
> >Initially I had a directory path in the command but removed it and
> >moved the file to the current directory.
> >
> >When I type,
> >
> >odbc query pat
> >
> >I get a message indicating that the data source name is not found.
> >
> >What am I doing wrong
> 
> It looks like you haven't set up your data source name (DSN) yet. 
> What goes in the -dsn- option of Stata's -odbc- suite of commands is
> the DSN and not the name of the database or its directory path.  The
> DSN provides the link to the database.
> 
> Setting up the DSN is done via the operating system.  In Windows, you
> would set up the DSN via the "Data Sources (ODBC)" application found
> in the Control Panel.  From the "Data Sources" application, you can go
> to the tab labeled "User DSN" and click "Add."  Choose "Microsoft
> Access Driver (.mdb)" from the scroll-down menu, and click "Finish." 
> It will open a new subpanel titled "Microsoft Access Setup."  Type the
> name you choose for your DSN in the first box of this subpanel,
> labeled "Data Source Name."  What you type in this box is what you
> will type in the -dsn()- option in the Stata command.  (Any arbitrary
> name will do--choose something short, descriptive and unique.  I
> usually use the name of the database without the .mdb suffix.)  The
> second box ("Description") may be left empty.  The  "Database" section
> of the subpanel has four buttons; select "Select..." and wend your way
> to the directory where your database (pat.mdb) resides and select it. 
> Click "Ok" for this "Select..." subsubpanel and then "Ok" again for
> the subpanel and then "Ok" yet again for the main panel ("ODBC Data
> Source Administrator").  You're done, and now can use the newly
> created DSN in Stata's -odbc- commands.  Note that it gets slightly
> more complicated if you placed user-access restrictions (priveleges,
> users, user groups, etc.) on your database; in that case you will have
> to identify the system database that contains those settings from the
> "Microsoft Access Setup" subpanel.
> 
> Joseph Coveney
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index