How to use MySQL ODBC Driver in VC and Delphi

Source: Internet
Author: User
Tags odbc mysql client mysql database mysql odbc driver

We often encounter such problems, how to use the MySQL database in non-web programs or ASP programs? There are two solutions for this problem:

1. Use the Library of API functions provided by MySQL.

This is how many well-known MySQL client tools are implemented, as is the famous Winmysql tool. This can be achieved in most development tools.

such as VC,BCB,DELPHI,VB and so on, as long as can call the third party API can be achieved. But the requirements of the programmer is very high, and to familiarize yourself with a set of MySQL API functions, this is not for everyone

It's easy. And this method cannot be used for programs such as ASP, because it does not support COM objects.

2. The second is the use of the MYODBC driver.

You can download the MYODBC driver to www.mysql.com and follow the following.

The first option is to download the full installation package, this package is very large, but for us to be useful only myodbc.dll this file, but to download such a large file, is not appropriate. Of course, if you

I suggest you choose this way, it's easier, but it's not in line with Cfans style, is it?

The second is to download the Myodbc.dll file directly, only hundreds of K, but not easy to use, I have been groping for a long time to find the way to use it.

First you untie the package and place the Myodbc.dll file in the Windowssystem or Winntsystem32 directory, depending on whether your system is Win9x or Winnt (Win2K), you should

You know.

Then open a plain text editor, such as Editplus,notpad, (depending on your preference) Save the following passage as a file with the extension. Reg, you know, this is a registry file.

Wrong (not including the following long string equals)

If you're using Win2K, change the first line to Windows Registry Editor Version 5.00.

      
       Windows Registry Editor Version 4.00 


[Hkey_local_machinesoftwareodbcodbcinst. INIMYODBC Driver] 
"Usagecount" =dword:00000002 
"Driver" = "C:winntsystem32myodbc.dll" 
"Setup" = "C: WINNTSystem32myodbc.dll " 
" SQLLevel "=" 1 " 
" fileusage "=" 0 " 
" driverodbcver "=" 02.50 " 
" ConnectFunctions "=" YYY " 
" APILevel "=" 1 " 
" cptimeout "=" a " 
[Hkey_local_ Machinesoftwareodbcodbcinst. INIODBC Drivers] 
"MYODBC Driver" = "Installed"

As for why to write these, you do not ask me, I do not want to answer, this is the charge door of the decision (Bill.gates) This is it. After saving, double-click just the file, should be called Xxx.reg Bar, and then choose OK, OK, done. Then you open the ODBC Setup program, build a new data source, select the Myodbc driver, the rest is up to you.

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.