I have a system with python 3.6 and I also alt installed 3.9.
I am using ibm_db and ibm-db_dbi packages and when I connect to DB using python3.6 connection works fine. But when I connect using python 3.9 it fails with:
>>> ibm_db.connect(dsn2, "","")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Exception: [IBM][CLI Driver] SQL1032N No start database manager command was issued. SQLSTATE=57019 SQLCODE=-1032
Even with ibm_db_dbi I get the same error. I verified the ssl certs and they are being picked up correctly.
dsn2 = 'DATABASE=MYDB;UID=db2inst1;PWD=XXXXXXXX;PORT=50001;PROTOCOL=SSL;HOSTNAME=myhost;SSLClientKeyStoreDB=/usr/local/python3.9/lib/python3.9/site-packages/component/rest/data/ssl'
No errors in diag logs. Any pointers to why is the connection not working? Is it looking for something in python3.6 which is missing in 3.9?
I have made an alt install of python3.9. So both 3.6 and 3.9 co exist. and I open python interpreter of different versions to run the command. OS is Centos. If I remove SSL from dsn connection works fine on 3.9 as well.
Related
With a SQL Server 2017 Server, using pip install we have sucess fully installed a python package. It has been running without issue for around 2 years. I am trying to get the same package installed on sql server 2019 using sqlmlutils
import sqlmlutils
connection = sqlmlutils.ConnectionInfo(server="server_name",database="database_name", uid="sa", pwd="XXXXXXXX")
sqlmlutils.SQLPackageManager(connection).install(package='PackageName',version='1.xx')
This installs the package and I can see that the package has been installed on the SQL Server.
However when I try and execute code using that package I get the following error;
Msg 39004, Level 16, State 20, Line 0
A 'Python' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 2, Line 0
An external script error occurred:
Error in execution. Check the output for more information.
Traceback (most recent call last):
File "<string>", line 5, in <module>
File "C:\ProgramData\XXX\Temp-PY\Appcontainer1\3A5D9F0F-2471-41C2-919A-9D9AAB5D199D\sqlindb_0.py", line 49, in transform
import Q as q
File "C:/Program Files/Microsoft SQL Server/MSSQL15.XXX/MSSQL/ExternalLibraries/8/2/1\Q\__init__.py", line 21, in <module>
from .Q import *
File "C:/Program Files/Microsoft SQL Server/MSSQL15.XXX/MSSQL/ExternalLibraries/8/2/1\Q\Q.py", line 13, in <module>
from . import _Q
ImportError: cannot import name '_Q' from 'Q' (C:/Program Files/Microsoft SQL Server/MSSQL15.XXX/MSSQL/ExternalLibraries/8/2/1\Q\__init__.py)
SqlSatelliteCall error: Error in execution. Check the output for more information.
There seems to be something fundamentally different in the way sqlmlutils works to pip install.
I have tried to change the premissions to allow both the server and the launchapd permissions to the Temp-PY directories, but no change in behavour.
Another issue that might be related - In another python script, I am trying output a PDF file to the c:\temp\ directory. I have change the permissions of the directory to allow the launcpad and server access to the directory, but still get the error 'Permission denied: 'c:\\temp\\sql_server_chart.pdf'.
This is very frustrating as it is a clean install on a new system.
Any help would be appreciated.
UPDATE: I installed the library using pip install on the SQL Server 2019 server and the package works correctly. This is definatly and issue with sqlmlutils.
I am new to python and oracle, I have written the code for the connection to oracle database 11g but it gives an error:
import cx_Oracle
con=cx_Oracle.connect('sys/Satyam123#localhost/xe')
con.close(
)
It gives the following error in pycharm:
C:\Users\DELL\venv\module2\Scripts\python.exe
C:/Users/DELL/Desktop/PYTHON/module2/check.py Traceback (most recent
call last): File "C:/Users/DELL/Desktop/PYTHON/module2/check.py",
line 2, in
con=cx_Oracle.connect('sys/Satyam123#localhost/xe') cx_Oracle.DatabaseError: DPI-1047: 32-bit Oracle Client library cannot
be loaded: "The specified module could not be found". See
https://oracle.github.io/odpi/doc/installation.html#windows for help
Please download and install Oracle Client. (There are several editions of Oracle Client, but the instant one will do):
http://download.oracle.com/otn/nt/instantclient/122010/instantclient-basic-nt-12.2.0.1.0.zip
Once it is installed, the cx_Oracle python module will look for the Oracle libs (OCI) and load them.
I had the same issue. Please follow the link https://oracle.github.io/odpi/doc/installation.html and install Oracle Instant Client 64-bit or 32-bit as per your system version. Once this is installed python would automatically be able to find Oracle Client libraries and you can successfully connect to the database.
It seems like,there is issue related to PATH.You can try to install package with the IDE terminal.In your case just try to install a package with pycharm terminal.
After that try to execute below script:
import cx_Oracle
import db_config
user="test"
pw="test"
dsn="localhost:port/TEST" #here TEST is service id
con = cx_Oracle.connect(user, pw, dsn)
cur = con.cursor()
cur.execute("select * from test_table")
res = cur.fetchall()
for row in res:
print(row)
Still having an issue then you can refer :
[https://oracle.github.io/python-cx_Oracle/samples/tutorial/Python-and-Oracle-Database-Scripting-for-the-Future.html]
I issue this statement: db = cx_Oracle.connect("user/pass#IP/BKTDW")
and I get this error:
Traceback (most recent call last):
File "", line 1, in
cx_Oracle.DatabaseError: Error while trying to retrieve text for error ORA-01804
It seems that connect method doen't work at all. I have installed the Oracle Client and I am connecting normally via Toad or Sql Developer.
Please Help!
I had to set the ORACLE_HOME variable in the system variables and also add the bin directory in the PATH system variable. THNX
Ensure that sqlplus is working from cmd line. It could be if on 64bit windows in has in PATH there is a target to non-64 bin version of oracle bin folder. In our case we ensured that 64bit location is placed in PATH . For instance place c:\Oracle\Ora11g_r2_x64\bin\ and remove c:\Oracle\ora11g_2\bin\, it was not related with ORACLE_HOME .
Setup Details:
1x EC2 running Ubuntu 14.04 with Postgres 9.3,
1x RDS running Postgres 9.3
I am trying to move a postgres database that I have on an EC2 onto an RDS. I am using Londiste, which is recommended by AWS for migrating databases with minimal downtime. Specifically, I am using Londiste/Skytools 2.1.13, because Londiste3 requires superuser privileges on both systems.
I have tried installing Skytools both via the zip from their website and via apt-get (both 2.1.13). I have installed what I believe to be all of the dependencies: postgres,libpq-dev, postgresql-server-dev-9.3, pip, and psycopg2.
Regardless, whenever I try to use any skytools commands, I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/pgqadm.py", line 9, in
from pgq.ticker import SmartTicker File "/usr/local/lib/python2.7/dist-packages/pgq/init.py", line 6, in
import pgq.consumer File "/usr/local/lib/python2.7/dist-packages/pgq/consumer.py", line 6,
in
from pgq.baseconsumer import BaseConsumer, BaseBatchWalker File "/usr/local/lib/python2.7/dist-packages/pgq/baseconsumer.py", line 75,
in
class BaseConsumer(skytools.DBScript): File "/usr/local/lib/python2.7/dist-packages/skytools/apipkg.py", line 114,
in __makeattr
result = importobj(modpath, attrname) File "/usr/local/lib/python2.7/dist-packages/skytools/apipkg.py", line 37,
in importobj
module = import(modpath, None, None, ['doc']) File "/usr/local/lib/python2.7/dist-packages/skytools/scripting.py", line
23,
in
default_skylog = skytools.installer_config.skylog
AttributeError: 'module' object has no attribute 'skylog'
Am I missing a dependency? (Skylog seems to be a part of skytools, so I've concluded it's not that.) Has anyone else hit this issue? (There don't seem to be any google results with this error.) Thanks!
tl;dr:
make sure you're running pgqadm.py that is in your local skytools-2.x.y installation directory, eg: ./python/pgqadm.py ticker.ini install
This can be a problem if you have previously installed Skytools 3.x, which may come up first in your PATH.
Background
I just ran into this same issue. I have the same use case (migrating pg->rds), and followed the same recommendation from the AWS documentation.
I had initially installed Skytools 3.x before noticing that it requires superuser privileges on the would-be replica. which pgqadm.py returns /usr/bin/pgqadm.py, which is an artifact of my abandoned Skytools 3.x installation.
I became suspicious of a version conflict when I went to the Skytools source repository looking for instances of skylog. The first result was here:
https://github.com/pgq/skytools-legacy/blob/11afc5210a92d4a2ccf701e4f92138488c31a3cb/python/skytools/installer_config.py.in
However, I realized that this repository is now tracking the latest 3.x release. I switched to the apparent 2.1.x branch, and skylog was nowhere to be found, as expected:
https://github.com/pgq/skytools-legacy/blob/skytools_2_1_stable/python/skytools/installer_config.py.in
Fully-qualifying the path to pgqadm.py resolves this issue in this case.
I am trying to deploy mercurial under Ubuntu 8.04.
Mercurial packages were installed correctly, but when I've configured http interface I always get 500 error.
I enabled outputting debug info to error.log and got:
mod_wsgi (pid=21159): Exception occurred within WSGI script
'/home/hg/rep/hgwebdir.wsgi'.
Traceback (most recent call last):
File "/home/hg/rep/hgwebdir.wsgi", line 67, in <module>
wsgicgi.launch(application)
File "/var/lib/python-support/python2.5/mercurial/hgweb/wsgicgi.py", line 64, in launch
result = application(environ, start_response)
TypeError: 'hgwebdir' object is not callable
My desktop is with Ubuntu 10.04, and home server with ubuntu 9.10, and configuration is the same, and works like a charm.
I compiled python 2.6, and in hgwebdir.wsgi put path to this library -
import sys
sys.path.insert(0, "/path/to/python/lib")
But it doesn't work anyways.
What shall I do??
Thanks.
Which version of mercurial are you using? If you're still using the 1.0.x that ubuntu ships update to the PPAs from launchpad: https://launchpad.net/~mercurial-ppa/+archive/stable-snapshots
In 1.6 hgwebdir has been renamed to just 'hgweb' which will alter your config slightly.
Also what are you using the launch the wsgi stuff? Apache?