In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you the method of asp calling mysql database, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Asp calls the mysql database: first install the driver for mysql odbd, copy the downloaded [myodbd-2.50.46-dll] file to the [windows\ system] directory, and then establish the asp file to link to the database.
The method of calling mysql database by asp:
Step 1: install the driver for mysql odbd and copy the downloaded myodbd-2.50.46-dll file to the windows\ system directory (windows2000 is winnt/system32)
Then create a new file with the extension reg (that is, the registry file) and copy the following to the file.
Regedit4 [hkey _ local_machine\ software\ odbc\ odbcinst.ini\ myodbc driver] "usagecount" = dword:00000002 "driver" = "c:\ windows\\ system\\ myodbc.dll"setup" = "c:\ windows\\ system\ myodbc.dll"sqllevel" = "1"fileusage" = "0"driverodbcver" = "02.50"connectfunctions" = "yyy"apilevel" = "1"cptimeout" = "120" [hkey_local_machine\ software\ odbc\ odbcinst. Ini\ odbc drivers] "myodbc driver" = "installed"
Double-click the file after saving to register the above code in the windows registry.
If installed in windows2000, the values of the driver and setup primary keys should be changed accordingly, so I don't need to say much about it here.
If successful, you will see the myodbd driver item in the driver of the Control Panel / odbd data source!
Step 2: establish the asp file link database.
There are two ways to do this. One is to create a system dsn in the odbc data source. Later I found that it was possible to use mysql in asp without building it, and the method is explained below.
Open the control panel / odbd data source, select the system dsn, then add a new dsn, and the driver selects myodbd driver, and a dialog box appears for entering mysql
relevant information.
Windows dsn name: the name of the dsn to be established
Mysql host (name or ip): the name or ip address of the mysql server, usually filled in with localhost
Mysql database name: you need to use the name of the database, which is set up in the mysql manager.
Here we use an example.
Database name: there are data tables in hc188
The user data table has two fields: username and password. Insert a few data at will.
User: the user name of the linked database. I filled in the root super user.
Password: link database user password. If there is no password, you can leave it empty.
Port (if not 3306): the port of mysql on the server. If left empty, the default is 3306.
Sql command on connect: use the sql command to link to the database. This can be left unfilled.
After filling in, select ok to save.
Link the asp code of the database below!
<% strconnection = "dsn=hc188;driver= {myodbd driver}; server=localhost;uid=root;pwd= Database=hc188 "set adodataconn = server.createobject (" adodb.connection ") adodataconn.open strconnectionstrquery =" select * from user "set rs = adodataconn.execute (strquery) if not rs.bof then% > < table > < tr > < td < b > username < / td > < td > < b > password < / b > < / td > < / tr > <% do while not rs.eof% > < tr > < td > <% = rs (" username ")% > < / td > < td > <% = rs (" Password ") < / td > < / tr > < rs.movenextloop% > < / table > < elseresponse.write (" sorry No data found. ") end ifrs.closeadodataconn.closeset adodataconn = nothingset rsemaildata = nothing% >
The second method: I have wondered in use if you do not establish the system dsn, can you also use the mysql database? The result is OK.
The method is simple: change the second line of the above asp code to:
Strconnection= "defaultdir=;driver= {myodbc driver}; database=hc188" is all the content of this article "asp's method of calling mysql database". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.