Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create connection by code

Status
Not open for further replies.

Gerrit Broekhuis

Programmer
Aug 16, 2004
316
NL
Hi,

I have automated installing MySQL (version 5.1.73) to be specific for this purpose. MySQL server is up and running.

However I cannot connect using the default connection string. When looking at the configuration I see that I have not created a connection.

Do I need to create a connection first? No user intervention must be needed, I need full automation. How do I do that with code (using Visual Foxpro or another MySQL utility)?

Regards, Gerrit

NOTE: I don't need help for dnsless ODBC connections, I've been using that for at least 15 years.
 
Gerrit Broekhuis said:
I don't need help for dnsless ODBC connections, I've been using that for at least 15 years.
If that's the case, what is your problem?

You connect to MySQL via ODBC. Do you need help picking the right ODBC driver/version or figuring out the connection string for the driver you use? I know you from the VFP forum, so lets get more concrete about that. The only thing specific to VFP in that is that there are unicode drivers not suitable for VFP and drivers specifically targetted for PHP, also not suitable for VFP, so you just need the right driver for ANSI suitable for VFP. That also is true, if you finally configure your connection to work with utf8, for example, or utf8mb4 or whatever else. It's not a limitation of the Ansi driver to only deliver the latin1 ansi codepage.

Edit: You find the downloads for the Connector/ODBC driver at For Windows, there are only 64bit and 32bit downloads, nothing specific to Unicode or Ansi, but once you download the 32bit msi setup (you need that, even if your Windows is 64bit) and install it you find two drivers: "MySQL ODBC 8.0 ANSI Driver" and "MySQL ODBC 8.0 Unicode Driver". The Ansi driver is what you use in VFP, Driver={MySQL ODBC 8.0 ANSI Driver} is part of the connection string you need to specify using that driver. If you downloaded and installed the 64bit MSI and don't see any drivers becoming available, that's because it only installs the 64bit drivers.

Chriss
 
Hi Chriss,

Well, I use NAVICAT for MySQL to take a look at my MySQL setup. Not that I create databases or tables with NAVICAT, I do that with VFP.

I see now that it’s no problem adding databases, without seeing a connection in NAVICAT. So I don’t need any code for that (my bad). However, when I want to actually see my MySQL setup in NAVICAT I first have to add a connection. Once I add a connection with a chosen name I can open the connection and see the database and it’s tables my application has added.

So it seems I have no problem, but only discovered that NAVICAT is “connection” unaware. Creating databases and tables does not change this.

Regards, Gerrit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top