Connecting to teradata from ubuntu 14.04 - odbc

After following the instructions from http://crashthatch.tumblr.com/post/66957708538/teradata-odbc-connection-using-python-on-ubuntu, installed 15.00.05.14 version of teradata odbc version.
>>> import pyodbc
>>> pyodbc.pooling = False
>>> pyodbc.connect('DRIVER={Teradata};DBCNAME=teradata.xx.xxx.com;UID=myname;PWD=pwd;QUIETMODE=YES;')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pyodbc.OperationalError: ('HYT00', '[HYT00] [Teradata][Unix system error] 110 Socket error - No response received when attempting to connect to the Teradata server (110) (SQLDriverConnect)')
$ odbcinst -j
unixODBC 2.2.14
odbcinst: symbol lookup error: odbcinst: undefined symbol: odbcinst_system_file_name
$ python -c "import pyodbc; print pyodbc.version"
3.0.6
what should be the workaround for this problem?

Check if the Teradata machine is reachable via the network.

Related

Install CDH 6.0.1 have trouble with install cm-agent

with cloudera install doc step by step I have in trouble with Install Agents
like this:
It said install failed and can not receive signal.
And I find the log like this:
[13/Nov/2018 16:44:19 +0000] 4306 MainThread agent ERROR Heartbeating to ryze-1.bigdata.com:7182 failed.
Traceback (most recent call last):
File "/opt/cloudera/cm-agent/lib/python2.7/site-packages/cmf/agent.py", line 1371, in _send_heartbeat
response = self.requestor.request('heartbeat', heartbeat_data)
File "/opt/cloudera/cm-agent/lib/python2.7/site-packages/avro/ipc.py", line 141, in request
return self.issue_request(call_request, message_name, request_datum)
File "/opt/cloudera/cm-agent/lib/python2.7/site-packages/avro/ipc.py", line 254, in issue_request
call_response = self.transceiver.transceive(call_request)
File "/opt/cloudera/cm-agent/lib/python2.7/site-packages/avro/ipc.py", line 483, in transceive
result = self.read_framed_message()
File "/opt/cloudera/cm-agent/lib/python2.7/site-packages/avro/ipc.py", line 489, in read_framed_message
framed_message = response_reader.read_framed_message()
File "/opt/cloudera/cm-agent/lib/python2.7/site-packages/avro/ipc.py", line 417, in read_framed_message
raise ConnectionClosedException("Reader read 0 bytes.")
ConnectionClosedException: Reader read 0 bytes.
I try to solve it with google I already check these setting.
/etc/cloudera-scm-agent/config.ini the port set 7182 and server_host set ryze-1.bigdata.com.
iptable altready shutdown with sudo service iptables stop
ryze-1.bigdata.com is reachable. and telnet ryze-1.bigdata.com 7183 can succeed.
OS: Centos7.4
Platform: AliCloud
So what can I do? Any one can help me ?
I closed the ssl option.
Everything is fine now.......

python scrapy shell exception: address “'https:” not found: [Errno 11004] getaddrinfo failed

scrapy shell 'https://www.amazon.com/'
I got an error like below:
twisted.internet.error.DNSLookupError: DNS lookup failed: address "'https:" [![enter image description here][1]][1]not found: [Errno 11004] getaddrinfo failed.
and this is my below version of my scrapy version:
C:\>scrapy version -v
Scrapy : 1.1.0
lxml : 3.6.0.0
libxml2 : 2.9.0
Twisted : 16.2.0
Python : 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32
bit (Intel)]
pyOpenSSL : 16.0.0 (OpenSSL 1.0.2h 3 May 2016)
Platform : Windows-7-6.1.7601-SP1
help is appreciated, Thank you.

Unable to resolve chef host while bringing vagrant machine up with libvirt provider

I have a simple Vagrantfile:
Vagrant.configure(2) do |config|
config.omnibus.chef_version = '12.9.38'
config.vm.network "private_network", type: "dhcp"
config.vm.boot_timeout = 60
config.vm.define "node0" do |node0|
node0.vm.box = "baremettle/ubuntu-14.04"
node0.vm.hostname = "node0"
node0.vm.synced_folder "./", "/vagrant", type: "rsync"
node0.vm.provider :libvirt do |qemu|
qemu.driver = "kvm"
qemu.memory = 1024
end
end
end
And when I try to bring machine up I get the following:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
sh install.sh -v 12.9.38 2>&1
Stdout from the command:
ubuntu 14.04 x86_64
Getting information for chef stable 12.9.38 for ubuntu...
downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=12.9.38&p=ubuntu&pv=14.04&m=x86_64
to file /tmp/install.sh.1550/metadata.txt
trying wget...
trying perl...
trying python...
Unable to retrieve a valid package!
Version: 12.9.38
Please file a Bug Report at https://github.com/chef/omnitruck/issues/new
Alternatively, feel free to open a Support Ticket at https://www.chef.io/support/tickets
More Chef support resources can be found at https://www.chef.io/support
Please include as many details about the problem as possible i.e., how to reproduce
the problem (if possible), type of the Operating System and its version, etc.,
and any other relevant details that might help us with troubleshooting.
Metadata URL: https://omnitruck-direct.chef.io/stable/chef/metadata?v=12.9.38&p=ubuntu&pv=14.04&m=x86_64
DEBUG OUTPUT FOLLOWS:
STDERR from wget:
--2016-06-13 15:54:03-- https://omnitruck-direct.chef.io/stable/chef/metadata?v=12.9.38&p=ubuntu&pv=14.04&m=x86_64
Resolving omnitruck-direct.chef.io (omnitruck-direct.chef.io)... failed: Name or service not known.
wget: unable to resolve host address ‘omnitruck-direct.chef.io’
STDERR from perl:
Can't locate LWP/Simple.pm in #INC (you may need to install the LWP::Simple module) (#INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
STDERR from python:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
Stderr from the command:
And after that machine is runnign but chef is not installed. And is I ssh into it and try to ping, for example, google.com, I will get:
vagrant#node0:~$ ping google.com
ping: unknown host google.com
But on host machine ping works as expected, without problems.
I'm using default libvirt network:
<network>
<name>default</name>
<uuid>bd07c4da-891b-4e37-b1d0-16fabb6581c2</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:79:b9:3b'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
</ip>
</network>
Vagrant version is 1.8.1
Virsh version is 1.2.2
Vagrant plugins installed:
vagrant-libvirt (0.0.33)
vagrant-omnibus (1.4.1)
UPDATE:
Adding to hosts(or guests) /etc/resolv.conf
nameserver 8.8.8.8
seems to solve the issue.
But I've never had that problem with virtualbox. Could it be that I missed something in libvirt or vagrant configuration?

pyodbc - [unixODBC][Driver Manager]Data source name not found, and no default driver specified

I am setting up a system to connect to an AWS Redshift database from python. I am thinking that there's something wrong in the python script because I can connect via isql. I've installed all the relevant packages, and I am able to connect via isql as follows:
$ isql rndredshift readonly ***** -v
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> quit
However, my python script is failing to connect. Here's the script:
import pyodbc
import sys
def main():
redshift_conn_str = assemble_connection_string(
Driver='{PostgreSQL}',
Server='10.191.4.97',
ServerName='rndredshift',
Port='5439',
Database='prod',
Uid='readonly',
Pwd='*******'
)
print("===========")
print(redshift_conn_str)
print("===========")
new_conn2 = pyodbc.connect(redshift_conn_str)
print(psql.read_sql('select top 10 * from rawdb.raw_imprequest_20150101', new_conn2))
def assemble_connection_string(**kwargs):
return ';'.join([k + '=' + v for (k, v) in kwargs.items()])
if __name__ == '__main__':
sys.exit(main())
Here's the output:
===========
Uid=readonly;Database=prod;ServerName=rndredshift;Driver={PostgreSQL}; Server=10.191.4.97;Pwd=********;Port=5439
===========
Traceback (most recent call last):
File "test_redshift.py", line 24, in <module>
sys.exit(main())
File "test_redshift.py", line 17, in main
new_conn2 = pyodbc.connect(redshift_conn_str)
pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnectW)')
The PosgreSQL driver is installed:
$ odbcinst -q -d
[PostgreSQL]
[MySQL]
And the data source is configured:
$ odbcinst -q -s
[rndredshift]
If you're using DSNs, you're going to need to specify that in your connection string. Also, if you want to use DSN-less connections, I believe the keyword is SERVER and not SERVERNAME.
Try this connection string?
Uid=readonly;Database=prod;DSN=rndredshift;Driver={PostgreSQL};Pwd=********;
Make sure you specify the full server name and port in odbc.ini as well. Also, since you're using PostgreSQL, any reason you're not using the native PostgreSQL driver?
https://wiki.postgresql.org/wiki/Psycopg
Good luck!
Also, I've been perplexed over the ways to obtain and install the PostgreSQL driver. When I installed unixODBC, the odbcinst.ini file was created and contained an entry for the PostgreSQL driver that looked this this:
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbc.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1
However, the files for Driver and Driver64 where not on the system. So then, I installed postgresql-odbc, which gave me the missing libraries. Is there a better way to do this? As I mentioned earlier, isql works fine, so I'm still thinking it's a python issue.
I decided to try using the psycopg2 package, and I got a connection to work! Here's my script:
import sys
import psycopg2
def main():
conn_string = "host='10.191.4.97' dbname='prod' user='readonly' password='****' port='5439'"
print("===========")
print(conn_string)
print("===========")
new_conn2 = psycopg2.connect(conn_string)
print("Connected using psycopg2!")
if __name__ == '__main__':
sys.exit(main())
So, while I'm happy that I can connect, the question still remains about pyodbc and the PostgreSQL connection string. Thoughts?
Here's the connection string:
Uid=readonly;Database=prod;ServerName=rndredshift;Driver={PostgreSQL}; Server=10.191.4.97;Pwd=********;Port=5439
Using DSN instead of ServerName didn't work.

error: "Operation not permitted" setting key "fs.file-max" while installing Oracle XE 11g on Centos 5.7 + OpenVZ

I am having problem in installing oracle xe 11g on centos 5.7 hosted on OpenVz
The server didnt have any swap space , and the oracle installation was refusing because of the swap=0
now its has been resolved. I am having problem to set the following oracle specific kernel params
# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
Preparing... ########################################### [100%]
error: "Operation not permitted" setting key "fs.file-max"
error: "Operation not permitted" setting key "net.ipv4.tcp_syncookies"
error: %pre(oracle-xe-11.2.0-1.0.x86_64) scriptlet failed, exit status 255
error: install: %pre scriptlet failed (2), skipping oracle-xe-11.2.0-1.0
How can I solve this?
You should change this kernel parameters yourself manually and them rerun the rpm install:-
vi /etc/sysctl.conf and add the following lines:-
fs.file-max = 6815744
net.ipv4.tcp_syncookies = 1
Then run
sysctl -p
You can see the kernel parameter settings in the Install Guide in Section 2.13, although net.ipv4.tcp_syncookies seems to be an additional setting for CENTOS

Resources