I haven't been able to find any documentation regarding whether it's possible to access SQLITE3 (using Python) when the SQLITE database is hosted externally:
I have my SQLITE3 database hosted on my VPS (alongside some other stuff that doesn't really matter) - rather than having it as a local file with my Python program.
Therefore, is it possible for me to connect to the SQLITE database which is hosted on my VPS, or will the SQLITE DB have to be hosted locally for me to be able to do this?
The reason I want it to be accessible from my VPS is because I want to be able to run the program on multiple computers and them all have the same access to the database- if this isn't possible, are there any other options which would allow me to do this?
If you want to have a database server with external, possibly remote, applications interacting a client-server protocol switch to PostgreSQL, MariaDB, etc.
see: How to connect to SQLite3 database server?
Related
I have built an app that uses mysql database with Python, I would love to share some functionalities with different applications and that calls for an online database feature, kindly give me some insights over how i can move a python mysql database to online and how to make calls to it in order to facilitate for sharing of data between different applications.
I don't exactly know what you are calling a python database but there are some options here that you might want to consider
First, use heroku to host your app and heroku postgress to host your databaseOr you can use an EC2 aws machine to host your app and it's database (in case it's a custom code that you can't call from a browser using heroku)with both of these options you can access you database and the appp with the second one you can install other services such as ssh and other.
Yesterday, I installed an apche web server and phpmyadmin on my raspberry-py. How can I connect my raspberry-pi to databases in phpmyadmin with python? Can I use MySQL? Thank, I hope you understand my question and sorry for my bad english.
Your question is quite unclear. But from my understanding, here is what you should try doing: (Note: I am assuming you want to connect your Pi to a database to collect data and store in an IoT based application)
Get a server. Any Basic server would do. I recommend DigitalOcean or AWS LightSail. They have usable servers for just $5 per month. I recommend Ubuntu 16.04 for ease of use.
SSH into the server with your terminal with the IP address you got when you created the server
Install Apache, MySQL, Python, PHPMyAdmin on the server.
Write your web application in any language/framework you want.
Deploy it and write a separate program to make HTTP calls to the said web server.
MySQL is the Database server. Python is the language that is used to execute any instructions. PHPMyAdmin is the interface to view MySQL Databases and Tables. Apache is the webserver that serves the application you have written to deal with requests.
I strongly recommend understanding the basics of Client-Server model of computing over HTTP.
Alternatively, you could also use the approach of Using a DataBase-as-a-service from any popular cloud service provider(Eg., AWS RDS), to make calls directly into the DB.
I have the following setting:
a restricted system that contains SQLite database and is able to use python.
a usual PC-system.
My aim is to write an application (preferable JAVA) for the PC-system to connect to the SQLite databse on the remote System to read, alter, etc. tables. Unfortunaetly I'm not able to install a Webserver on the remote system because system restrictions deny this intention. So i have been asking myself if it is possible to connect to the database anyway?! I thought of something like a Python connection wrapper, that redirects all database calls. Hope someone can give me a hint for solving this problem.
SQLite is not "db server" but "db file". You can't connect remotly to it because it is not server (you had to write own server). You can copy file with data to another computer and use it but you get two seperated databases. If you can share (in network) folder with that file you can use it on all computers - but there can be problem with concurent writing. SQLite is not designed to work with many users at the same time.
We have a Web Server in our company and create a MySQL Server on OpenShift.
We need to use Python to access the database server without rhc port forward,
Can we have others way to access MySQL on OpenShift directly?
thanks
You can access the gear directly just as you would any other Database not housed on OpenShift.
When you created the MySQL cartridge you should have been given a connection string:
mysql://OPENSHIFT_DB_GEAR_DNS:OPENSHIFT_DB_PORT/...
You can use that provided connection string and authentication to access the application.
Note: These strings above are environment variables on the gear, and will typicaly translate to something like:
mysql://app-namespace.rhcloud.com:55582/
This can be used from outside of the gear by other applications to access the database that is hosted on OpenShift.
Note: The OpenShift forums have lots covering this topic.
I'm pretty new to Python but have been running a few programs locally using Komodo edit, and then uploading the results manually to my website's MySQL database.
I'm looking into letting Python do this on it's own, but as i understand it i have to open my MySQL database to anyone regardless of if they are running scripts on my server or not if I'm to do this.
I'm guessing this is due to with security reasons, but i don't know how vulnerable this can make my site? Is it a bad idea to do it this way, or would it be better to run my python program from the server itself? (I've never run python code from my server, and my python code too, might be insecure)
If you have a access to the entire server (i.e. not just the hosting directory as is common on some shared hosting setups), and can ssh into the server, then your safest (though not easiest) option is to place the script on the server outside of the web hosting folder. This will stop anyone from remotely accessing the script, and will let you connect to the db without enabling remote connections.
You could enable remote connections if your hosting server set up allows it (not sure if any hosting companies disable, or prevent it, though you may have to enable it from the start when you create the database) Just select a nice strong password. Then you can use your script locally, and you'd be as secure as your password.