One: ASP connection MS-SQLSERVER2000 database ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------- <% sessionTIMEOUT = 50000 'Set session expiration time if Trim (Request.Cookies ("MyName")) <> "" "" "") = Trim ("MyName")) End ifset conn = server.createObject ("adoDb.connection") conn.open "driver = {SQL Server}; server = xiegang; uid = sa; pwd = SQL; Database = Guestbook; "SET RS = Server.createObject (" AdoDb.Recordset ")%>
2: ASP connection access database -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------- <% DIM conndim connStrdim dbdb = "Database / YiuWekdsodksldfslwifds.mdb" 'Database file location set conn = server.createObject ("adoDb.connection" connStr = " Provider = microsoft.jet.Oledb.4.0; data source = "& Server.mappath (db) Conn.open Connstr
Sub CloseConn () Conn.close Set Conn = Nothingend Sub%>
Platform for the trial: Mysql 4.0 for radhat Linux (or use for windows) Windows 2003 Standard Edition Windows XP ENGLISH 1, install myodbc ======================= ================================== 1. Visit the website www.mysql.com and download myodbc, we use version 3.51. http://dev.mysql.com/downloads/connector/odbc/3.51.html 2. Install myodbc to Windows running MYODBC-3.51.06.exe (file name varies from version)
Second, establish an ODBC connection =============================================== ============ Enter: Control Panel - "ODBC Data Source This time, we can see that there is already one item in the user's DSN: myodbc3-test, pay attention to Driver {mysql ODBC 3.51 on the right Driver} This parameter will be a connection word that is unable to connect as an ASP and database connection. 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 that root users can only log in in this machine due to security issues, of course, users can remove this feature 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!