?
Solved

VFP Create and Register DB in MySQL

Posted on 2012-09-08
6
Medium Priority
?
946 Views
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.
0
Comment
Question by:formadmirer
  • 3
  • 2
6 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38379712
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.
0
 

Author Comment

by:formadmirer
ID: 38379761
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...
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1350 total points
ID: 38379776
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Assisted Solution

by:pcelba
pcelba earned 150 total points
ID: 38379781
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.
0
 

Author Closing Comment

by:formadmirer
ID: 38379856
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!
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38379875
Good!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month17 days, 13 hours left to enroll

830 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