asp USES the ODBC interface to access the MySQL method

  • 2020-05-06 11:46:02
  • OfStack

MySQL's ODBC interface is implemented by installing the MyODBC driver, which is cross-platform. If you are using Linux and other unix operating systems, you will need to install iodbc and other third-party ODBC standard support platforms.  
Simple ASP sample code:  
< %  
dim   sql,mysql  
set   sql   =   server.createobject("adodb.connection")  
mysql="driver={mysql   odbc   3.51   driver}; database = library; server = host; uid = users; password  
= password;"   'option   =   set  
sql.open   mysql  
% >              
          the above code is an example of a connection using MyODBC development version 3.51, which is used because of some new features and stability. The other day I read a tutorial written by Microsoft security experts on how to write security programs. As mentioned above, if the code of the ASP file is seen by a hacker as shown in the above example, the database may be compromised, causing a series of problems, and even gaining administrative rights. The solution, mentioned in passing in this article, is to write an com component and then connect to the database by calling the component's methods by ASP. This has the advantage of improving security, but the problem is that few people are able to do it. So my compromise is to define the data source. Defining libraries, users, passwords, and connection Settings in the data source greatly simplifies implementation and enhances security. Of course, in order to ensure that the data source can be accessed in the actual operating environment, be sure to define it as "system data source," and I don't think it hurts to define it as "user data source" or "system data source" at development time.  
ASP sample code  
using the data source
< %  
dim   sql  
set   sql   =   server.createobject("adodb.connection")  
sql.open   "dns=MySQL data source name " 
% >


Related articles: