Portable MySql-Driven App - mysql

My father has a small business and asked me to make him a quick program to help automate several of his daily tasks. Due to the nature of these tasks, it absolutely requires a local database (not distributed with connections from multiple clients, just 1 local client and 1 local MySql datastore).
I'm pretty accustomed to MySql programming but have never had to install it and don't really know the details about how it works under the hood.
What I'd like to have is a final deliverable where I send him a folder that has an executable JAR (I've chosen Java since its a good fit here) as well as a preconfigured MySql database on it. I'll run all the scripts, initialize all the tables and populate them, etc. before deploying the the distributable (folder).
This way, no config is necessary for him. My dad gets the folder, plunks it down wherever he wants it on his file system, and double-clicks the JAR to launch the program every time. I will preconfigure the JDBC code to look and connect to the local Mysql database also living under the same root folder ("MyDadsApp/").
Is this even possible to do? If not, why? If so, how?
Here's what I'm thinking as a tentative deployed folder structure:
MyDadsApp/
MyDadsApp.jar
res/
user-manual/
mysql/
MyDadsAppDatabase.myd (???) - the actual database
MySql.exe (???) - MySql Server
Any input/recommendations will be met with open arms!
Thanks

This is actually a perfect scenario for SQLite. It's got a lot less features than MySQL, but it's whole shtick is that it's server-less and self-contained. Sounds perfect for what you're doing.

Related

How do I migrate a SQLAnywhere 9 db running in a remote server into a mysql server on my machine?

I am working at a company that has some CRM software running in a remote Windows XP server that uses a SQLAnywhere 9 db to store its data; I have access to this remote server with an administrator account.
I would like to extract the db into a .sql file so that I can run the db locally on my machine without affecting the running db in the server (since it is key for the company's day to day operation).
The reason I need this is that we are going to test some BI Software and we need data from this database to test it, but we don't know the structure of the database since the developers of the CRM software didn't give us any documentation on it. So we need to have the database locally so that, without affecting the running CRM, we can:
understand the structure by looking at the DDL
make queries to it to get sample data
I researched a bit, and the most common solution to my problem was to use dbunload on the remote server to unload the db into a reload.sql file that contained what I needed. But most tutorials on the subject mention that I have to stop the db first (which would be catastrophic). If this is the only option, then I guess I am willing to do it on the weekend when the CRM is not used, but I wanted to know if there was another solution first.
If there is no other solution, can you point me to where I can find the proper and safer way to do this?
I have researched a lot, but prior to this day I have never even heard of SQLAnywhere, so I really need all the help I can get. My main concern is doing something that impacts negatively the CRM software.
Thank you.
You can run dbunload across the network, you just have to tell it to do an "external" unload. The default is to do an internal unload which would only work from the machine where the database server is running.
I don't have SQL Anywhere 9 documentation right now to look up the exact switch, but dbunload -? should show you all the possible switches.
Edit:
-an will create a new database and load the data and schema from another data
-xi switch will do external unload and internal reload.
-c parameters to connect to your remote database

Database during release and developing

I am new to Database programming and there is some general questions that I would like to ask. I created the schema in my localhost using mySQL and linked to eclipse. There are some problems that I do not know how to approach.
One of my friends would like to help to develop at his personal machine, but he could not link to my database server. So one way is to copy the schema to his mySQL and change the connection string, are there any better ways?
If I would to release the project and run it on different machines, will it affect the databases operation since the schema resides in my local server.
Is there ways to just like attach the database inside the project since it is a local database and I am not accessing it from any other programs.
Sorry if my questions sound very stupid. I am really new.
Your approach of running local test MySQL instance for every developer sounds fine.
However, if your application never needs any data shared (essentially database is always local as you stated), then you should ask yourself if MySQL really an appropriate solution for your application. I think SQLite is a better choice in that situation - it is likely to work faster than MySQL for local access, and it has essentially zero setup - no database daemon to run or anything like that which greatly simplifies application install.
Granted, SQLite has its limits, but I often use SQLite for my projects, and only if they grow large, I might migrate them to MySQL or PostgreSQL if task requires it.
Typical signs that SQLite may not cut it:
Many clients (10+) need to access database for writing
Total database size is very large - more than 10GB total

Deleting MySQL Connections

Topic: MySQL Connections
Specific Question: In a 2-3 week process of learning MySQL and attempting to get a Python stock info scrapping program to feed data into a MySQL schema (database, table) I’ve ended up creating a number of connections. (MySQL57, MySQL57_1,MySQL57Nov13) Even though I believe I’ve deleted the connections through Workbench, they still show up as Window services. How do I completely get rid of these beasts, both in MySQL and as Windows services?
System: Windows 8 64bit on a Xeon Ivy Bridge processor, large SSD’s, large HD’s, mucho RAM, dual X-fired video cards, ASUS Sabertooth MB (self-built a yr ago)
Software: MySQL 5.7, complete installation except for module for Visual Basic and Python3 (running 2.7). Attempting to use the above hardware as both a server & client.
Even though I did my first Fortran programming in 1964, and spent my career on Unix machines, please regard me as a newbie when it come to the jargon associated with databases and client/server communications.
Why am I asking this question? My “down the road question” will be about getting data from Python into the MySQL table, but “first things first” --- I would like to get a nice clean installation & am concerned with these connections showing up as windows services.
By the way, I’ve thoroughly scoured this site and many others but have not found any answers that fit my requirements; they’re either for a non-Windows environment, too full of jargon for me to understand, or too simplistic to be useful. Hope that didn't come across wrong :-)
TIA, Doug
You found the uninstallation command already, so let me show you how to make sure not to remove the wrong service.
Open the services management (e.g. via Start menu -> Computer -> right click -> Manage -> Services and Applications -> Services). Scroll to the MySQL server services and double click one that you want to uninstall. A dialog opens with various information about the service including a line "Path to executable:". The followoing line contains the full path to the server this service is for. You should only have one service for each of the servers. If that is not the case then you probably have to go through the registry and search for the service name and remove that key manually, until only one is left. Otherwise just use the path to run your uninstallation if that is for a server/service you don't want anymore.
My problem (as described in my original question) has been solved thanks to the comments that Michael made.
In a command prompt with admin privileges
net stop MySQL57Nov13 (service name)
to stop the service (all 3 of my services)
Note: I had cd'd to D:\Program Files\MySQL\MySQL Server 5.7\bin to run the net stop
commands. I have a hunch that the commands would have worked independent of the directory chosen
to run them from....didn't experiment further though. Likely depends on the PATH env var.
Then go to C:>
sc delete MySQL57Nov13
for all 3 services I wanted to delete
As a reference I used http://dev.mysql.com/doc/refman/5.7/en/windows-troubleshooting.html
The above was written prior to Mike's answer.
Later update: This is a *%#&!! nightmare! Obviously I deleted the key windows service (was one of MySQL57, MySQL57_1, or MySQL57Nov13). This effectively cratered the entire project ... couldn't create a new, fresh connection or anything else. So I uninstalled everything (to the best of my knowledge) using the internal MySQL Uninstall routine as opposed to Windows Program Management uninstall. Fortunately I've got no data which I have to save.
I'll start a new question later today.... I'm going to uninstall the mess again, and start from scratch (the new question will be concerning the MySQL import hanging when I tried to import a .sql file tied to a tutorial I've been watching)
Let's consider my Question solved with many thanks to Michael and Mike

mysql: keeping local mysql database and remote server database synced up

I am kind of a amateur at web development. But it seems like most people develop on their local machines and the upload to their remote servers when everything is ready. I want to start doing this. I've installed Xampp (Apache) on my local machine. But in order for this to really work, i need the the mysql databases that already exist on my remote server to be "synched" or "duplicated" on my local machine. But I'm finding this somewhat hard to figure out.
First, Should I be using mysql "reduplication" feature (with my remote server as master) and local machine as slave? Or is there a better way to do this? Should I be synchronizing instead of reduplicating
Second, Is anyone willing to give me a quick description of how I achieve this "reduplication" or "synchronization"
Thanks
It may be tempting, but it's hopeless to try to keep the database in two places. Instead, always keep the database on the server because it's much easier to develop and debug your code if it's in just one place. "Resynch" and "reduplicate" and all that business is just too much trouble, as you are discovering. The DB is going to end up on the server anyway, so you may as well put it there right now.
Also, you will not need a web server on your local machine, which will unburden you.
This next is applicable if you are writing CGI. If you aren't sure whether or not you are writing CGI, then you are not (well, probably not). {
If you mainain just one database and it lives on your server, you'll be able to write one piece of portable code that will run equally well on your local machine and on your server. This is a huge win, take my word for it.
To get this working, you will need the mysql library on your local machine; no other mysql component is needed there. The mysql server will run on your server only.
Read up on mysql "connector" for the language you're using.
}

Migrating from PROGRESS to SQL Server 2008 - how?

I'm faced with a task I don't know how to proceed with: migrate a 120 GB database from PROGRESS to SQL Server 2008.
I've quite frankly never even heard of PROGRESS and can't really make much sense of their web site either.... what I have is a folder restore with 128 files called dbqsXXX where XXX goes from 1 through 128 - each file is 1 GB in size.
I don't know PROGRESS, I don't have any PROGRESS server available - is there any hope I can get the data out of these files into SQL Server??
Also: I tried to find ODBC drivers, and I found one (called SequeLink ODBC 4.51), but I cannot install it since it doesn't like my Win7 x64 machine :-( And on the PROGRESS site itself, I cannot seem to find any ODBC driver for download - only stuff that will cost $$$$$$
So - what are my options??
is there something like a "PROGRESS Express" or "Free" or "Developer" version available?
can I access those dbqs files in my "restore" directory some other way?? They appear to be at least partly binary - no CSV or XML or anything like that.....
can I find a useable ODBC or OleDB driver that will work on my Win7 x64 machine and allow me to create a linked server to the PROGRESS db?? (worked fine with MySQL a while ago)
can I (or my customer) somehow dump the structure and data from PROGRESS into another, more approachable format, like MySQL or PostgreSQL or something??
Any hints, tips, website, webcasts are most welcome !!
There is an evaluation kit available: http://communities.progress.com/pcom/docs/DOC-103695
This may, or may not, help you depending on what those files that you have actually are. If they are a complete and uncorrupted copy of a recent version of the database then the evaluation kit should be able to open them.
It is, however, possible that the database has been protected from such access. In which case you could be out of luck unless you can obtain credentials from whoever controls them.
Having said that -- your description of the file names does not sound like an actual database. Database extents are usually named something like dbname.db, dbname.b1, dbname.d1, dbname.d2 etc. If the db was configured using storage areas many of the extents will be named dbname_##.d#.
Your files sound more like they are "backup extents". In other words they are the result of someone making a backup and writing it in 1GB chunks. To restore such a backup you need a text file that lists all of these "extents" except for the first one. You would then execute the following:
prorest dbname extent1 < filelist
(Use the "proenv" shortcut to get a properly configured command window.)
Once you do that you would have an actual database. (If the backup was made with compresssion the restored db is likely to be a lot bigger than your files.)
Prorest is not backwards compatible. So if the backup is a v9 database the v10 evaluation kit won't work. You would need to find a machine with the same version of Progress that the backup was made with. (There are v9 utilities in the %DLC%\bin\91dbutils folder. Ditto v8 in 83dbutils. In theory you could use those to restore a backup of an old version and upgrade to a current version. Actually using those utilities is "challenging".)
Given an actual database you can then start a server with "proserve", connect to it and have fun. But right now isn't clear if there's any point to getting into the details of doing that.