The DSN is setup in the control panel, on windows 2000 it is also under administrative tools->Data Sources (ODBC). This is where you would define the server and default database etc. When you create a new DSN you give it a simple name which is what should be used in the DSN field. Have you created a DSN? If you have you should see it's name in the list, or perhaps you remember the name you gave it.
Lacking a DSN you can also use a "connection string" I always forget how to properly format these but if you do a quick web search on Google for "connection string" and ODBC I'm sure you'll get some hits that explain it, and give examples. HTH, -Wayne > -----Original Message----- > From: Craig Cardimon [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 23, 2005 1:43 PM > To: ActivePerl > Subject: Win32::ODBC -- is the DSN a server or DB or table? > > When using Win32::ODBC, what exactly is the DSN or "Data Source Name?" > > I got this from the web: > > *** > > Creating the ODBC data source: > > An ODBC data source name(DSN) contains the connection information to > access a database. > > It can be created and configured via the ODBC Data Source Administrator: > > * On machines running Microsoft Windows 2000 or Windows XP, create the > ODBC data source by clicking: > > Start->Settings->Control Panel->Administrative Tools->Data > Sources->System DSN > > Select the IBM ODBC Driver and choose a catalogued database (such as > "SAMPLEDB")to be associated with the DSN. > > *** > > That's all well and good, but won't work for me. What seems to work is > when I use a database table name as the DSN. For instance, this is the > logic that functions: > > my $database_handle_text = > new Win32::ODBC("DSN=Contracts;UID=perl;PWD=saturn") or > die Win32::ODBC::Error(); > > my $statement_text = "INSERT INTO Contracts (ContractTerms, > Licensee, Licensor, Status, AgreementType, SIC, Source, > ParentRefnum) VALUES (" . $submission_string_document . ")"; > > As you can see, I use the table Contracts as the DSN. The table > Contracts is in the database Bob, but if I use Bob as the DSN, the logic > fails. This is the code that fails: > > my $database_handle_text = > new Win32::ODBC("DSN=Bob;UID=perl;PWD=saturn") or > die Win32::ODBC::Error(); > > my $statement_text = "INSERT INTO Contracts (ContractTerms, > Licensee, Licensor, Status, AgreementType, SIC, Source, > ParentRefnum) VALUES (" . $submission_string_document . ")"; > > As I'm connecting to one SQL Server database on one server, shouldn't I > be able to use the same connection string to access all the databases on > that server for which I have permission? > > -- Craig > _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
