Microsoft Access 2010 Bible

(Rick Simeone) #1

Part VI: Access as an Enterprise Platform


1202


The easiest way to connect to a SQL Server database may be to use a command-line shell utility
called SQLCMD that comes with both SQL Server and SQL Server Express (look in the C:\
Program Files\Microsoft SQL Server\90\Tools\Binn folder). SQLCMD provides a
simple, command-driven interface to SQL Server. Although not practical for managing complex
databases, SQLCMD provides a simple way to verify a SQL Server installation.

The options for SQLCMD are shown in Figure 37.1.

FIGURE 37.1

The SQLCMD utility has numerous options.


Figure 37.1 shows the two most significant options, which are –S server (the computer on
which SQL Server is running), and -d use database name (the name of a database within the
SQL Server installation).

Note
The name of the server in Figure 37.1 (-S server) is a SQL Server instance name, not the name of a computer.
When installing SQL Server, the default name applied to the SQL Server instance is the name of the host com-
puter. Also, by default, SQL Server security is set to use the user’s Windows login name and password as authenti-
cation. In other words, SQL Server uses Windows security and the name of the machine on the network.


When using the SQLCMD utility, the easiest way to communicate with a SQL Server database is
with the following command to get to a specific SQL Server installation:

sqlcmd –S mycomputer

Use the following more refined command to connect to a specific database, within a specific SQL
Server installation:

sqlcmd –S mycomputer –d mydatabase
Free download pdf