How to connect a sqlite database in remote host - php

i have been in a problem to connect to a sqlite database in remote host. I have already gone through alot of research on this, it seems not possible, but using rest api (building web services) can solve this problem. I can't use web services to interact with DB for my application.
Additional details,
is it possible to use path as http://192.168.0.6/computer_a/computer_a.sqlite ?? I have tried this but not working
my code
$db = new SQLite3($comAdb) or die('Unable to open database');
$comAdb -> http://192.168.0.6/computer_a/computer_a.sqlite
Please help
Thanks

No. You have to give a path on a file system.
You could use cURL to download the database, save it locally and then access it.

Can you create a file system mapping to the remote directory, where the second database resides?
Then you can just use ATTACH

Related

External MySQL Database for a Website

Is it possible to create and use a MySQL database outside of my website host and link it to my website.
For example, using freehostia.com, my website is being hosted with one MySQL database to handle the WordPress Application installed. I want another database to use for SourceBans, and have it accessed at MyWebsiteName.com/bans, but freehostia.com only allows free users to have one database.
Is it possible to create another database somewhere else and use it on my website?
Yes, You can.
You can separate out your application server and the database server. But there are configurations that need to be done in order for such architecture to work. This is mostly done due to security and scalability.
Please kindly elaborate your requirement so that I can help you.
Other users already that yes you can, I want to show a simple approach on you gonna do it.
Simple when you are connecting to an external Database , you can use the mysql's server IP as your host when trying to connect using PHP.
For example in PHP:
$host = "192.182.0.124";
$use = "username"
$pass = "pass";
$db = "your db name"
$conn = new mysql ($host,$user,$pass,$db);
If your dababase is in the same server as your application, use localhost in $host or use the IP or host name of the database server if the server is external.
most PHP applications has a config file. database connection is mostly in the config file, for example, wp-config.php is the file WordPress use to store the database connection. Find out which file your php application is using to connect to database and change the database host to the IP of the external server.
Yes, it is pretty much possible and doable.

Connecting to an oracle database using web service

I have an android application that should connect to a database to retrieve some data to be shown on the screen.
The only method I know is to connect to mySQL using local host.
But how to connect to a real oracle database using the web service which is written in PHP.
Please help me since I didn't find any related information like this.
This is works for me in past, I hope its works for you too.
http://www.codeproject.com/Articles/112381/Step-by-Step-Method-to-Access-Webservice-from-Andr
http://www.c-sharpcorner.com/uploadfile/88b6e5/how-to-call-web-service-in-android-using-soap/

Remote connection to MongoDB server using Codeigniter

I am creating an API using MongoDB and Codeigniter. I want to connect to my database using an IP-address (not working) instead of using localhost (working fine). Because I need to have the MongoDB on a seperate server.
I tried to just change from localhost to the IP-address in the configuration file for the Codeigniter library but then I cannot connect.
I am using this Ci MongoDB library: https://github.com/alexbilbie/codeigniter-mongodb-library
How can I do this?
Perhaps you need more info to know what the problem is.
You may specify mongo_supress_connect_error CodeIgniter configuration variable to false to enable verbose output of connection problem error.
I am not a mongo db expert. But I could definitely say that you would need to use a host-name for the connections rather than using an ip-address.
The solution to the problem will be to add your remote server's ip address in the hosts file. In ubuntu, you could find it in /etc/hosts
edit like
10.xxx.xxx.xxx your-server-name
and save it
then you can always connect by replacing localhost with "your-server-name" (that you gave in hosts) in your syntax where you initiate your mongo db connection.
Guess this might not help you as you would have figured it out already. But might help someone who is searching for a similar question.

How can i ascertain database connection info for php mysqli from drupal files?

I have full access to ftp and even phpmyadmin remotely for a project but i am implementing a separate php module for site and I therefore need to connect to the database with mysql statements in php.
All I see in drupal files to connect with is a url.
I don't know drupal but I have a very good knowledge on php.
Help?
The URL ($db_url variable) in your sites/default/settings.php file is broken down like this:
protocol://username:password#server/databasename
You should be able to apply that to your own $db_url and get the connection details.

How do i connect my .php to phpmyadim?

I need help on creating a basic log-in page and registration page. I only know the basic stuff on php. And my boss told me to use the database he created online (phpmyadmin). So how do I connect the .php file I created to the online database? I have experienced connecting it to a database. But not the one that's online. Any help please? Thank you!
Firstly, PhpMyAdmin is not a database. It is a PHP based database admin tool to ease the management of databases so that you don't need to do the "boring" commandline interface stuff.
Assuming that it's actually just a MySQL database, then you can connect it using mysql_connect().
if you know how to connect it to the local database, it's always the same: you need a server address (localhost, IP or domain), database name, username and password.
read more here:
http://php.net/mysqli
http://php.net/mysql

Categories