I have been given 2 files .DB and .sdf to work with. I have googled it a little and found out that its SQL Compact database format. I really have no idea how to work with these database files.
I have found here on stackoverflow some 3rd party tools, bud they were all for windows (I am on Mac).
I have also tried to open it in SQLite but no success.
I need this data in my web app written in PHP. So conversion to MySQL or Postrge seems to be an ideal solution. Any ideas?
You can use MSSQL extension in PHP to work with these databases
Related
I have not found a library that handles exporting data and structure to SQL. - there are a number of snippets and so on for data only. Exporting structure seems quite a bit more complicated. It must be able to do this without command-line access.
Many of the descriptions I've found online are quite old, so perhaps MySQL has new features that handle this? Or perhaps there are now libraries which do this? (Or perhaps PHPMyAdmin has a self-contained class or set of functions I could hijack?)
You could try this: Sypex Dumper
I used it for a long time with Joomla on XAMPP, very light weight and functional.
You can simply use it standalone or integrate to your application.
This class suited my needs
https://github.com/2createStudio/shuttle-export
You can see several examples in the documentation. The only flaw is that this class don't have the force download option (it always generate the file in disk). I was willing to make a pull request, but there's one push request dating from 6 months ago and the mantainer didn't give a dam.
I am kinda new to the whole development side, but I want to be good.
In database creation, I used to do this via PHPMyAdmin --> Wamp Server.
I got to learn how to use MySQL Workbench, and I am liking the experience.
The problem is, when I have the .sql file created via use of Work Bench, e.g. data.sql, I cannot import it to PHPMyAdmin, so as to continue in a my developments (web-related) as there are many errors comming up e.g. #1146.
It is really frustrating since I have to do double work and create what I did in Work Bench in PHP MyAdmin.
Is there a simpler way?
Like can I just connect to a .sql file (as the database) and continue with execution of my projects? (Its a bit stupid, but I have been reduced to that.)
Please help.
Thanks in advance.
This post seems like it might help you out, did you check the default encoding of the dump and make sure mysql expects the right type of encoding?
http://forums.mysql.com/read.php?103,275798,275798
Also: Please read the policies of the board before asking your question. It states to do some research before asking questions like this... I googled "mysql workbench dump to phpmyadmin" and the very first item that popped up was a video explaining this EXACT situation. :)
I have a small mySQL database and a few simple php based webpages that query the database, generate html tables and present them in the browser. The database is no longer being updated. So, searching and viewing subsets of the data is all that is required.
Some users are interested in distributing the searchable database on a cd or usb memory stick. SQLite seems to offer the answer, but I don't understand what is needed to make this work. What will be required to make a web browser based "app" work from a memory stick in the absence of a server like xampp?
XAMPP Lite from http://portableapps.com/apps/development/xampp
What you want is called a "standalone server". This is very common in almost every other modern language except PHP, for some reason. Googling "standalone php server" reveals several options:
QuickPHP
Nanoweb
Server2Go
Is it possible to write .MDF files using PHP. I have a simple HTML table - x columns, y rows that I wish to convert into a MS Access dataset. There are no foreign keys or anything exotic, just a number of rows and columns.
I have Google searched but the only advice I seem to be able to find is to save it as a .CSV. Unfortunately this isn't acceptable for my client. They want to simply be able to double click the icon and have the database load up in Access (Seems you have to import csv files and can't just double click them).
Those are actually two different problems:
1) Parsing HTML to separate values
Since you seem to have found a way to export to csv, I won't be answering this. You already got your parser then.
2) Create an mdb file.
You can use odbc to talk to Access, that is, if you are in Windows. That means that PHP must be installed on a Windows machine. I'm not aware of any Linux drivers for Access..
You can use odbc_connect to connect to the database:
$conn = odbc_connect("dbname","" ,"");
From there, working with the database is pretty similar to MySQL as long as you use the ODBC functions.
The only problem is creating the actual MDB. This cannot be done in ODBC, you'll need the JET engine. It may be possible to create an MDB file from PHP, but it may be easier to create an empty MDB once, and copy that file from PHP whenever you need a new database.
Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications.
http://jackcess.sourceforge.net/
But an MDF file is not a standard Access file extension. MDB and MDE are while MDW is for user level security.
Have not tested this but this might help you:
http://devzone.zend.com/article/4065
Note that active development of MDB Tools has moved from Sourceforge to Github
https://github.com/brianb/mdbtools
Background: I am more of a designer than a programmer, but have hacked templates for many open source CMS's (Drupal, Joomla, Wordpress)
I want to start from scratch in regards to the relations of php and a mysql database.
Lets assume I have a working database and php engine locally.
What would be my first step to connecting to my database and creating a table... (im happy to be led to an appropriate tutorial...)
Many of the tutorials I have seen start with basic php, but I would rather explore the connection between the db and the php.
This seems to be a pretty good tutorial:
http://www.freewebmasterhelp.com/tutorials/phpmysql
W3Schools has a big tutorial on both PHP and MySQL.
A useful tip is also to know that you can look up anything you need on the official PHP and MySQL support pages by going to
php.net/search-term-here (example)
mysql.com/search-term-here (example)
If you want to really get a leg up... see if you can get programs like CPanel and PHPMyAdmin.
PHPMyAdmin will give you a more familiar UI for database control and ease you into using mySQL.
There are two ways: start to learn SQL and create tables trough SQL or use PHPMyAdmin to administer the database. From then on you only have to learn how to get the data from the database.
PhpMyAdmin also displays the queries so you can analyze these.
Get into PDO . It's gonna be the next big php/mysql thing. A lot of sites have switched to it. It's simple and securer than conventional mysql_* . A good book (for beginners and to start you going) that is for sure not for production is Wicked Cool Php Scripts
You can also have a look at XAMPP, which makes installing everything required for PHP/MySQL a breeze. Linux, Windows? No problem.
Nettuts and theme forest blog have a nice video series on learning php. They have other series such as wordpress and are currently doing a series on code ignitor which both use php.
Install mySQL and look up basic tutorials on how to create a table, update, etc. Once you feel handy with that, install XAMPP lite, where you can start practicing PHP. Look up tutorials on how to use PHP to access your database. XAMPP also has phpMyAdmin, so you have a much easier interface to work with your databases.
It'd be good if you had some basic programming knowledge too-- it makes understanding PHP significantly easier.
This is an example on how you connect php to your database:
<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', 'root', '');
?>
mysql = database driver
host = localhost or 127.0.0.1
dbname = your database name
'root' = your database username
'' = database password
*Visit and explore this link for more info about PHP with Database.