Using SQL Server and MSDE in ASP

Source: Internet
Author: User
Tags ini log microsoft sql server connect ole create database
Server author February Microsoft Community Star Microsoft Community Star

Microsoft SQL Server is a kind of database server software commonly used in Windows environment, and it is also one of the database used frequently in ASP application. This article focuses on some of the techniques used by SQL Server in conjunction with ASP.

Access and installation of SQL Server

For a commercial application, it is recommended that you purchase a standard or Enterprise version of SQL Server with a price of more than 20,000 (more expensive than Windows) and, if you are learning to use it, or if you have limited financial resources, you can use the desktop version of--MSDE. It is currently available in the. NET Framework SDK, asp.net Web Matrix, Office XP Professional, Developer, Project Server 2002, development tools, and Server-class software. In addition, the SQL Server SP3 provided in the Microsoft site also contains MSDE, or SP3 version. Because it is a simplified version, MSDE does not provide graphical management tools.
Because SQL Server is a wizard installation, this is no longer the place to repeat. One thing to note is that the SQL and Windows integrated Hybrid authentication method should be selected for installation. For a database server that is already installed, you can modify it in the Security page of its Properties window.
MSDE SP3 can be downloaded at http://www.microsoft.com/china/sql/downloads/sp3.asp. Select the language on the right side of the page and click the "Go" button to enter the download page. The Chinese simplified file name is Chs_sql2kdesksp3.exe, the size is 73735 KB. Run this file to extract the installer to a folder. Because we need MSDE to work in the SQL authentication mode, and the SP3 version requires that the SA password not be blank, the Setup.ini file needs to be modified, and the following two lines are added in the Option section:
Securitymode=sql
sapwd= Admin Password
Then execute setup/i setup\sqlrun01.msi/settings Setup.ini under DOS. When installed, the startup group of the Start menu adds a service Manager icon. This installation is complete. You can start the database server by restarting the computer or by running Service Manager.

Ii. use of databases in ASP

When you connect to SQL Server in ASP, there are often 80004005 errors. This is because the database server is set to Windows Integrated authentication mode, and the account used by the ASP defaults is blocked from accessing the database. The solution is to set the database server to a mixed authentication mode, allowing it to log in to the database by user name and password.
Writing an OLE DB string is another problem that bothers many people. In fact, the method is very simple. For example, to connect to SQL Server:
1. Create a file with a name extension of UDL and open
2. Select Microsoft OLE DB Provider for SQL Server on the provider page, and then go back to the Connections page, enter the address of the database server, and select "Use specified user name and password", enter the username and password for the connection database, and then in the Select the database on the Server Drop-down box to select or enter the name of the database you want to use. Finally, you can click the "Test Connection" button to test whether the parameters are correct. Note You cannot select "Use WindowsNT Integrated security settings", or you cannot use it in an ASP even if the test succeeds.
3, the final use of 2000/xp Notepad or Word and other programs to open this file, the 3rd line is the OLE DB connection string.

Third, import the database

A common forum that uses SQL Server provides an SQL file to build the database structure. The following methods are used to invoke SQL files in SQL Server and MSDE, respectively:

SQL Server Environment:
Run Enterprise Manager, right-click the database node under the server, select New database, and then enter the name of the database in the Database Properties window that appears.
Run SQL Query Analyzer, select the database you just created on the toolbar, and then transfer the SQL file that came with the forum and execute it. The database is set up.
MSDE Environment:
Because MSDE does not provide graphical management tools, you need to use command-line tools OSQL.EXE to do this.
If you log on to Windows with an administrator user, you can run the following statement to establish a database named IBB:
OSQL-E-Q "CREATE Database Ibb"
Where-e means that the WindowsNT Integrated authentication method is used, and you need to enter a password to log in to Windows after running. If you use another user to log in, you need to use the following format:
Osql-u sa-q "CREATE Database Ibb"
After running, you need to enter the password for the SA user.
After the database is established, you need to run the SQL file to establish the library structure. Input:
Osql-e-I. Xxxx.sql
The database structure can be established.



Related Article

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.