Detailed instructions on how to access the MySQL Guide with an ODBC interface
MySQL's ODBC interface implementation is through the installation of MYODBC driver, this driver is cross-platform. If used under UNIX systems such as Linux, you need to first install IODBC these third-party ODBC standard support platforms.
Simple ASP Sample code:
Copy Code code as follows:
<%
Dim sql,mysql
Set sql = Server.CreateObject ("Adodb.connection")
Mysql= "Driver={mysql ODBC 3.51 driver};d atabase= Library;
server= host; uid= user; PassWord
= password; ' option = Set
Sql.open MySQL
%>
The above code is an example of a MYODBC development version 3.51 connection, using the development version because of new features and stability that are not available in the 2.x official edition. A few days ago I read a tutorial on how to write a security program written by Microsoft security experts. The above mentioned that if the code of the ASP file is seen by the hacker in the example above, the database may not be insured, then a series of problems can be raised, and even the administrative privileges are captured. In the article, the workaround is to connect the database by writing a COM component and then by invoking the method of the component by the ASP. The advantage of this is that it improves security, but the problem is that people who have the ability to do so are in the minority. So my compromise is to define the data source. The definition of libraries, users, passwords, and setting these connection information in the data source greatly simplifies the difficulty of implementation and also enhances security. Of course, in order to ensure that the data source can be accessed in the actual operating environment, it must be defined as a "system data source", defined as a "user data source" or "system data source" at development time. I think it's harmless.
Copy Code code as follows:
<%
Dim sql
Set sql = Server.CreateObject ("Adodb.connection")
Sql.open "Dns=mysql Data Source Name"
%>