How to use mysql in vc and delphi

Source: Internet
Author: User

We often encounter this problem. How can we use mysql Databases in non-web programs or asp programs? There are two solutions to this problem:

1. Use the api function library provided by mysql.

Many well-known mysql client tools are implemented in this way, as is the well-known winmysql tool. This can be implemented in most development tools.

For example, vc, bcb, delphi, and vb can be implemented by calling third-party APIs. But it is not easy for everyone to have high requirements on programmers and be familiar with a set of mysql api functions. This method cannot be used in asp or other programs because it does not support com objects.

2. The second is to use the myodbc driver.

You can download the myodbc driver at www.mysql.com, and then follow the steps below to download it.

The first option is to download the full installation package. This package is very large, but it is not appropriate for us to download such a large file, only the file myodbc. dll is useful. Of course, if you have a good dish, I suggest you choose this method. This is easier, but it does not conform to the cfans style, right.

The second method is to directly download the myodbc. dll file, which is only several hundred kb but not easy to use. after a long time of exploration, I found a method to use it.

First, unbind the package and put the myodbc. dll file in the windowssystem or winntsystem32 directory. It depends on whether your system is win9x or winnt (win2k). You should know.

Open a text editor, such as editplus and notpad, and save the following content as a file with the extension. reg, you see. This is the Registry file. Do not make a mistake (excluding the following long string equals sign)

If you are using win2k, replace the first line

Windows Registry Editor Version 5.00

========================================================== ========================== Start from the downstream

Windows Registry Editor Version 4.00

[HKEY_LOCAL_MACHINESOFTWAREODBCODBCINST.INImyodbc driver]

"UsageCount" = dword: 00000002

"Driver" = "C: \ WINNT \ System32 \ myodbc. dll"

"Setup" = "C: \ WINNT \ System32 \ myodbc. dll"

"SQLLevel" = "1"

"FileUsage" = "0"

"DriverODBCVer" = "02.50"

"ConnectFunctions" = "YYY"

"APILevel" = "1"

"CpTimeout" = "120"

[HKEY_LOCAL_MACHINESOFTWAREODBCODBCINST.INIODBC Drivers]

"Myodbc driver" = "installed"

========================================================= End on the previous line

As for why you want to write this, you don't want to ask me, and I don't want to answer it either. This is what Mr. billable has the final say (bill. gates. after saving the file, double-click the file.

Xxx. reg, and then select OK. OK. Then you open the odbc setup program, create a new data source, and select the myodbc driver. The rest depends on 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.