Connecting to the Database
As mentioned in Prerequisites, a new empty database called "ZooDB" must first be created in SQL Server. Once the database has been created, you can connect to it from DatabaseSpy, as shown below. The Connection Wizard allows you to establish a connection to existing databases of the most commonly used database types, such as Microsoft Access, Microsoft SQL Server, Oracle, MySQL, IBM DB2, Sybase, and PostgreSQL.
To connect to the tutorial database:
1.Do one of the following:
•Click the Connect to a database toolbar button.
•On the File menu, click Create a Database Connection.
2.Select Microsoft SQL Server (ADO), and then click Next. The list of available ADO drivers is displayed. In this example, the SQL Server Native Client 11.0 is used as provider. You can also select the Microsoft OLE DB Provider for SQL Server provider.
3.Click Next. The Data Link Properties dialog box appears.
4.Select or enter the name of the database server, for example, SQLSERV01. If you are connecting to a named SQL Server instance, the server name looks like SQLSERV01\SOMEINSTANCE. To view the list of all servers on the network, expand the drop-down list.
5.If the database server was configured to allow connections from users authenticated on the Windows domain, select Use Windows NT integrated security. Otherwise, select Use a specific user name and password, clear the Blank password check box, and enter the credentials in the relevant boxes.
6.Select the database to which you are connecting (in this example, ZooDB).
7.To test the connection at this time, click Test Connection. This is an optional, recommended step.
Even if the connection test is successful at this time, you must still persist the security info, see the next step.
8.Click the All tab, and change the Persist Security Info property to True.
10.In the Set A Data Source Name dialog box, enter a connection name and click OK. In this example, the connection name is "ZooDBConnect".
The Project window now contains a connection called "ZooDBConnect" in the Data Sources folder.