MySQL and Postgrsql details how to access the MySQL guide using the ODBC interface

  • 2020-05-06 11:45:03
  • OfStack

Explain in detail how to access MySQL guide
using ODBC interface The ODBC interface for MySQL is implemented by installing the MyODBC driver, which is cross-platform. If you are using Unix operating systems such as Linux, you will need to install Iodbc, a third-party ODBC standard support platform.  

Simple ASP sample code:    

<%   
dim sql,mysql   
set sql = server.createobject("adodb.connection")   
mysql="driver={mysql odbc 3.51 driver};database= library ;  
server= The host ;uid= The user ;passWord   
= password ;" 'option =  Set up the    
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 ASP calling the component's methods. 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.  

<%   
dim sql   
set sql = server.createobject("adodb.connection")   
sql.open "dns=MySQL Data source name "   
%>    


Related articles: