Use. udl to quickly test the connection to the database and obtain the connection string

Source: Internet
Author: User

People who are new to program development are often confused about how to connect to the database and How to Write connection strings. Service personnel who install products often have a headache about how to quickly test the connection between the local machine and the database. Here, a simple and quick implementation method is provided: *. udl file. (The method is very old, but very practical !)

Step 1: create a data link file.

Right-click and choose "New" to create any types of files, such as text files, and change the name extension to udl, such as DB. udl.

 

Step 2: connect to the database and test the connection.

Double-click to open the database. in the udl file, the interface shown in appears. Select the database driver and press "Next" To Go To The connection interface. The connection interface varies depending on the driver selected, after entering the relevant information correctly, click "test connection" to test the correctness of the database connection attribute.

 

Step 3: Obtain the database connection string

In the program, you can connect to the database through the udl file. Of course, it is better to directly connect to the database through the connection string. Open the DB. udl file using notepad and other text tools to obtain the connection string that has just been tested successfully. For example:

[Oledb]

; Everything after this line is an ole db initstring

Provider = msdasql.1; persist Security info = false; user id = APA; Data Source = Apa

With this method, you can quickly and conveniently test the connection with the database and obtain the connection string.

 

 

From: http://www.cnblogs.com/gaoweipeng/archive/2009/05/27/1491124.html

Http://www.seoa.cn/html/55.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.