I'm trying to using psqlODBC driver to receive data from PostgreSQL to Excel in macOS Catalina.
But I keep getting this error IM003 [iODBC][Driver Manager]Specified driver could not be loaded
Following things are the method I've tried but still don't succeed.
Disable SIP
Move psqlodbca.so under the /Library/ODBC folder in order to let Excel open in sandbox environment.
Changed original /usr/lib/libpq.5.dylib to PostgreSQL's dylib file by using command
sudo ln -s /postgresql_install_folder/lib/libpq.5.dylib /usr/lib/libpq.5.dylib
I download the source from https://www.postgresql.org/ftp/odbc/versions/src/ and follow this article https://odbc.postgresql.org/docs/unix-compilation.html to compile the driver and install the psqlodbca.so under /Library/ODBC
My /Library/ODBC/odbc.ini
[ODBC Data Sources]
postgresAscii = ascii
[postgresAscii]
Driver = {ascii}
Description = postgres odbc for user type ascii
Database = db
Server = 127.0.0.1
Port = 5432
FetchBufferSize = 99
My /Library/ODBC/odbcinst.ini
[ODBC Drivers]
ascii = Installed
[ascii]
Driver = /Library/ODBC/psqlodbca.so
Setup =
I can connected to my DB using iODBC Administrator64.app
Related
I try to run locally (from GCP terminal) python 3 tutorial program to connect to my postgresql dsatabase.
I run proxy, as it is suggested in source:
./cloud_sql_proxy -instances=xxxxxxxx:us-central1:testpg=tcp:5432
it works, I can connect to it with:
psql "host=127.0.0.1 sslmode=disable dbname=guestbook user=postgres
Unfortunately when I try to connect from python:
cnx = psycopg2.connect(dbname=db_name, user=db_user,
password=db_password, host=host)
host is 121.0.0.1 -as I run it locally, I get this error:
psycopg2.OperationalError: connection to server at "127.0.0.1", port 5432 failed: FATAL: password authentication failed for user "postgres"
I can't get around what I miss?
Thanks in advance ...
I'd recommend using the Cloud SQL Python Connector to manage your connections and best of all you won't need to worry about running the proxy manually. It supports the pg8000 postgresql driver and can run from Cloud Shell.
Here is an example code snippet showing how to use it:
from google.cloud.sql.connector import connector
import sqlalchemy
# configure Cloud SQL Python Connector properties
def getconn() ->:
conn = connector.connect(
"xxxxxxxx:us-central1:testpg",
"pg8000",
user="YOUR_USER",
password="YOUR_PASSWORD",
db="YOUR_DB"
)
return conn
# create connection pool to re-use connections
pool = sqlalchemy.create_engine(
"postgresql+pg8000://",
creator=getconn,
)
# query or insert into Cloud SQL database
with pool.connect() as db_conn:
# query database
result = db_conn.execute("SELECT * from my_table").fetchall()
# Do something with the results
for row in result:
print(row)
For more detailed examples refer to the README of the repository.
I have installed Oracle in my system and wanted to change my local database to Oracle, but making changes in the database-config.xml I am unable to get my server started and getting the following error:
java.lang.RuntimeException : No Appropriate database found in
configuration: env = 'local'
Just add to your configuration file (database-config.xml) the parameter env="local".
Example:
<database
autoupgrade="full"
name="BillingCenterDatabase"
dbtype="oracle"
env="local">
I need to get data from an old MySQL server and I'm getting the following error when trying to connect to it with RMySQL or DBI packages:
Error in .local(drv, ...) :
Failed to connect to database: Error: Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)
On terminal, I must use the '--secure_auth=false' option to be able to connect to that MySQL server, but I'cant handle how to use it with RMySQL and DBI packages.
Reading these packages docs, I've found the default.file arg to use in cdbConnect() functions. So I've created a '.my.cnf' file with 'secure_auth=false' direction (following MySQL documentation). But with this conf file the dbConnect() function crashed.
With RJDBC package, I can connect to that server, even without any extra option to set secure_auth. But I would like to use RMySQL to do that, since I am already using it to many other connections in the same script and also because RMySQL is more updated than RJDBC.
My sessionInfo():
R version 3.3.1 (2016-06-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RJDBC_0.2-5 rJava_0.9-8 DT_0.1 reshape2_1.4.1 RAdwords_0.1.9
[6] RGA_0.4.2 highcharter_0.3.0 ggplot2_2.1.0 lubridate_1.5.6 dplyr_0.4.3
[11] gpbR_1.0 RMySQL_0.10.9 DBI_0.4-1
I want to monitor Azure Paas database with Nagios. I'm using this plugin available at https://github.com/MsOpenTech/WaMo
When I try to check database:
./check_azure_sql.py -u -p -d -k top5queries
I get this error message:
('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)')
Error connecting to database
All dependencies are installed (list in GitHub plugin site).
Here you can see my /etc/odbcinst.ini:
[ODBC]
Trace = Yes
TraceFile = /tmp/odbc.log
[FreeTDS]
Description = ODBC For TDS
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
UsageCount = 1
Here you can see my /etc/freetds/freetds.conf:
# $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
; tds version = 4.2
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
# A typical Sybase server
[egServer50]
host = symachine.domain.com
port = 5000
tds version = 5.0
# A typical Microsoft server
[egServer70]
host = ntmachine.domain.com
port = 1433
tds version = 7.0
And my /etc/odbc.ini is empty.
Does anybody have any idea?
bhagdev, to do simple, i'm trying to monitor Sql database Azure Paas with nagios.
It's not me that is written the plugin available at github.com/MsOpenTech/WaMo. For a nagios admin, i only need to execute the command ./check_azure_sql.py -u (username) -p (password) -d (database) -k (key) (check_azure_sql.py written in python) from debian linux cli.
So when i execute the command above i get the error message :
('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)') Error connecting to database.
Than'ks for your help guy's
I'm trying to connect from ubuntu (kubuntu 13.04) with nodejs to a sql server db! (sql server 2012)
I was looking at node odbc..
so.. I start installing FreeTds, then unixOdbc, then launch: npm install odbc
1) I configured the file "etc/freetds/freetds.conf" like this:
[FreeTDS]
host = gerry_win7
port = 1433
tds_version = 8.0
client charset = UTF-8
2) install sqsh (sudo apt-get install sqsh) and try to connect with
sqsh -S FreeTDS -U trm1 -P user
and execute a query: works perfectly!
3) then, I tried to configure ODBC access in this way:
file "/etc/odbcinst.ini":
[FreeTDS]
Description = TDS driver
Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1
file "/etc/odbc.ini":
[FreeTDS]
Driver = FreeTDS
Description = ODBC connectin via FreeTDS
Trace = No
Servername = gerry_win7
Database = testsql
UID = trm1
PWD = user
Port = 1433
4) with this sample code with nodejs I received the following error:
code:
var cn = 'DRIVER={FreeTDS};SERVER=gerry_win7;UID=trm1;PWD=user;DATABASE=testsql';
var Database = require('odbc').Database, db = new Database();
db.open(cn, function(err){
if (err) {return console.log(err);}
});
error:
[unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[Error: Error opening database]
but, as I wrote before, with the "sqsh" client the connection works: I can run queries!
can someone help me understand what I'm doing wrong?
This is the connection string I would use if I were specifying the DRIVER in it:
"DRIVER={FreeTDS};SERVERNAME=gerry_win7;DATABASE=testsql;UID=trm1;PWD=user;AutoTranslate=yes"
If you want to use the DSN that you have configured in /etc/odbc.ini then you would want to do:
"DSN=FreeTDS;UID=trm1;PWD=user;DATABASE=testsql"
Testing with the sqsh command may just use the configuration information that is in /etc/freetds/freetds.conf (citation needed). It is best to test your ODBC configuration (outside of node) with the isql command like:
$ isql FreeTDS trm1 user
Where FreeTDS is the DSN configured in /etc/odbc.ini.
Your configuration may be a little bit confusing because both the driver name and the DSN name are FreeTDS. I personally find it more helpful to use the server name or some other identifier as the DSN name specified in /etc/odbc.ini. I would suggest something like this in your odbc.ini:
[gerry]
Driver = FreeTDS
Description = ODBC connectin via FreeTDS
Trace = No
Servername = gerry_win7
Database = testsql
UID = trm1
PWD = user
Port = 1433
Then use this connection string:
"DSN=gerry;UID=trm1;PWD=user;DATABASE=testsql"
Doing it that way, you could potentially just change the Driver entry in the odbc.ini file if you want to use the SQL Server Native Client 11.0, if you get to that point. :)