I'm quite new to Python (using Python 3.6.5) and I need to create a connection to a database, and I do it in Access with the ODBC Driver (I guess?), but for some reasons I just can't install pyodbc here, so I need to do this connection without it. Is there a way to do it?
I'm sorry if there's not much details about it, but I can try to check anything if needed.
Edit - I don't think it's the point here to solve the fact that I can't get the use pip to install, since I know why it isn't working, but here is the print from the log of pip:
Related
I'm trying to connect to an oracle database via the cx_Oracle python library but am getting the error message "ORA-12571: TNS:packet writer failure".
My connection logic currently looks like this:
import cx_Oracle as cOr
cOr.connect("USER_NAME/USER_PASSWORD#HOST_NAME:PORT/SERVICE_NAME")
My program is running on the WSL2 environment on a windows10 machine, so somehow I think this is where the trouble originates from. The python version I'm using is 3.6.9, cx-Oracle is 8.2.1 and this instant client necessary for the cx-Oracle is in version 21_1.
I found for example this article here https://support.microfocus.com/kb/doc.php?id=7018259 on this topic. Yet all the checks they mention there succeed for me, so it shouldn't be, that the target is simply not reachable from my system.
Also just using the Oracle SQL developer from the Windows part of the machine with the same data is working just fine.
I'm a bit out of ideas of what to do on this topic and hope for somebody to maybe give me a good hint. If there is any additional information you need from me I'll gladly provide it.
I am trying to deploy Django based website on AWS EC2. I have successfully created an instance and install my python libraries there. I am using Postgres here. For that, I have installed Postgres along with pgAdmin, but for some reason, it does not open. It just displayed that it's starting up the server but it does not open at all.
I am new to it so I do not know much about it. Can someone please help or guide me why it does not open up?
You will need to check the logs from
C:\Users\Administrator\AppData\Local with name - 'pgadmin4.startup'
A lot of the time removing the instance and recreating usually works but without seeing the logs it's hard to tell what the issue might be. Could also be worth making the instance a bit beefier as pgadmin does use a good amount of CPU and memory.
Is there a way to query a netezza database without explicitly installing its driver? I am using ubuntu 64 bit OS, our IT support says the driver they have only works on red hat systems.
If you can get your hands on the JDBC driver, you could use the Python, jaydebeapi module, with the driver to connect to the server. Note that there are a couple quirks involved. Namely things like boolean datatypes.
You can use pyodbc.
pyodbc is an open source Python module that makes accessing ODBC
databases simple. It implements the DB API 2.0 specification but is
packed with even more Pythonic convenience.
On Ubuntu systems, all you need to do is run
sudo apt install unixodbc-dev
before attempting
pip install pyodbc
See more details from Installing pyodbc.
im working on python application that requiring database connections..I had developed my application with sqlite3 but it start showing the error(the database is locked).. so I decided to use MySQL database instead.. and it is pretty good with no error..
the only one problem is that I need to ask every user using my application to install MySQL server on his pc (appserv for example) ..
so can I make mysql to be like sqlite3 apart of python lib. so I can produce a python script can be converted into exe file by the tool pyInstaller.exe and no need to install mysql server by users???
update:
after reviewing the code I found opened connection not closed correctly and work fine with sqllite3 ..thank you every body
It depends (more "depends" in the answer).
If you need to share the data between the users of your application - you need a mysql database server somewhere setup, your application would need to have an access to it. And, the performance can really depend on the network - depends on how heavily would the application use the database. The application itself would only need to know how to "speak" with the database server - python mysql driver, like MySQLdb or pymysql.
If you don't need to share the data between users - then sqlite may be an option. Or may be not - depends on what do you want to store there, what for and what do you need to do with the data.
So, more questions than answers, probably it was more suitable for a comment. At least, think about what I've said.
Also see:
https://stackoverflow.com/questions/1009438/which-database-should-i-use-for-my-desktop-application
Python Desktop Application Database
Python Framework for Desktop Database Application
Hope that helps.
If your application is a stand-alone system such that each user maintains their own private database then you have no alternative to install MySQL on each system that is running the application. You cannot bundle MySQL into your application such that it does not require a separate installation.
There is an embedded version of MySQL that you can build into your application (thanks, Carsten, in the comments, for pointing this out). More information is here: http://mysql-python.blogspot.com/. It may take some effort to get this working (on Windows you apparently need to build it from source code) and will take some more work to get it packaged up when you generate your executable, but this might be a MySQL solution for you.
I've just finished updating a web application using SQLite which had begun reporting Database is locked errors as the usage scaled up. By rewriting the database code with care I was able to produce a system that can handle moderate to heavy usage (in the context of a 15 person company) reliably still using SQLite -- you have to be careful to keep your connections around for the minimum time necessary and always call .close() on them. If your application is really single-user you should have no problem supporting it using SQLite -- and that's doubly true if it's single-threaded.
I'm writing a script to parse some text files, and insert the data that they contain into a mysql database. I don't have root access on the server that this script will run on. I've been looking at mysql-python, but it requires a bunch of dependencies that I don't have available. Is there a simpler way to do this?
I would recommend the MySQL Python Connector, a MySQL DB-API adapter that does not use the C client library but rather reimplements the MySQL protocol completely in pure Python (compatible with Python 2.5 to 2.7, as well a 3.1).
To install C-coded extensions to Python you generally need root access (though the server you're using might have arranged things differently, that's not all that likely). But with a pure Python solution you can simply upload the modules in question (e.g. those from the Connector I recommend) just as you're uploading those you write yourself, which (if you of course do have a valid userid and password for that MySQL database!-) might solve it for you.