How to connect Mysql Database Mingshui Xuanxuan in ASP CCTV.NET 2004-3-7, 2004-4-2 Correction
Take a while, finally complete the ASP and MySQL connections, feel, close-by this article to share with you.
There are two ways to find a lot of information, and there are currently two ways to connect: one is the use of components, more name is Mysqlx, but unfortunately $ 99. Second, use myodbc to connect, let's take a look at the second way.
Test platform:
Mysql 4.0 for radhat Linux (you can also use for Windows)
Windows 2003 Standard Edition Windows XP ENGLISH
First, install myodbc
1. Visit the website www.mysql.com and download myodbc, we use version 3.51.
2. Install myodbc to Windows running the downloaded myodbc-3.51.06.exe (file name varies from version varies), establish an ODBC connection entry: Control Panel - "ODBC Data Source, we can see it in user DSN There is already an item: myodbc3-test, pay attention to the right Driver {mysql ODBC 3.51 Driver} This parameter will be a connection word that is unable to connect as an ASP and database connections (CONECTION STRING). Add a "System DSN" selection dialog box, press the "Add" button on the right. At this time, you will let you choose a data source. Select MySQL ODBC 3.51 Driver. Press "End". At this time, a configuration dialog box will pop up: Data Source Name Data Source Name: The identifier of the DSN used in the program can be named casually. Host / Server Name (or IP) Host / Server Name (or IP address), if you fill in the localhost database name database name: You want to use the library name used in the program. User User: Log in to MySQL Username, especially note, root users can log in to this machine due to security issues, of course, users can remove this function by modifying the user table. Password key: Login password port port: Using the default value, it is best not to change unless you are grasp. After all set it, press the "Test Data Source" will see the screen display successfully. The configuration is all set! ^ _ ^ II, the connection of the ASP and database is the source code I have tested, connected to MySQL, the library name is mm, the table name is MY, and there are two fields Name and SEX.