How to connect my app with the database server - python

I made a program with using sqlite3 and pyqt modules. The program can be used by different persons simultaneously. Actually I searched but I did not know and understand the concept of server. How can i connect this program with a server. Or just the computers that have connections with the server is enough to run the program simultaneously?

Do u want to connect to sqlite database server? SQLite Is Serverless. It stores your data in a file.
U should use maria db for db server. Or u can store your sqlite database file in a network shared drive or cloud or...

Related

is mysql connector module can run in another pc

first of all, sorry for this dumb question.
secondly, this is the scenario, i made executable file from python, my app need to connect to mysql database, in my app script is using mysql.connector.
thirdly, what i want to know, is my app can run and connect to mysql database in another pc that does not have mysql driver installed? *because of poor resource, right now i can't just try and find out my self.
if it can't, can i using sqlite and then all the pc client data saved in 1 file database that place in shared folder, so 'admin' can read it anytime?
thank you so much

Google Cloud, Server For Database

I'm trying to use Google Cloud to store a MySQL database online which I can make requests to from my device in Python. I've established the connection with the database but I'm not sure where to go from here? Is it now 'saved' on the server, how would I go about accessing it from, say, a normal python module? Beginner in case it wasn't obvious.

How to use django with sql server database from other server?

I'm planing to built an app using Django with SQL Server. But I'm going to develop the app in my computer but the database is already exist in other computer/server.
How can I connect to that database in the other server and connect the Django which is in my computer? They are separate computers.

Run MySQL Server in Python

So I've been looking all over the internet and only found resources/tutorials on how to connect to a MySQL server but my question is, how do you host a MySQL server both on Windows & Linux?
I am not quite sure what you are asking but if the question is how to run a database for python independent of the OS, consider using sqlite.
From the link (emphasis mine)
SQLite is an embedded SQL database engine. Unlike most other SQL
databases, SQLite does not have a separate server process. SQLite
reads and writes directly to ordinary disk files. A complete SQL
database with multiple tables, indices, triggers, and views, is
contained in a single disk file. The database file format is
cross-platform - you can freely copy a database between 32-bit and
64-bit systems or between big-endian and little-endian architectures.
These features make SQLite a popular choice as an Application File
Format. Think of SQLite not as a replacement for Oracle but as a
replacement for fopen().
So it allows you to use a database from your python code without the hassle of running a server or setting something up locally.
Note that sqlite can also be stored in-memory if you want to avoid writing to disk.
Unless you have a very specific reason to start the server from Python, I.e. you want to be able to programmatically do stuff you wouldn't do from the command line, I think the best you could do is to install an instance of Mysql server in your local machine, run it and then, you'll be able to connect to it from Python.
Bear in mind that your local installation of Mysql will be running on localhost (127.0.0.1)

How to efficiently save data to a remote server database (python)

Currently in my code, there are a few client machines doing processing and one server machine with a database. After an individual client machine finishes processing some data, it saves the data to a .txt file and sftp's it over to the server.
The server has a job that just waits for these txt files and stores the data into a database.
I wanted to know of any other efficient processes for this, kinda a python beginner. Is there a way to remotely save data into the database of the server? How to do so securely, etc?
To be more specific, this project is a webapp hosted in django. I know how to use django's standalone scripts to save data into a db, just preferably need to know how to do so remotely.
Thank you.
Django databases can be remote - there is no requirement they be on the same host at the django server. Just set an appropriate HOST and PORT. See: https://docs.djangoproject.com/en/dev/ref/databases/#id10
Update: Based on your comment, I understand that you want to write python/django code that will run in the browser, and connect to a remote database. There is no practical way of doing this. Have the data sent back to your server, and forward it on from there.
Update 2: If you are able to distribute software outside of the browser, you could have a small django deployment on each client computer, which the user connects to through their browser, which could connect directly to the database. Obviously, security considerations apply.

Categories