How to use MySQL in VC and Delphi

Source: Internet
Author: User
Tags mysql client mysql in mysql database

We often encounter this problem, how to use the MySQL database in a non-web program or ASP program? There are two solutions to 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 it is not easy for everyone to be familiar with the requirements of the programmer, and to familiarize yourself with the set of MySQL API functions. 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 are very good, I suggest you choose this way, it is easier, but not in line with Cfans style, yes.

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 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, don't make a mistake (excluding the following long string equals)

If you're using Win2K, replace the first line with

Windows Registry Editor Version 5.00

========================================================== from the downside.

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" = "120"

[Hkey_local_machinesoftwareodbcodbcinst. INIODBC Drivers]

"MYODBC Driver" = "Installed"

======================================= End With Previous line

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) that's it. After saving, double click on the file, should be called

Xxx.reg, then choose OK, OK, it's done. Then you open the ODBC Setup program, build a new data source, select the Myodbc driver, the rest is up to you. ===============================================================

Related Article

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.