Using ruby-oci8 with AIX successfully (no ORA-12537) - ruby

Has anyone successfully used the current (2.1.7) version of ruby-oci8 against Oracle on AIX?
I can run my ruby-oci8 test script and get it to work against TNS for Linux and TNS for Windows but not AIX.
However, it is not an Oracle Instant Client issue, I can do a command line sqlplus connect from my machine to the Oracle (TNS for AIX) server and it works fine. However when I wrap it in a ruby script (using ruby 1.8.7) it fails with:
oci8.c:513:in oci8lib.so: ORA-12537: TNS:connection closed (OCIError)
from /usr/lib64/ruby/gems/1.8/gems/ruby-oci8-2.1.7/lib/oci8/oci8.rb:148:in initialize' from app/controllers/testdb.rb:32:innew'
from app/controllers/testdb.rb:32
I am not doing anything clever here, just creating a new connection like this:
conn = OCI8.new(username, password)
Any information on this would be great, I haven't tried packet sniffing - yet....
-John

I did eventually get this working, the short answer is that I had success using the full connection string, that is:
OCI8.new("user/password#(description=(address=(protocol=tcp)(host=host.uab.edu)(port=1521))(connect_data=(sid=somesid)))")
The confusing part is that this format isn't mentioned in the API and that I had to use sid= of service_name=.
The details are here:
https://github.com/kubo/ruby-oci8/issues/66

Related

SQLPlus is throwing client hostname issue ORA-24454, whereas I can telnet to hostname successfully

I'm trying to connect to the oracle database via sqlplus hosted on a remote instance using command like this sqlplus user#hostname.com:port/SchemaName. And on typing password it throws weird client host issue. See the screenshot below.
The question is which host name its expecting me to put inside /etc/hosts?
Whereas I can telnet successfully to same instance without any issues. By the way I'm on MacOS 10.15.7.
Oracle clients were installed using this link. Can be seen from the screenshot below.
The installation was moved to the appropriate folder.
The $PATH was also exported to ~/.bash_profile file
I was able to resolve this issue by the solution mentioned on this link.
Using hostname command I was able to find host name of my machine, which was required to make a successful connection to the Oracle.
The screenshot below explains the process
The hostname entry looks like below

Oracle 19c and "no valid ip address returned for the host"

I installed oracle 19c on centos 8, there was an error during installation when configuring the listener.
Manually running Net Assistance (/bin/netca) and trying to add a listener ends with a message: "no valid ip address returned for the host":
I performed an installation on Centos 7 with automatic preinstallation configuration under oracle and the same message.
I probably didn't configure something in linux, because I don't know much about it.
After a week of hard work...
I managed to install, two possible reasons for this error:
I installed from my ORACLE account, but by "SU ORACLE" I did not log in as ORALCE, because then all the environment settings are loaded
I used another (newer) version of the oracle package for automatic configuration (https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm)
It's possible that I had a different hostname set in the oracle scripts than on the server in /etc/hostname - very likely, due to the content of the error...
In my case, I was installing Oracle 19c in CentOS stream 8 in a VM with VirtualBox.
I added in /etc/hosts: 10.0.2.15 centoss8 centoss8.local
(before this I added CentOSs8 and CentOSs8.local as an alias of 127.0.0.1 and didn't work)
and in /etc/hostname: centoss8.local
reboot, and run
/etc/init.d/oracledb_ORCLCDB-19c configure
it's worked for me

How to connect to Pervasive SQL server in Ruby Application?

I am trying to connect to a Pervasive Sql Server which is running on Windows machine from my Ruby application which is on Ubuntu Machine. Can Someone please help me on same. Thanks in advance
Below is my configuration on linux machine
/etc/freetds/freetds.conf
[pserver]
host = XXX.XXX.XX.XXX
port = 1583
tds version = 8.0
Under /etc/odbcinst.ini, I have saved the driver info like below
[freetds]
Description=freetds Driver
Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
Trace=Yes
TraceFile=/tmp/freetds.log
ForceTrave=Yes
UsageCount=10
fileusage=1
dontdlclose=1
TDS_Version = 8.0
In /etc/odbc.ini, client and database details
[pclient]
Description = Pervasive SQL Server
Driver = freetds
Trace = Yes
Servername = pserver
Port = 1583
Database = "MyDatabasename"
TDS_Version = 8.0
tsql -S pserver -U db_username -P db_password -d MyDatabasename
above cmd gives error saying
Error 20009 (severity 9):
Unable to connect: Adaptive Server is unavailable or does not exist
OS error 111, "Connection refused"
There was a problem connecting to the server
iodbctest ["DSN=pclient;UID=db_username;PWD=db_password"]
this results in
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0812.0326
(iodbctest:6672): Gtk-WARNING **: 20:40:38.693: cannot open display:
Not able to understand the above result and how to handle this. Please help
As far as I know, the only way to access Pervasive PSQL from Ruby would be through ODBC. You need to use the Pervasive Client ODBC driver. Don't use the FreeTDS driver. I've never heard of using the FreeTDS driver to connect to Pervasive PSQL. In fact, this question mentions that FreeTDS doesn't work to Pervasive PSQL. Pervasive PSQL and Microsoft SQL Server are not the same product and the client for one cannot connect to the server of the other.
The short answer would be to install the Pervasive PSQL client on the Ubuntu machine, create the ODBC Datasource name pointing to the database on the Windows machine and then use ODBC from within Ruby to access the data.
You'll want to be on at least Pervasive PSQL v11.30, preferably Actian PSQL v13 (current version as of December 2018). You'll need to download and install the client appropriate for the application. If the Ruby application is 32 bit, you need the 32 bit ODBC driver. If the application is 64 bit, you'll need the 64 bit driver. The 'bitness' of the OS is not as important. You need to use the same PSQL client version as server version. You cannot use the v13 client with a v11 server.

Filemaker ODBC Python Connection issues Mac os 10.12.02

I'm trying to set up pyodbc on a mac so I can run python scripts to talk to a filemaker database.
I am running python2.7
I have installed ODBC Manager, and the Filemaker odbc client driver. I have tested this connection and it connects fine.
However when I run the python script i get this error
pyodbc.Error: ('01000', u"[01000] [unixODBC][Driver Manager]Can't open lib 'FileMaker ODBC' : file not found (0) (SQLDriverConnect)")
c = "DRIVER={FileMaker ODBC};SERVER=localhost:2399;DSN=DB;UID=user;PWD=pass;Trusted_Connection=yes"
con = pyodbc.connect(c)
Any help would be really appreciated.
Problem fixed. My odbc.ini file was in the wrong place.
I ran the command
odbcinst -j
unixODBC 2.3.5
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
and moved the odbc.ini file from /Library/ODBC/odbc.ini to /usr/local/etc/odbc.ini
problem solved.
Other options:
PyFileMaker - using XML API
https://github.com/aeguana/PyFileMaker
bBox - plugin
https://bbox.beezwax.net/products/bbox
Python-fmrest - using FM Data API
https://github.com/davidhamann/python-fmrest

Oracle Pro*C ORA-12547

I'm working on re-compiling some Pro*C code that no one currently at my company has ever compiled. It's compiling OK, but when I copy it to the production server and run it I'm getting Oracle error ORA-12547 (TNS: lost contact)
Any ideas?
Oh, figured it out. :-)
The C executable isn't run directly on the server, but launched through a script that sets up the connection environment. i.e. something like this:
export SHLIB_PATH=/oracleDatabaseSidHere/oracle/10.2/lib:/usr/lib:/oracleDatabaseSidHere/oracle/10.2/odg/lib
export ORACLE_BASE=/oracleDatabaseSidHere/oracle
export ORACLE_SID=oracleDatabaseSidHere
export ORACLE_HOME=/oracleDatabaseSidHere/oracle/10.2
# Set up the path and executable to run
PATH=.\:$PATH:$ORACLE_HOME/bin:/usrlocal/bin
PATH=$PATH:/path_to_application_logs
cd /path_to_application
application
Related to this, I just found out that I get the same error ORA-12547 TNS lost contact on my Windows machine when I try to connect to an Oracle database with PL/SQL and at the same time I have a VPN connection open.
I had a similar problem on Linux, Oracle 11gR2. Oracle owner could run SQL*Plus and get in via either TNS or local connection. Non-oracle user could log in via TNS, but not as local connection.
Turns out the answer was that the ORACLE_HOME filesystem was mounted "nosuid". Removing that mount option solved my issue.

Resources