I'm installing Bucardo to replicate my Postgres server (10.1) on openSUSE Leap 42.3, and I have successfully complied the executable of Bucardo. When I tried bucardo install and modified the parameter as:
host:<none>
port:5432
user:aSuperUser
database:bucardo
piddir:/tmp/bucardo (already created)
Bucardo says: Postgres version is 4.8. Bucardo requires 8.1 or higher. How could this happen? I installed postgres 10, not 4.8. I also verified the version by select version(); and, there is only one postgres installation on my machine.
It seems to be fixed in master. There is a thread in the bucardo-general mailing list, that explains that you can make by yourself a couple of changes in the bucardo script or apply the diff:
diff --git a/bucardo b/bucardo index e1816f1..8e433ef 100755
--- a/bucardo
+++ b/bucardo ## -8979,7 +8979,7 ## sub install {
}
}
- if ($res !~ /(\d+)\.(\d+)(\S+)/) {
+ if ($res !~ /(\d+)\.(\d+)/) {
print "-->Sorry, unable to connect to the database\n\n";
warn $delayed_warning;
exit 1 if $bcargs->{batch}; ## -8988,10 +8988,7 ## sub install {
## At this point, we assume a good connection
## Assign the version variables
- my ($maj,$min,$rev) = ($1,$2,$3);
- ## We need to be able to handle things such as 9.2devel
- $rev =~ s/^\.//;
- $rev =~ s/(\d+)\.\d+/$1/;
+ my ($maj,$min) = ($1,$2);
$QUIET or print "Postgres version is: $maj.$min\n";
The bucardo script is in /usr/local/bin/bucardo and does not have write permissions so you must change it.
Related
I am trying to run connect to a MSSQL server from a RHEL 5.5 server with FreeTDS and unixODBC.
Using tsql i can connect to the server with
tsql -S mssqltest -U <username> -P <password>
It's getting connected successfully
isql -v mssqltest 'username' 'password' -b -q
Also connects without any problem
But in perl I get a error message as follows
DBI connect('mssqltest',<username>,...) failed: [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libtdsodbc.so' : file not found (SQL-01000) at test.pl line 14
Can't connect to DBI:ODBC:mssqltest: [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libtdsodbc.so' : file not found (SQL-01000) at test.pl line 14.
I tried using FreeTDS as ODBC Driver that also gives similar error also I tried using servername instead of server_ip, but the error continues
DBI connect('Driver=FreeTDS;Server=<server_ip>',<username>,...) failed: [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libtdsodbc.so' : file not found (SQL-01000) at test.pl line 14
Can't connect to DBI:ODBC:Driver=FreeTDS;Server=<server_ip>: [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libtdsodbc.so' : file not found (SQL-01000) at test.pl line 14.
my perl code
#!/usr/bin/perl -w
use strict;
use DBI;
# Replace datasource_name with the name of your data source.
# Replace database_username and database_password
# with the SQL Server database username and password.
my $data_source = q/DBI:ODBC:mssqltest/;
my $user = q/<username>/;
my $password = q/<password>/;
# Connect to the data source and get a handle for that connection.
my $dbh = DBI->connect($data_source, $user, $password)
or die "Can't connect to $data_source: $DBI::errstr";
# This query generates a result set with one record in it.
my $sql = "SELECT TOP 3 * FROM tablename";
# Prepare the statement.
my $sth = $dbh->prepare($sql)
or die "Can't prepare statement: $DBI::errstr";
# Execute the statement.
$sth->execute();
# Print the column name.
print "$sth->{NAME}->[0]\n";
# Fetch and display the result set value.
while ( my #row = $sth->fetchrow_array ) {
print "#row\n";
}
# Disconnect the database from the database handle.
$dbh->disconnect;
My config files are:
FreTDS/odbc.ini
;
; odbc.ini
;
[ODBC Data Sources]
JDBC = Sybase JDBC Server
[JDBC]
Driver = /usr/local/lib/libtdsodbc.so
Description = Sybase JDBC Server
Trace = No
Servername = JDBC
Database = pubs2
UID = guest
[Default]
Driver = /usr/local/lib/libtdsodbc.so
odbc.ini
[ODBC Data Sources]
TS = FreeTDS
[TS]
Driver = FreeTDS
Description = ODBC to SQLServer via FreeTDS
Trace = No
Servername = sql-server
Database = RKDB
[mssqltest]
Description = MS SQL connection to mssqltest database
Driver = FreeTDS
Database = RKDB
Server = <server_ip>
UserName = <username>
Password = <password>
Trace = Yes
Port = 1754
obcinst.ini
[FreeTDS]
Description=TDS driver (Sybase/MS SQL)
Driver=/usr/local/lib/libtdsodbc.so
UsageCount=2
freetds-dev.0.99.761/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 = auto
# 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
[mssqltest]
host = <server_ip>
port = 1754
tds version = 8.0
/usr/local/etc/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 = auto
# 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
[sql-server]
host = TH-SSRS-DB
InstanceName = RKSSRSDB
#port = 1754
tds version = 8.0
client charset = UTF-8
[mssqltest]
host = <server_ip>
port = 1754
tds version = 8.0
Please help.
Running the latest version (6.1.1) of the postgresql Chef cookbook (https://supermarket.chef.io/cookbooks/postgresql) with
node.default['postgresql']['enable_pgdg_yum'] = 'true'
node.default['postgresql']['version'] = '9.3'
This installs postgresql in /var/lib/pgsql/9.3, but running
psql -V
returns
psql (PostgreSQL) 9.2.33
You have to overwrite more at least version, dir, client, contrib and server packages:
node.default["postgresql"]["version"] = "9.3"
node.default["postgresql"]["dir"] = "/etc/postgresql/9.3/main"
node.default["postgresql"]["client"]["packages"] = ["postgresql-client-9.3", "libpq-dev"]
node.default["postgresql"]["server"]["packages"] = ["postgresql-9.3"]
node.default["postgresql"]["contrib"]["packages"] = ["postgresql-contrib-9.3"
It is just an example, I am not sure about package names, double check it. It is due to the way ruby evaluates strings.
I try to install pljava for postgesql 9.6 in Ubuntu 16.04, but it fails with error.
A gradlew script makes an installation, but it fails with the following error"
Failed to execute: CREATE EXTENSION pljava; because: ERROR: could not access file "pljava-so-1.5.1-BETA1": No such file or directory
A gradlew source:
Sql sql = establishConnection()
try {
sql.execute("SET pljava.libjvm_location TO '${javaNative}';")
sql.execute("SET pljava.vmoptions TO '-Xshare:on -XX:+DisableAttachMechanism';")
sql.execute("ALTER DATABASE postgres SET pljava.libjvm_location FROM CURRENT;")
sql.execute("ALTER DATABASE postgres SET pljava.vmoptions FROM CURRENT;")
sql.execute("CREATE EXTENSION pljava;")
} finally {
sql.close()
}
As i understand, it fails during a creation of extension pljava, commands above was executed without any errors.
According to #ChapmanFlack advice:
I have no any mentions about pljava-so-1.5.1-BETA1 file at pg_config --libdir directory. Also i didn't find that file at pg_config --sharedir
grep LOAD pljava--1.5.1-BETA1.sql output following:
touched off by the LOAD command, making possible a decent installation
LOAD command, but finds the CREATE EXTENSION command instead). So,
temporarily LOAD 'pljava-so-1.5.1-BETA1'; Ok, the LOAD succeeded, so
everything happened ... unless ... the same PostgreSQL turns LOAD into
a (successful) no-op in that case, meaning To fail fast in that case,
expect that the LOAD actions should have
I think PL/Java builds from a prebuilt, because of that line at gradlew:
commandLine 'java', '-jar', '../installer/build/dependencies/pljava-pg9.6.jar'
I would be appreciate for any advice
After an upgrade from Ubuntu Server 14.04 to 16.04 I had to also upgrade my Postgres clusters from 9.3 to 9.5. The normal way to do that is to first drop the (empty) 9.5 cluster that the upgrade created:
# pg_dropcluster 9.5 main
and then to upgrade the old 9.3 cluster to 9.5:
# pg_upgradecluster 9.3 main
This however results in an error:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = (unset),
LC_PAPER = "nl_NL.UTF-8",
LC_ADDRESS = "nl_NL.UTF-8",
LC_MONETARY = "nl_NL.UTF-8",
LC_NUMERIC = "nl_NL.UTF-8",
LC_TELEPHONE = "nl_NL.UTF-8",
LC_IDENTIFICATION = "nl_NL.UTF-8",
LC_MEASUREMENT = "nl_NL.UTF-8",
LC_TIME = "nl_NL.UTF-8",
LC_NAME = "nl_NL.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Error: The locale requested by the environment is invalid.
Error: Could not create target cluster
This means I could not upgrade to Postgres 9.5.
I checked all locale settings:
the en_US.UTF-8 locale exists and is properly generated as checked with locale -a (it shows en_US.utf8 in its list)
The file /etc/environment contains LC_ALL=en_US.UTF-8 and LANG=en_US.UTF-8
/etc/default/locale contains the same setting for LANG, LANGUAGE and LC_ALL
I can start Perl without any issue using "perl -e exit"
The error message is generated from the pg_createcluster script which is called from pg_updatecluster. But running pg_createcluster from the command line works just fine, without any issue.
Workaround for the issue:
I used the following workaround to at least get the conversion to work. I edited the /usr/bin/pg_upgradecluster script, as follows:
Find the code where it calls pg_createcluster by looking for the comment "create new cluster"
That code consists of a series of "push" statements, ending in the suspicious line:
delete $ENV{'LC_ALL'}
Notice that this LC_ALL is exactly the variable that is unset in the error message.
Comment out that delete comment by adding a '#' before it, then save.
This at least circumvents this problem and lets you run the upgrade.
My question: is this a bug in the pg_upgradecluster script, or is something else awry on my system?
had the same problem on an ubuntu 16.04 server. what helped in my case was to generate all the locales that appear in your listing of $ locale:
$ sudo locale-gen "en_US.UTF-8"
$ sudo locale-gen "nl_NL.UTF-8"
good luck!
In my case, it was complaining about
Error: The locale requested by the environment is invalid:
LANG: en_GB
LANGUAGE: en_GB:en
So I unset LANG and unset LANGUAGE and it worked.
For me, I have followed many suggestions and still didn't work.
The script mentioned
LC_TIME=en_UK but it's totally unrelated so I ignored it at first.
Turns out this was the problem and doing "unset LC_TIME" was all I needed.
Posting here in case it happened to someone else.
My quick way to disable that message: (macOS 12 Monterey M1)
Open Terminal -> Preferences -> Advanced tab -> uncheck to Set locale environment variables on startup
Just came across this in fresh Ubuntu + PostgresQL install, after all those years.. either way, the solution is:
apt-get install locales
I'm trying to set-up PERL DBD::ODBC to use the DataDirect ODBC Driver Manager (7.0) that is provided with Informatica PowerCenter. This is on a Solaris 10 Sparc64 environment. We've had this working in the past with the 5.1 driver manager (on an sp32 server), but now running into problems since moving to this new version. For all ODBC connections I get this error:
failed: [DataDirect][ODBC lib] Specified driver could not be loaded (SQL-IM003) at test_odbctd.pl line 19
Can't connect to DBI:ODBC:tdedwprd: [DataDirect][ODBC lib] Specified driver could not be loaded (SQL-IM003) at test_odbctd.pl line 19, <STDIN> line 2.
I have tested the same connections using the "ssgodbc" tool provided by Informatica for testing and they work. I can login and run queries.
As an example, here's one of my Teradata connections as definied in odbc.ini (we're having the same problem with DB2, SQL Server, Teradata, Sybase, PowerExchange, etc). Don't ask why I have to hard-code the full driver path in this file instead of odbcinst.ini. I couldn't get it to work and the Informatica standard is to hard-code it in odbc.ini so I don't want to affect our support from them.
[tddev]
Driver=/opt/teradata/client/odbc/drivers/tdata.so
Description=Teradata Development
DBCName=teradata1
DBCName2=teradata2
MaxRespSize=65477
DateTimeFormat=AAA
EnableExtendedStmtInfo=No
LoginTimeout=60
ldd output for the driver:
$ ldd /opt/teradata/client/odbc/drivers/tdata.so
warning: ldd: /opt/teradata/client/odbc/drivers/tdata.so: is not executable
libCstd.so.1 => /opt/SUNWspro/lib/v9/libCstd.so.1
libthread.so.1 => /usr/lib/sparcv9/libthread.so.1
libm.so.1 => /usr/lib/sparcv9/libm.so.1
libw.so.1 => /usr/lib/sparcv9/libw.so.1
libc.so.1 => /usr/lib/sparcv9/libc.so.1
libsocket.so.1 => /usr/lib/sparcv9/libsocket.so.1
libnsl.so.1 => /usr/lib/sparcv9/libnsl.so.1
libxnet.so.1 => /usr/lib/sparcv9/libxnet.so.1
libodbcinst.so => /opt/powercenter/v951/ODBC7.0/lib/libodbcinst.so
libddicu25.so => /opt/teradata/client/odbc/lib/libddicu25.so
libtdparse.so => /opt/teradata/client/odbc/lib/libtdparse.so
libicudatatd.so.46 => /usr/lib/sparcv9/libicudatatd.so.46
libicuuctd.so.46 => /usr/lib/sparcv9/libicuuctd.so.46
libCrun.so.1 => /opt/SUNWspro/prod/usr/lib/v9/libCrun.so.1
libmp.so.2 => /lib/64/libmp.so.2
libmd.so.1 => /lib/64/libmd.so.1
libscf.so.1 => /lib/64/libscf.so.1
libDWicu26.so => /opt/powercenter/v951/ODBC7.0/lib/libDWicu26.so
libdl.so.1 => /usr/lib/sparcv9/libdl.so.1
librt.so.1 => /usr/lib/sparcv9/librt.so.1
libpthread.so.1 => /usr/lib/sparcv9/libpthread.so.1
libdoor.so.1 => /lib/64/libdoor.so.1
libuutil.so.1 => /lib/64/libuutil.so.1
libgen.so.1 => /lib/64/libgen.so.1
libaio.so.1 => /lib/64/libaio.so.1
libm.so.2 => /lib/64/libm.so.2
/lib/sparcv9/../libm/sparcv9/libm_hwcap1.so.2
/platform/sun4v/lib/sparcv9/libc_psr.so.1
/platform/sun4v/lib/sparcv9/libmd_psr.so.1
I tried to run strace as the user that uses these connections, but I get this error so not sure what to do with that:
$ strace perl test_odbctd.pl
ERROR: unable to open /dev/log
Here's the PERL test script we're using:
#!/usr/bin/perl -w
use DBI;
# use DBD::ODBC;
# use DBD::DB2::Constants;
my $data_source = "DBI:ODBC:tdedwprd";
#Prompt for username
print "Enter user:";
my $user = <STDIN>;
#Prompt for password
print "Enter password:";
my $password =<STDIN>;
# Connect to the tdedwdev teradata database
my $dbh = DBI->connect($data_source, $user, $password, {AutoCommit =>1})
or die "Can't connect to $data_source: $DBI::errstr";
$stmt = "SELECT database, time; ";
$sth = $dbh->prepare($stmt);
$sth->execute();
#associate variable with output columns...
$sth->bind_col(1,\$db);
$sth->bind_col(2,\$timestap);
while ($sth->fetch) {
print "The database is: $db\n";
print "The time is: $timestap\n";
}
$dbh->disconnect;
The above script works on our existing dev box (Solaris 10 sp32), but not on the new one we're building (Solaris 10 sp64).
The old server had the driver manager bundled with Informatica PowerCenter 8.6.1 sp32, and the new one has Informatica PowerCenter 9.5.1 sp64.
The DBD::ODBC module did compile fine with some modifications, roughly following this guide from DataDirect (the logic was basically the same, but the references to the Makefile.PL weren't identical):
http://knowledgebase.datadirect.com/articles/Article/2973
I enabled Trace in odbc.ini (Trace=1) but this just resulted in a "Segmentation Fault (core dumped)". However it does output a trace file when using the Informatica-provided "ssgodbc" tool.
I tried using isql, but it seems to be tied to the Sybase drivers so I'm not sure if I can use that. I couldn't get it to work
$ which isql
/opt/sybase/OCS-15_0/bin/isql
Here are my ODBC environment variables:
$ env | grep -i odbc
MANPATH=/usr/share/man:/opt/teradata/client/14.00/odbc_32/help/man:
ODBCINST=/opt/powercenter/v951/ODBC7.0/odbcinst.ini
LD_LIBRARY_PATH=/opt/powercenter/v951/ODBC7.0/lib:/opt/powercenter/v951/server/bin:/home/etlin1d/sqllib/lib:/opt/pwx/v851:/opt/sybase/OCS-15_0/lib:/opt/sybase/OCS-15_0/lib3p64:/opt/sybase/OCS-15_0/lib3p:/opt/teradata/client/14.00/tbuild/lib:/opt/teradata/client/odbc/lib:/opt/teradata/client/odbc/drivers:/opt/teradata/client/14.00/tbuild/lib:/usr/lib:/prj/db2/etlin1d/sqllib/lib64:/prj/db2/etlin1d/sqllib/lib32:/usr/lib
LD_LIBRARY_PATH_64=/opt/powercenter/v951/ODBC7.0/lib:/opt/powercenter/v951/server/bin:/opt/pwx/v851:/prj/db2/etlin1d/sqllib/lib64:/opt/sybase/OCS-15_0/lib:/opt/sybase/OCS-15_0/lib3p64:/opt/sybase/OCS-15_0/lib3p:/opt/teradata/client/14.00/tbuild/lib:/opt/teradata/client/odbc/lib:/opt/teradata/client/odbc/drivers:/usr/lib
NLSPATH=/opt/teradata/client/14.00/odbc_64/msg:/opt/teradata/client/14.00/odbc_32/msg:/opt/teradata/client/14.00/tbuild/msg/%N:/opt/teradata/client/14.00/tbuild/msg/%N:/opt/teradata/client/14.00/odbc_32/msg/%N:
PATH=/opt/sybase/ASEP/bin:/opt/sybase/DBISQL/bin:/opt/sybase/UAF-2_0/bin:/opt/sybase/OCS-15_0/bin:/opt/teradata/client/14.00/tbuild/bin:/opt/teradata/client/14.00/tbuild/bin:/usr/bin:/bin:/usr/local/bin:/opt/powercenter/v951/ODBC7.0/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/powercenter/v951/server/bin:.:/prj/db2/etlin1d/sqllib/bin:/prj/db2/etlin1d/sqllib/adm:/prj/db2/etlin1d/sqllib/misc:/prj/db2/etlin1d/sqllib/db2tss/bin
ODBCINI=/opt/powercenter/v951/ODBC7.0/odbc.ini
ODBCHOME=/opt/powercenter/v951/ODBC7.0
I'm totally at a loss. I'm not a Solaris admin by trade though (in fact this is my first significant exposure to Solaris and Informatica really) so I'm hoping I'm missing something obvious.
I'm not sure what else to share right now. Any help would be GREATLY appreciated. I've been stuck on problems with this ODBC implementation for weeks.
I realised that the problem here was not with the driver manager. It was caused by the fact that I was using 32-bit Perl but a 64-bit ODBC driver. If I added an entry that used a 32-bit ODBC driver to odbc.ini (despite the driver manager being 64-bit) then there is no problem (although it did raise a licensing issue which is separate to this discussion).
In short, this error message occured because the driver is not the same bitness as the client (check by running the file command against both client and driver):
Specified driver could not be loaded
An example of the file command is:
file /opt/teradata/client/odbc/drivers/tdata.so
However, it also occurs when the driver cannot find all of its dependent drivers, which can be checked using ldd on the driver to make sure it is finding all of its dependencies.
An example of the ldd command is:
ldd /opt/teradata/client/odbc/drivers/tdata.so
I tried the above method given by LokMac, all dependant drivers were there and still it wont work, at the end I added "# Driver: The location where the ODBC driver is installed to." before driver path and it magically worked:
[tddemo]
# Driver: The location where the ODBC driver is installed to.
Driver=/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so
in above, tddemo is my DNS name and since I am on TD Express 16.20, thats why my driver name is different.