How to call a python script from MySQL DB (iOS) - python

I have an iOS app that is connecting to a MySQL db. At one point I am authenticating the users information. Doing some research informs me that the safest way to do this is by doing so server side. How would I go about calling a python script from MySQL and returning it?

Related

Do I need to install MySQL Server on client machine, the database is used (Read, Write, Delete) by Python script I wrote?

I have written a python script that uses the MySQL Connector for Python to read, write and update the database. Do I need to install MySQL server on the client machine (Windows) too to run the program or do I just need to make sure that the database is present in the path used by the script? I tried finding guidance on Google and here but couldn't find what I needed.
No you don't need to install MySQL Server on a client machine. By definition client machine means you don't have the DB/Server there. Where is this DB allocated? You show have an IP or a domain/subdomain address where the DB is actually hosted.

How to connect oracle database in python irrespective of operating system

I'm trying to write a python script using cx_oracle module for perform oracle database connection. But during the execution, I found it needs oracle instant client to establish a connection. Currently, I'm developing the script in ubuntu but there is a chance to run the same in windows. So I'm confused about the implementation. Could someone please suggest the best way to connect oracle database irrespective the platform
You will always need an OS-specific library or client of some kind. Either the Oracle Instant Client or a Java JDK/JDBC library or both. If you want OS-independence then you would need to interact with the DB through REST calls or something like that instead of making a persistent connection. Otherwise you have to interact with the OS networking stack at some point, which requires OS-specific libraries.

How to enable detailed database connection logging?

Our DBA is trying to migrate a Django application's database to a new backend host running Oracle 12. When I put that host's info in the Django settings.py file, I get this error:
DatabaseError: ORA-28547: connection to server failed, probable Oracle Net admin error
The DBA has asked for my help in solving this problem. Is there a way to turn on detailed logging in Django while establishing a database connection? I've seen directions for enabling logging of database queries, but we're not getting that far -- our error is happening sometime during the connection.
Basically you can use a Wireshark or any sniffing tool to check what is the connection string passed to the DB.
But this oracle error will occur when there is an error after the initial handshake to the Oracle DB and further establishing a connection.
Check you oracle_cx for python and the oracle instant client whether the insta client is of the correct version to the DB. Try a connection form instantclient directly to the DB using sqlplus.
Reference:
django docs
DBA forum
django community

Python connection to server and interact with database

I have question how can I connect to VPS server and interact with MySQL database using python on my local machine.
I would like to make program using PyQT that connect to my server and update, take sth from db.
I know that there is MySQLdb module but from what I know i cannot connect to VPS server, because in connect method it doesn't take server password argument.

Creating a Connection Between MySQL and Tornado

I am trying to get a Python and Tornado environment up and running.
As of now I am able to execute Python scripts and now I am trying to be able to make use of databases as well.
By my understanding Tornado has a MySQL wrapper, and I as of now I have XAMPP installed and I would like to continue using PhpMyAdmin as the GUI for MySQL.
The question I am having is how can I create a connection between MySQL and Tornado?
So that when you use a connection command Tornado will connect to the right MySQL installation and databases, which I of course created with PhpMyAdmin?
From Tornado's documentation:
db = database.Connection("localhost", "mydatabase")
Once you instantiate a connection ( named db in this example ), you can reuse it during your server's lifetime..
If you need to change it dynamically while your tornado server is running, then have tornado "listen" to a specific url_pattern, handled by the appropriate web.RequestHandler, which receives as (GET or POST) arguments your MYSQL connection parameters (host, database, user etc..) and creates a new database connection.
Edit
In newer versions of tornado (>=3.0) the tornado.database module has been removed. It is now available as a separate package, torndb.

Categories