• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 964
  • Last Modified:

VFP Create and Register DB in MySQL

Here is what I am trying to do...
Using VFP 9 I want to create a db in MySQL and then register it.

Here's what I've done...
Created the db, created all table definitions and populated them with sample data.

Then I created two mysql dumps,
1) the first dump simply creates the database, and
2) the second dump contains all the tables and sample data.

Then for testing purposes I deleted the database and unregistered it from MySQL.

Now, to recreate the database...

I can execute (1) from within VFP and it does create the db. That's no problem.

However, without the db being 'registered' with mysql, I can't execute (2) that actually creates the tables and populates them.

If it matters, the MySQL db is running locally under XAMPP on Windows XP.
  • 3
  • 2
2 Solutions
Dave BaldwinFixer of ProblemsCommented:
I have no idea what you mean by 'registered' with mysql.  There are CREATE and DELETE database functions but no 'register' function.  After you CREATE a database http://dev.mysql.com/doc/refman/5.1/en/create-database.html ,  you have to CREATE the tables that it contains.  http://dev.mysql.com/doc/refman/5.1/en/create-table.html  You may have to include a 'USE database' statement in your CREATE table file.
formadmirerAuthor Commented:
Thanks Dave. The term 'register' comes from the program I've always used up to this point to manage my MySQL dbs - SQL Manager for MySQL.

To create a db in this program, you first establish a connection with you MySQL server, in this case using XAMPP's default setup (localhost, 3306, root, '') password is empty.
Once you have actually created the database, you then have to 'register' it before it can actually be used.

So 'register' may not be the term I am looking for, or for that matter even necessary if creating a db outside of this particular program.

Since I posted I have had a major setback. What I thought was working, being able to create the db programmatically in VFP, turns out was wrong. What I saw was a left over db definition file, not one that I had actually programmatically created.

So I'm back at the very beginning trying to get this all figured out...
Dave BaldwinFixer of ProblemsCommented:
Since you have XAMPP, look at phpMyAdmin for using your MySQL installation.  It is much more direct about what happens and doesn't use any odd terms that I know of.  One of my customers that uses VFP with MySQL on his web sites, creates the database and tables in phpMyAdmin and just uses the VFP output to update the tables.
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Hmm... If the USE database command does not help because of "invisible" database then I would try to disconnect from MySQL after the first step and connect again.
formadmirerAuthor Commented:
Thanks - got it sorted out.

I've been connecting to DBs from VFP for a little while, but had never tried to actually create one.
It turns out I was running the create string from within SQLSTRINGCONNECT when it needed SQLEXEC.

I'm sure this may seem like a dumb mistake to many, but I'm new to this and pretty much winging everything step by step as I go. Anyway, it works now!
Dave BaldwinFixer of ProblemsCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now