cx_Oracle fail to connect to one database using different machine - python-2.7

I am trying to connect to ORACLE database using cx_Oracle with python.
Code shown below. Same code able to connect to target database while running on a pc, however not able to connect using a server.
Error message: ORA-12545: Connect failed because target host or object does not exist
Since it can be connected use other pc, I think should not be the password or service name wrong.
The server having issue connecting to the database is a linux, with cx_Oracle installed, and ORACLE_HOME, LD_LIBRARY_PATH defined.
Any one can give a hint on what might goes wrong?
code used
dsn_tns = cx_Oracle.makedsn('Host Name', 'Port Number', service_name='ServiceName')
conn = cx_Oracle.connect(user=r'UserName', password='Password', dsn=dsn_tns)
c = conn.cursor()

Found out it was due to network access issue.

Related

(django) [Errno 11001] getaddrinfo failed [duplicate]

File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args) gaierror: [Errno 11004]
getaddrinfo failed
Getting this error when launching the hello world sample from here:
http://bottlepy.org/docs/dev/
It most likely means the hostname can't be resolved.
import socket
socket.getaddrinfo('localhost', 8080)
If it doesn't work there, it's not going to work in the Bottle example. You can try '127.0.0.1' instead of 'localhost' in case that's the problem.
The problem, in my case, was that some install at some point defined an environment variable http_proxy on my machine when I had no proxy.
Removing the http_proxy environment variable fixed the problem.
The problem in my case was that I needed to add environment variables for http_proxy and https_proxy.
E.g.,
http_proxy=http://your_proxy:your_port
https_proxy=https://your_proxy:your_port
To set these environment variables in Windows, see the answers to this question.
Make sure you pass a proxy attribute in your command
forexample - pip install --proxy=http://proxyhost:proxyport pixiedust
Use a proxy port which has direct connection (with / without password). Speak with your corporate IT administrator. Quick way is find out network settings used in eclipse which will have direct connection.
You will encouter this issue often if you work behind a corporate firewall. You will have to check your internet explorer - InternetOptions -LAN Connection - Settings
Uncheck - Use automatic configuration script
Check - Use a proxy server for your LAN. Ensure you have given the right address and port.
Click Ok
Come back to anaconda terminal and you can try install commands
May be this will help some one. I have my proxy setup in python script but keep getting the error mentioned in the question.
Below is the piece of block which will take my username and password as a constant in the beginning.
if (use_proxy):
proxy = req.ProxyHandler({'https': proxy_url})
auth = req.HTTPBasicAuthHandler()
opener = req.build_opener(proxy, auth, req.HTTPHandler)
req.install_opener(opener)
If you are using corporate laptop and if you did not connect to Direct Access or office VPN then the above block will throw error. All you need to do is to connect to your org VPN and then execute your python script.
Thanks
I spent some good hours fixing this but the solution turned out to be really simple. I had my ftp server address starting with ftp://. I removed it and the code started working.
FTP address before:
ftp_css_address = "ftp://science-xyz.xyz.xyz.int"
Changed it to:
ftp_css_address = "science-xyz.xyz.xyz.int"

Difficulty in configuring the database for domain connection repository during server installation

the error i m gettingenter image description hereMy intention is to have ORACLE 12 + Informatica on my local system.
I have installed Oracle and it is working fine. While I am trying to run SERVER INSTALLATION for INFORMATICA, I am having difficulty with configuring the database for domain connection repository. The connection is failing even though I am giving correct oracle credentials which are as below:
DB USERID: infadmin
JDBC URL:localhost:1521
Service: orcl
My questions is:
Why is it failing? Do I have to do anything special before trying this connection like installing any special jdbc drivers or something?
Your replies are much awaited.Thanks in advance.
Vaibhav Gautam
Check the contents of the tnsnames.ora file located at <Oracle Installation Direcotry>/network/admin. Make sure that the hostname, port no., service name matches exactly.
Also, make sure the oracle service is running.

Pentaho DI can't connect to AWS Redshift - Amazon Error 100021

Referring to Pentaho's Doc, we should be using RedshiftJDBC4.jar instead of version 4.1. I have downloaded the driver and placed it in the lib/ directory. Relaunched spoon.sh and I noticed it is no longer complaining about not able to find the com.amazon.redshift.jdbc4 class driver as I was using the 4.1 driver earlier. However, it still could not establish the connection.
Error connecting to database [aws_redshift] :
org.pentaho.di.core.exception.KettleDatabaseException: Error occurred
while trying to connect to the database
Error connecting to database: (using class
com.amazon.redshift.jdbc4.Driver) Amazon Error setting
default driver property values.
Can anyone help on this?
On the flip side, I can connect to my endpoint using SQLWorkbench/J, a SQL client tool.
Somehow I managed to get it working. It seems that downloading AWS Redshift drivers version 4, 4.1, or 4.2 and placing them in the lib/ directory did not work for me for each version by choosing Redshift as connection type (in Database Connection setup).
Instead, I chose PostgreSQL using JDBC. In host name field, I included the endpoint WITHOUT port number 5439 at the end. So, the endpoint should just end with ...amazonaws.com. Fill in database name, port number of 5439, and username and password. If this did not work, try downloading the latest PostgreSQL JDBC driver and placing it in lib/ directory and try again.

How to interact with database file by c++

I am new to database programming.
I am trying to make an application that interacts with a database file locally so that I can use those database query.
I tried to use mySQL connection c++ 1.1.6, and run this example.
Following error is what I get:
MySQL server on '127.0.0.1' <10061> <MySQL error code: 2003, SQLState:>
I guess that I need to have a server on for connecting. What I want is just an interaction with a database file locally, do I need to make this connection also? If I really need this connection, how to make it works?

Connect Qt to a Database

I've been trying really hard for the past few hours to connect my Qt software to a MySQL database that I've hosted using a website that hosts small MySQL databases for free. I can connect to it using phpMyAdmin, but I'm really having trouble getting my software to connect to it.
This is the error message:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified QODBC3: Unable to connect".
Can somebody explain to me what this means, and how to fix it?
You need to headers, libraries & client dll from MySQL
Compile Qt/MySQL driver
Provide path to mysql client library in PATH environment