MySQL/Postgrsql detailed instructions on how to use the ODBC interface to access MySQL Guide

Source: Internet
Author: User
MySQLPostgrsql detailed instructions on how to use the ODBC interface to access MySQL

MySQL/Postgrsql detailed instructions on how to use the ODBC interface to access MySQL Guide

How to access MySQL through ODBC
MySQL ODBC interface is implemented by installing the MyODBC driver, which is cross-platform. For Linux and other Unix operating systems, install the third-party ODBC standard support platform, such as Iodbc.

Simple ASP Sample Code:
The Code is as follows:
<%
Dim SQL, mysql
Set SQL = server. createobject ("adodb. connection ")
Mysql = "driver = {mysql odbc 3.51 driver}; database = database;
Server = host; uid = user; passWord
= Password; "'option = settings
SQL. open mysql
%>


The above Code uses the MyODBC development version 3.51 connection example. The development version is used because some new features and stability are not available in the 2.x official version. A few days ago I read an article on how to write a security program written by Microsoft security experts. As mentioned above, if the code of the ASP file is hacked, the database may not be guaranteed, and a series of problems may occur, or even the management permission may be obtained. As mentioned in the article, the solution is to compile com components and then connect to the database by ASP calling the component method. The advantage of doing so is to improve security, but the problem is that there are only a few people capable of doing so. My compromise is to define the data source. The database, user, password, and set connection information are all defined in the data source, which greatly simplifies implementation and enhances security. Of course, to ensure that the data source can be accessed in the actual operating environment, it must be defined as a "system data source ", I think it is harmless to define it as "User Data Source" or "System Data Source" during development.
The Code is as follows:
<%
Dim SQL
Set SQL = server. createobject ("adodb. connection ")
SQL. open "dns = MySQL Data Source Name"
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.