faqts : Computers : Databases : Microsoft SQL Server

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

18 of 24 people (75%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

Database: ODBC: Microsoft Windows: How create new ODBC Connection to Microsoft Sql Server Northwind?

Dec 27th, 2004 16:23
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 27 December 2004 - 11:23 pm -------------------
Database: ODBC: Microsoft Windows: How create new ODBC Connection to 
Microsoft Sql Server Northwind?
To create a ODBC connection to your specific Microsoft SQL server
database, you can inform which driver to use and give this connection a
name for later use in your programs
---
Usually your database is thus uniquely identified by a Data Source Name
(DSN) which is an "alias" that points to the file or server that the
database is held in.
---
Follow the following steps:
(you can e.g. repeat this steps for each database you want to connect
 using ODBC, by making a new entry via the System DNS tab)
---
Steps: Overview:
 1. -Start your ODBC program
     1. -Click button Windows 'Start'
     2. -Select from list 'Control Panel'
     3. -Double click on icon 'Administrative Tools'
     4. -Double click on icon 'Data Sources (ODBC)'
 2. -Register your database
     1. -Select tab 'System DSN'
     2. -Click button 'Add'
     3. -Select your driver
         1. -Select from list 'Sql Server'
         2. -Click button 'Finish'
     4. -Fill in the data
         1. Choose the real database name of for your database
             e.g. if the filename of your database is
                  northwind.mdb, then choose
                  the name without the extension, e.g.
                   Northwind
         2. Fill in possibly a description
             e.g. test
         3. Fill in which SQL server you want to
            connect to
            (you might have to start your Microsoft SQL server first so
             that it can be found when you click on the list, and or
             install it on your local machine, if not already done)
              e.g. <yoursqlservername>
             e.g. TEST
            (e.g. the name of the Microsoft SQL server
             installed on your computer, to see which name,
             hold e.g. your cursor above the Microsoft SQL server
             name on the taskbar)
                  or you can skip the name if you are working
                  locally, by using
                   (local)
         4. -In the screen 'How should SQL Server verify the 
authenticity of the login ID?'
             1. -Enable radio button 'With SQL Server authentication
                 using a login ID and password entered by the user'
             2. -Enable checkbox 'Connect to SQL Server to obtain 
default
                 settings for the additional configuration options'
                 1. Enter a 'Login ID'
                     e.g.
                      sa
                 2. Enter a password
                     e.g. no password, thus leave this blank
          5. -Click button 'Next'
          6. -Enable checkbox 'Change the default database to'
              1. -Select from list 'Northwind'
         5. -Click button 'Next'
         6. -Click button 'Finish'
             You should now see information similar to
             the following:
--- cut here: begin --------------------------------------------------
Microsoft SQL Server ODBC Driver Version 03.81.9042
Data Source Name: northwind
Data Source Description: test
Server: (local)
Database: (Default)
Language: (Default)
Translate Character Data: Yes
Log Long Running Queries: No
Log Driver Statistics: No
Use Integrated Security: Yes
Use Regional Settings: No
Prepared Statements Option: Drop temporary procedures on disconnect
Use Failover Server: No
Use ANSI Quoted Identifiers: Yes
Use ANSI Null, Paddings and Warnings: Yes
Data Encryption: No
--- cut here: end ----------------------------------------------------
         7. -Possibly test, by clicking
             button 'Test Data Source'
             If should show information similar
             to the following:
--- cut here: begin --------------------------------------------------
Microsoft SQL Server ODBC Driver Version 03.81.9042
Running connectivity tests...
Attempting connection
Connection established
Verifying option settings
Disconnecting from server
TESTS COMPLETED SUCCESSFULLY!
--- cut here: end ----------------------------------------------------
 3. -You should now see that in the tab 'System DNS'
     your database name (e.g. 'northwind') has been added
 4. -Click button 'OK'
 5. -Your database has now been registered, and so can
     your database be accessed programmatically
     (e.g. via Perl, PHP, ...) using this
     System DNS name (e.g. 'northwind')
     1. E.g. in your Perl program (after installing
        DBD-ODBC) you can then use:
my $databaseconnection = DBI->connect( "
                <your interface name>:
                <your database driver name>:
                <your odbc name> ...
       Or so in this case:
my $databaseconnection = DBI->connect( "DBI:ODBC:northwind ...
---
---
Tested successfully on Microsoft Windows XP Professional,
using Microsoft SQL server.
---
---
Internet: see also:
---
Registering an ODBC data source
[Internet:http://www.deitel.com/books/ebecFM1/ebecFM1_appK.pdf]
---
Perl: Database: DBI: How to install DBD-ODBC using ActiveState PPM?
http://www.faqts.com/knowledge_base/view.phtml/aid/33010/fid/654
----------------------------------------------------------------------