VFP Create and Register DB in MySQL

Posted on 2012-09-08
Last Modified: 2012-09-08
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.
Question by:formadmirer
    LVL 82

    Expert Comment

    by:Dave Baldwin
    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 ,  you have to CREATE the tables that it contains.  You may have to include a 'USE database' statement in your CREATE table file.

    Author Comment

    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...
    LVL 82

    Accepted Solution

    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.
    LVL 41

    Assisted Solution

    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.

    Author Closing Comment

    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!
    LVL 82

    Expert Comment

    by:Dave Baldwin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now