Adobe AIR with PHP/MySql or SQLite - php

What would be a better choice for making a database driven
Adobe AIR(Desktop) application?
Using PHP+MySql with AIR
OR
Using SQLite
If I choose SQLite, then I cannot reuse my code for
an online application.
If I choose 1, I have to block few port numbers on User's machine.
Also, I am using XAMPP for providing the user with PHP and MySql, so
XAMPP opens up a command window as long as it's running. And, users
get confused about what's that window for? It makes the end user
experience slightly confusing.

I'd definitely use SQLite as its included in Air.
May I suggest; write your code in two sections. The UI which uses a JSON feed to populate itself, and the API to provide the JSON data. When it comes to port the application to the web you can use the same UI but with a rewritten API.

Whatever you do, don't open up a command window while the program is running. If you do that, your customers will uninstall like there's no tomorrow.
As far as mysql vs sqlite, the standard approach is - if it communicates remotely, feel free to use mysql, but if you're installing the db on the client, you should use an embedded standalone db (sqlite).
How complex do you expect your app to be that you can't use sqlite (besides not being able to reuse some of the code that you mentioned)?

If XAMPP is too confusing for your client, install Apache and MySQL as standalones. It's essentially the same thing and you'll have more control over what's running in Apache/MySQL. Plus you won't get an annoying command window (though, to be quite honest, I don't recall a window that I couldn't minimize to the tray when I ran XAMMP).

My suggestion is use Sqllite as your local database and writes a synchronization API that will synchronize the local sqllite database with the server side database-MySql. So according to your client you can use the system. If the client is standalone then Sqllite will serve otherwise the MySql will serve. Only thing you have to decide in both this is how to use the synchronization api.
Just check the Sample Application

Related

How to Sync and Consolidate Data from Multiple local database to live server database in PHP?

My plan is to store data in my local MySQL database and after a time interval it will update my live MySQL database remotely. Is it possible?
I'm planning a inventory management script in PHP MySQL. I will install web application locally to my clients and it will backup local data to live server via API or any library.
Can any one suggest me any library for this all.
Thanks is advance.
You can achieve this with different methods:
Database Replication (recommended solution), it almost handles everything perfectly. You can read different tutorials available on internet to use it.
Scheduled PHP script to sync data on your specified occasions. There are several packages available for this, i.e. https://github.com/mrjgreen/db-sync. For scheduling you can use CronTab or supervisor or etc.
But I would personally recommend you to use replication, since it is a native DBMS solution for such scenarios.

What to do about MS Access in PHP in Unix?

I need to pull data from MS Access 2007 (both mdb and accdb files) for a website written in PHP 7. The pages don't need to be dynamic or interactive. They just need to present data stored in the database.
Local development environment: Windows 7, IIS 7.5
Online server: A2 Hosting, Linux (CloudLinux Server release 6.9), Apache/2.2.34
The ADOdb webpage for Access says "Windows Yes, Unix No". I presume this means I can use ADOdb to connect to Access in my local environment, but not on the online server. I suppose I have the following options:
StackOverflow has some questions on this (1, 2, 3) with answers that give code for connecting to Access in PHP. Although the answers don't say so, I am guessing that that code will only work in Windows because if it were that easy to connect to Access in PHP in Unix, then ADOdb would do it! So if I'm right about this, then this is not a workable option.
The PHP Manual has a page on Database issues that says PHP can access Access, but it seems to only apply to either running in Windows or "running PHP on a Unix box and want to talk to MS Access on a Windows box". So this also does not appear to offer a workable solution for running the website online on a Linux server.
Extract the parts of the database needed into something else that can be accessed in Unix, such as CSV files, and use that as the database for the website. If I do this with CSV, I suppose I don't need ADOdb, but would just use fgetcsv(). This is an inelegant solution, but may be the best thing to do if there's not a way to access Access directly in Unix. (I could use MySQL instead of CSV, but that seems like a lot of unnecessary overhead.)
Run the pages on my Windows machine using ADOdb to access Access. Save the parts of the pages that come from the database as separate HTML segment files and include() them when the pages run online. (The script could detect which environment it's running in and if it's local, then access the database, and if online, then include() the HTML segment files.)
Move the online website from Linux to a Windows server, so PHP can access Access directly using ADOdb.
Convert the entire database from Access to something else, such as MySQL. This is not practical at this time, although that may be an option in the future.
Have I understood my options correctly? I've listed them in what seems to me to be the order of preference, so unless someone suggests otherwise, I guess I'll go with the third one (extract to CSV, use fgetcsv(), no ADOdb) since the first two won't work.
Thanks for your help.
The main problem is the ODBC driver. The {Microsoft Access Driver (*.mdb, *.accdb)} comes with Microsoft Access or the Microsoft Access Database Engine, which are both Windows-only.
However, there are alternate ODBC drivers that work on Unix and unixODBC. A popular open source one is mdbtools, which is limited, but can be used to connect Access to PHP on unix using PDO and ODBC. There are also commercial alternatives that are more fully featured.
Once you've got that working, it shouldn't be a problem to use the ODBC driver in PHP. Note that on shared hosting, this might not be possible.
Alternatively, you can use a php-jdbc bridge with UCanAccess. This might still be all-open-source and more fully-featured than mdbtools, but is more complex to set up correctly.
You don't need to convert "the entire database" from Access to use Mysql, just the tables. You can then link them back into the Access database using the MySql odbc connector and so long as the table names are the same you won't even notice the difference, all your forms, queries and everything will work.
You would then have MySql server running on your local machine which, if you create a user with the right permissions and port forward through your router (directing traffic from port 3306 or whichever port you assign to your server, to your machine) and allow the traffic through your firewall, your website can then access, read and write to your database.
If you want to query the database from php mysqli_query will work just fine. Most websites that run from data run using MySql, so this is a future proof solution too.

How to easy configure Hadoop for big MySQL table

I'm doing my student work. Please help me understand in what direction should I move.
So, I have a big MySQL database (31.3Gb, 130 millions rows) on my PC. I have written a simple html page (interface for my program). I'm using PHP for connecting to my database, AJAX for retrieve data from a server asynchronously and OpenServer (local server for testing).
How it works: the user selects some filters on my html page, clicks the search button, and it displays the main table.
Everything works well, but what should I use to connect my project to Hadoop? It is a mandatory requirement.
Maybe HortonWorks/Cloudera/Docker?
It will be very useful if you send links on some useful guides.
The main criterion is simple to configure and install. Also, I have only 4Gb of RAM on my laptop, so most likely I have to use old versions of tools. HortonWorks 2.1 was successfully installed even on my virtual machine (Ubuntu 14.04)
In advance thank you everyone for your help!
You can use Sqoop import to push data from MySQL to Hive.
Then, you can query via HiveServer2.
For getting Hadoop and other components, it is best to use HDP or CDH sandbox. If your machine resources do not permit using the sandbox, consider using AWS.
Once you have data in Hive, you can point your application to query Hive and serve results, instead of going to MySQL.

How do I use PHP locally with SQL Server

I am a desktop application / database programmer customizing an ERP application in a Windows environment. I have also done documentation with HTML and javascript on our intranet. I have not done any web programming.
I need to convert an Access 2003 application. Instead of using .Net I think it would be wiser to use HTML to allow access from a tablet. This app will display drawings based on certain lookup values (i.e. part number) stored in a SQL server database. After some research it seems PHP is the best choice. But the things I have found explain on a server supplying the pages and not running locally. I see Apache and IIS mentioned but are these needed if the pages will be loaded on a single machine (or multiple machines but all pages will be present in a single directory structure).
When I search for running pages locally I get pages accessing a databse locally. But the database will be on a server.
Can someone steer me in the right direction?
if you want to use PHP then if you put your application online you can use MySql for the database. You will not need to make any changes because any web server uses mysql with php.
If you want to use PHP with SQL server then you will need on your server to install the Microsoft Drivers for PHP for SQL Server . in the following link you will have the documentation:
[www.microsoft.com/en-us/download/details.aspx?id=20098][1]
PHP has a built-in webserver since 5.4.0: http://php.net/manual/en/features.commandline.webserver.php
If you have PHP (>= 5.4) on your machine, you already have a webserver.
If i understand your question correctly you want to have the database on the tablet. That is possible, simply by installing the web and database server locally. Restrictions might apply depending on your tablet (OS) manufacturer though.
You could also have a "regular" web server / database server setup, and use the localstorage of your tablet's browser to have the result pages available in offline mode, and sync your data when possible, using php and maybe ajax scripts.
Since you don't want the presented data to be web-accessible (or at least not public), but you do want the presentation to be through HTML-pages, I can come up with two ideas:
Use a scripting language to access MS SQL Server, extract the data, and present it as HTML. Since you like PHP, maybe Perl with a suitable DB-access library might be a good idea.
PHP as you suggest, some kind of web-server, and a rigorous lock-down configuration so that the webserver is only accessible locally. Depending on the sensitivity of your data, this might be the worse option.
Enable Internet Information Server on your Windows system (using "Turn Windows Features on or off in the control panel) and install PHP: http://php.iis.net/
Alternatively Apache xampp installs the Apache webserver, MySQL (when wanted) and PHP on your system: https://www.apachefriends.org/index.html. To connect to Sql Server you have to remove the semicolon ; before the extension=php_mssql.dll line in the php.ini.

Accessing remote SQL Server database

I'm trying to access the mssql database of my website which a web design team has designed. They have given me the ip, port, db name, user and password... but how can I connect to the mssql server?
I have tried doing it via php but I think I have to compile php without "--without-mssql" "--without-pdo-mssql"... which I would not rather do on this windows 7 computer unless I have to.
I've tried SQL Server Management Studio Express but I couldn't find a way to access to a REMOTE database.
I've also tried Razor SQL but that did not connect either.
I almost tried something like phpmyadmin for asp.net but wanted to find an easier solution for this- without installing asp.net.
So what would be a good solution for managing a remote mssql database? Is there a program like Office Access that can handle such job?
SQL Server Management studio does support remote connections, in the small dialog you see in the middle of the screen when you run it, specify IP, username and password.
do you get any error? Which error do you get?
I am a fan of Navicat:
http://www.navicat.com/en/products/navicat_sqlserver/sqlserver_detail_win.html
However, I have not used the Sql Server version, but the MySQL and Oracle versions are pretty good - MySQL is awesome (mid range price point is the only draw back).
However Navicat Lite, which is still pretty good (and can handle most server types) is free!
Just a note, has the remote DB been setup for remote connections? If not you will not be able to get access no matter what you use.

Categories