How to use MySQL in VC and Delphi

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

How to use MySQL in VC, Delphi, VB and other programs (use of 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, the use of MySQL provided by the API function library.

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 then follow it. 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, not very 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, change the first line to 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:\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 With Previous line

(Bill.gates) that's 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.