NW.js, php-webkit, sqlite3 - node-webkit

I am researching converting a php/mysql web application I have, into a stand alone desktop application using NW.js (node-webkit), php-webkit, and a sqlite3 db in place of Mysql.
I have successfully installed all the necessary components to establish a sqlite3 connection and retrieve values from the database using similar examples to the ones found here:
https://www.npmjs.com/package/sqlite3
The sqlite connection and retrieval of data works fine via the javascript examples.
Although when I try to connect to the same database from one of my PHP pages, no results are produced.
Is it not possible to connect to and retrieve info from my sqlite3 db from the PHP pages within a Node Webkit project running php-webkit? Has anyone successfully accomplished this, or is what I am trying to do essentially not possible?

I am the author of php-webkit. PHP is packaged with a copy of sqlite and php-webkit works with this. If you are having issues make sure the copy of PHP you included has the sqlite extension and sqlite enabled in your PHP.ini. Connecting to a stand alone copy of sqlite should be possible with the sqlite PHP extension. Here are some examples of connecting to sqlite from php.

It seems that it is not planned to access the db through php-webkit. What you can do is access the db through javascript and put the values in the desires divs that you created with php.
<?php
echo '<div id="insert">';
echo '</div>';
?>
And then use jquery or javascript to insert something that you got form the db.
var db = openSQL(); //method to open a connection to SQLITE
db.serialize(function() {
db.each("SELECT input FROM table", function(err, row) {
$('#insert').append(row.input);
});
});
db.close();

Related

How to Upload .xls Files into Oracle DB using PL/SQL only

I'm fairly new to using DBs and have been tasked to create an automated process that uploads Excel-Files into a Oracle Database.
I was told that the User should put the files into a dedicated folder and then a process should automatically upload the files. After checking Stackoverflow and the Internet, however it looks to me like there is no way to do the upload with just PL/SQL.
Do i need to use other external tools to achive this or am i just looking the wrong way?
The reason i want to do it with just PL/SQL is that i don't have sys rights on the server or a way to install any tools right now.
You can upload CSV files stored in a folder using SQL Loader directly into Oracle Tables. But you need to have those files stored as CSV not XLS and transfer them to a folder in a server which contains at least an Oracle client. In this case, your user should save the files as csv, and then you must have a pick up process to move them to a server where you can run the sql loader process.
However, if you want to keep using Excel, and you have no option to move the files, Oracle Application Express which is free and included with Oracle Database contains a plugin to upload directly and automatically excel files into tables. You would have to create a small application in Apex with a page for doing this. It is totally out-of-the-box and quite easy. If you use Apex 18c or higher, it is there. If you use Apex 5.1.4 you need to install a plugin. In this case, the user is responsible to upload the excel file by the web apex application, or you can use the API APEX_DATA_PARSER package for doing so without manual intervention. However, keep in mind that if you use the API, you need to have the files accessible for the database.
Apex Data Parser 19c
Let me know if you have more doubts about it.
Regards

How to store data from iOS app in a remote database safely and Apple friendly?

How would one go about incorporating, for example a 'mailing list' where user could fill in a text field for 'name' and 'email address' and click a submit button that would add the data to a database on a remote server.
Property lists would be the most convenient but the whole plist would need to be downloaded to the users device, modified and reuploaded (which looks involved and easily corrupted). SQLite is likewise built for a local database. Is there a simple way to do this or is server side php scripting the only real answer?
I see a lot of replies about this question that specify a specific database type and programming solution. The real solution is a web service, of any kind, and a data store, of any kind.
This could be SQL Server with a web service written in ASP.NET. It could also just as easily be a MySQL database with an interface written in PHP. But for the love all things secure don't try to attach to a database directly.
It would appear the most practical method at this time is a remote MySQL (or similar) database queried from php scripts that are called from the app via NSURLRequests (. Information about the query can be sent using the _POST variable.

Creating a local SQL database file?

Please note:
I am a game programmer, so backend development isn't my forte. There are times, however, where I work with our database at my job. Please don't shoot me if my question is ridiculous.
Is there a way to create a local mySQL file and access it through PHP or C#?
I know you can make a local webpage on your machine (pretty much for testing purposes) and access multiple locally created files.
I assume that something similar would work with mySQL. (Are the login credentials also stored within the file?) I remember seeing a few online tutorials where it offered a download for both PHP and the database file, but I can't seem to find them now.
I've searched for this, but all the relevant results involved downloading mySQL and hosting a server which is a bit more than I wanted to do.
So if its possible to create a local mySQL, how do you do so?
The tools I intend on using while doing this:
PHP/JQUERY/HTML and C#
For MyISAM tables, inside the MySQL data directory there is one directory per database which contains several (usually three) files per table. For InnoDB tables, they are all contained in several files directly inside the data directory.
The location of the MySQL data directory is usually set in my.cnf using the datadir parameter.
The login credentials are stored in a special database called "mysql" which is in that data directory like any other database.
However, you have to install and run MySQL to access those files. You cannot access them with PHP or any other client API alone. If you want to do such a thing, better use SQLite.
MySQL is a database engine, u need to install that before you can use it. Unlike SQLite which stores it's database in files. Maybe that is something more of your liking. And I know there are library that supports SQLite for PHP, not sure about the rest.
SQLite you don't need to install anything.
MySQL can be used an an embedded database, but you will need to contact them in order to purchase a copy of it.

Pulling Data From an SQL Database in HTML 5

I am trying to develop a BlackBerry application that will show data from an SQL Database from a server. I was researching the new HTML 5 option for blackberry (WebWorks) and noticed that it apparently cannot connect to any server data by itself. Some links state that I would need javascript coding to obtain it. I looked into the option of PhoneGap (link here: http://phonegap.com/) and decided I'd try using HTML 5 to produce the application. I have never touched SQL databases before and I am wondering how I would connect the two; meaning how do you pull data from the server given that you are working with HTML5?
I have looked at:
Where is data stored when using an HTML 5 Web SQL Database
Process for pulling data from a sql database
among others but I am still unsure as to what to do. I would be looking to "view" the data from the server and display it on the app. It would be something of the sort:
- HomeScreen: What data would you like to view?:
- Dropdown list of categories (from the database)
- Selecting Entry in dropdown leads to available information (from the database)
Any help would be appreciated, and of course thanks in advance.
the new (and pretty awesome) features of HTML5 is happening in the browser on the client side. What you will need is a back-end on the server side doing some magic. It is true that browsers now have databases but these are located on the phone, computer etc and as I understand your question you want these data to communicate with data on your server. To move data across the web you will need to perform HTTP-requests which can easily be done through javascript and ajax. Look a bit into these technologies and make a little server-side script that gathers data from the database and send it in a structured format to the phone (JSON, XML), then make a script in javascript on the client-side that parse these data and utilise them.
Good luck!

querying database in android

I am building an android app and I have an SQL database stored on a server. I need to either pull the database into android or query the database and have it return information from the tables. I have searched all over the internet but I haven't found anything that explains how to connect to the server from android. How can I do this?
You can't query database in a server from android directly. You have to write PHP scripts to query database from server. You have to keep the php scripts in a web server. And from android application you have to get the data from the php page.
I don't think there is a reasonably simple way to 'pull' the database or connect to it using some soft of ODBC connection. And I don't think it would be wise to use it even if possible.
I believe the best way to solve your problem would be to implement some sort of REST API interface to your database and fetch data as needed.
actually, despite gypsicoder's answer and several "how to"s on the internet, there is a way to connect/query an SQL database from android
you just have to download the corresponding JDCB. for mysql: http://dev.mysql.com/usingmysql/java/
then you just use the java.sql interfaces/classes to do stuff (mysql has a reference manual at above link)