ODBC (Open Database Connectivity)
It can be seen from the literal meaning that ODBC is equivalent to an intermediate protocol, which can connect to various databases, and even include Excel and text. It provides a unified method of use for the program. If the program uses ODBC to operate the actual database, the program can almost always be renewed regardless of whether the background database is DB2 or SQL Server or has been upgraded.
The following describes how to establish an ODBC data source connection.
First, find the ODBC data source drive. If your system is WINXP or win7 32-bit, control panel-management tools-Data Source (If your system is win7 64-bit, C: \ windows \ syswow64, find odbcad32.exe, open is, many friends may have encountered this situation, in win7 64-bit control panel or system32 odbc32, can only add SQL Server ), after opening the interface (such ):
You can select the type (User DSN, system DSN, and file DSN) of The DSN to be added. The Add button on the right of a single machine will pop up the select database driver Type dialog box (for example ):
Select the database type you want to add (Here we use Microsoft Access driver as an example:
Enter the data source name and description, and click "select" to select the path of your database file. If you need to set a password, click "advanced" to set the password. After everything is ready, click OK. The ODBC data source is successfully configured. No matter which program you can access your database, it will be easy and unobstructed!
To add an SQL Server database as an example (create a file DSN), select "SQL Server" in the "Create a new data source" dialog box, And next:
Enter the data source name. Note that this data source name is the name of the DSN File in the string to connect to the database in the Code: connectstring = "filedsn = student. DSN; uid = sa; Pwd = password ", click" Next ":
Click "finish ":
Enter the description of the data source and select the local server. If there is no local server, you can find control panel-Administrative Tools-service, and enable SQL-related services on the "extension" tab. Click "Next ":
Select or enter SQL verification. Next step:
Change the default database in SQL Server, and click "Next ":
Click "finish ":
Click Test Data Source (T). The test is successful!