We use DB2 (v. 10.5) to store our data. After we had applied Fix Pack 8 to database (client and JDBC driver had been also updated) we faced the following problems:
1) SAS EG didn’t show tables in DB2 libraries;
2) SAS Content Server couldn’t start with the following error in log:
INFO 2017-02-09 14:08:50,541 [server.startup : 1] - Starting repository...
ERROR 2017-02-09 14:08:50,811 [server.startup : 1] - failed to initialize file system
com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-443, SQLSTATE=38553, SQLERRMC=SYSIBM.SQLTABLES;TABLES;SYSIBM:CLI:-514, DRIVER=3.67.27
at com.ibm.db2.jcc.am.gd.a(gd.java:752)
As recommended here (http://www-01.ibm.com/support/docview.wss?uid=swg21369762) for similar cases we executed the following commands in DB2:
db2 connect to <databasename>
db2 bind db2schema.bnd blocking all grant public sqlerror continue
db2 terminate
But it has not solved the issues.
What could we forget to do?
How could we try to solve the issue or reveal its root?
Our version of SAS is 9.3. Server OS is AIX, client OS is Windows.
Related
We have a cassandra cluster up and running in test environment. The cluster is reach able through command line, however MATLAB is unable to connect.
Connection string:-
contactPoints = "172.31.61.211";
conn = cassandra(contactPoints)
cassandra with properties:
Cluster: "RQ_1"
HostAddresses: "172.31.61.211"
LocalDataCenter: "DC_1"
Keyspaces: ["dse_insights"]
Error Message:-
Error using cassandra (line 130)
Java exception occurred:
java.lang.NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
at com.datastax.driver.core.policies.Policies$Builder.build(Policies.java:285)
at com.datastax.driver.core.Cluster$Builder.getConfiguration(Cluster.java:1246)
at com.datastax.driver.core.Cluster.(Cluster.java:116)
at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:181)
at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:1264)
at com.mathworks.toolbox.cassandra.CassandraConnection.(CassandraConnection.java:43)
For me it looks like conflict between library version used by math plab and Cassandra Java driver. Specifically between guava versions - either mathlab uses older or newer version that conflicts with the driver.
Also, mathlab docs recommends to switch to new integration based on C++ driver (doc)
I am setting up a development environment with the following:
CentOS 7
Python 2.7
IBM-DB2 EE Server v11.1.4.4
ibm-db package
My earlier installation and set up went smooth with no real issues on ODBC connectivity with the local DB2 trial database version. With my new install, I keep getting the following message:
Exception:
[IBM][CLI Driver] SQL1531N The connection failed because the name specified with the DSN connection string keyword could not be found in either the db2dsdriver.cfg configuration file or the db2cli.ini configuration file. Data source name specified in the connection string: "DATABASE". SQLCODE=-1531
I did try updating the python version to 3.7 but results the same. I had to reiterate here that my earlier install with the same configuration went through without any issues. I never updated neither the db2cli.ini file nor db2dsdriver file. I did try here and it fails. As much I could gather, I saw a message which read like "ibm-db does not sit well with all python versions properly".
>>> import difflib
>>> import subprocess
>>> import os
>>> import ibm_db
>>> from shutil import copyfile
>>> conn = ibm_db.connect("DATABASE","USERID","PASSWORD")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Exception:
[IBM][CLI Driver] SQL1531N The connection failed because the name specified with the DSN connection string keyword could not be found in either the db2dsdriver.cfg configuration file or the db2cli.ini configuration file. Data source name specified in the connection string: "DATABASE". SQLCODE=-1531
I expect the connection to go through fine without any issues.
The short answer is that the easiest way is to use a complete DSN string to establish the connection (including the hostname, port etc.), e.g:
In [1]: import ibm_db
In [2]: conn = ibm_db.connect("DATABASE=SAMPLE;HOSTNAME=localhost;PORT=60111;UID=db2v111;PWD=passw0rd;","","")
The long answer is that we should be able to use the alias from the catalog, as explained in ibm_db.connect API:
IBM_DBConnection ibm_db.connect(string database, string user, string
password [, dict options [, constant replace_quoted_literal])
database For a cataloged connection to a database, this parameter
represents the database alias in the DB2 client catalog. For an
uncataloged connection to a database, database represents a complete
connection string in the following format: DRIVER={IBM DB2 ODBC
DRIVER};DATABASE=database;HOSTNAME=hostname;PORT=port;
PROTOCOL=TCPIP;UID=username;PWD=password; where the parameters
represent the following values:
hostname - The hostname or IP address of the database server.
port - The TCP/IP port on which the database is listening for requests.
username - The username with which you are connecting to the database.
password - The password with which you are connecting to the database.
user - The username with which you are connecting to the database.
For uncataloged connections, you must pass an empty string.
password- The password with which you are connecting to the database. For uncataloged connections, you must pass an empty string.
The question is though which client catalog we will check...
It all depends whether IBM_DB_HOME was set when package was installed, as explained in README. If it was set, then Python driver will use the existing client instance and its database catalog (as well as db2cli.ini and db2dsdriver.cfg). If not, then a separate client will be fetched during the installation and deployed in Python's site-packages.
In order to check which one is the case you can run ldd against your ibm_db.so, e.g:
ldd /usr/lib/python2.7/site-packages/ibm_db-2.0.7-py2.7-linux-x86_64.egg/ibm_db.so | grep libdb2
libdb2.so.1 => /usr/lib/python2.7/site-packages/ibm_db-2.0.7-py2.7-linux-x86_64.egg/clidriver/lib/libdb2.so.1 (0x00007fb6e137e000)
Based on the output I can say that in my environment the diver was linked against a driver in Python's site-packages, so it will use db2cli.ini from /usr/lib/python2.7/site-packages/ibm_db-2.0.7-py2.7-linux-x86_64.egg/clidriver/cfg.
If I will populate it with a section:
[sample]
port=60111
hostname=localhost
database=sample
I will be able to connect just with the DSN alias:
In [4]: conn = ibm_db.connect("SAMPLE","db2v111","passw0rd")
If you want the driver to use the existing client instance, use the IBM_DB_HOME during installation.
I have a project that works with GeoDjango, Postgis and its deploy it in Heroku.
Some info of what I'm using:
Python 2.7.15
Django 1.11.20
Heroku-18 (Stack)
Postgres 9.4.20
Postgis 2.1.8
In the last months the system threw me an error every time I want to load de geografic info, when I execute a geocode query.
ERROR: could not access file "$libdir/postgis-2.1": No such file or
directory
I have looked for the web and stackoverflow for the solutions and I found some that was really near of my problem but I tried their solutions and doesn't work for me.
I tried the "ALTER EXTENSION postgis UPDATE" solution but throw me this error:
ERROR: cannot create temporary table within security-restricted
operation
I tried the "backup your DB, Drop the local database and restaurations" but when I run the comand pg:backups:capture I get
An error occurred and the backup did not finish.
When I run the pg:backups:info
And trow me this:
2019-03-02 23:08:31 +0000 pg_dump: [archiver (db)] query failed:
ERROR: could not access file "$libdir/postgis-2.1": No such file or
directory ... (some database code) 2019-03-02 23:08:31 +0000
waiting for pg_dump to complete 2019-03-02 23:08:31 +0000 pg_dump
finished with errors
Then I found this entry
Update PostGIS extensions on Heroku
And found that it's the same problem that I have with heroku postgres, (but the author is using ruby) and the author says that was helped by the support team of Heroku. Well I create a ticket and find that "Technical support for Free applications is provided by the online community" and stackoverflow, so I tried to add a comment to this user to say samething like "hey, can you share the solution please? I have the same problem." but I haven't enough reputation to do it.
So what can I do?
I found the solution !!!
With an old db backup archive that I had, I reset the db from the heroku datastores section and after that I restored with the backup archive (with pgAdmin III) and the problem its gonne.
Its seems like the error was with postgis version, becouse when I had the problem my postgis version was 2.1.8 and now with the error solved my versión of postgis is 2.4.4.
I hope it is useful to someone.
Folks,
I'm trying to use Flyway on a shared Bluehost server and I'm getting a very cryptic error. Not sure how to troubleshoot.. I'm confident that the basic connection / credentials are working, since changing flyway config settings to a wrong password produces a different error.
Note that I'm able to connect to the database from the command line from the server box using 'mysql -u blah -p' just fine.
Any hints on how to troubleshoot the below? Output from flyway -X init is below.
Flyway config file: http://pastebin.com/8dsWE3W2
Output from ./flyway -X init
/usr/bin/tput
Flyway (Command-line Tool) v.3.0
DEBUG: Adding location to classpath: /home1/philost2/checkout/cocktailbuilder-master/server/_devtools/flyway/bin/../jars/mysql-connector-java-5.1.30-bin.jar
DEBUG: Adding location to classpath: /home1/philost2/checkout/cocktailbuilder-master/server/_devtools/flyway/bin/../jars/h2-1.3.170.jar
ERROR: Unexpected error
org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource (jdbc:mysql://localhost/philost2_cocktailbuilder_prod?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false) for user '<redacted>'
at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:266)
at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnection(DriverDataSource.java:226)
at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:50)
at org.flywaydb.core.Flyway.execute(Flyway.java:1144)
at org.flywaydb.core.Flyway.init(Flyway.java:970)
at org.flywaydb.commandline.Main.executeOperation(Main.java:118)
at org.flywaydb.commandline.Main.main(Main.java:88)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??????????????' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1049)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2832)
at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1937)
at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3720)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2554)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:413)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
at org.flywaydb.core.internal.util.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:264)
I have a MySQL server running on one PC (WinXP).
On another PC (WinXP), I'd like to backup tables to csv files so I have a c++ program connect to the MySQL database and then I issue a command like this:
SELECT data FROM table WHERE something=ABC
INTO OUTFILE c\tmp.txt
FIELDS TERMINATED BY ';'
OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY ";";
the data seems to get exported but on the Servers "c:\" not on my PC:s "c:\".
I can't just fetch the data over the LAN either as my program is running as a windows service.
I have seen this post but it seems I can't use "FIELDS TERMINATED BY" etc. with that solution.
Can I export csv data locally from a distant server or do I have to migrate the data locally first?
Problem "solved" : As it seems you can't do it in a 'simple' way, I run the service on the PC with MySQL and have a DCom server periodically move the data to the other PC.
Intended to be a comment (but I don't have enough rep points to comment). Not sure if you are able to install things, but you could try using cygwin + sqsh (http://www.sqsh.org/sqsh_home.html). I'm a linux user and sqsh is a great tool for grabbing data from databases.
SELECT ... INTO OUTFILE obviously writes the file on the local filesystem of the mysql-demon. One option might be to share a directory of your client-PC, open it on your server and use its path for the outfile-option. If this is not an option you might have to select the data in your c++ program and write it (kind of manually) to a local csv-file.
use the following command, if you don't want to install extra.
mysql -h remotedb.db -u ident -p -B -e "your query ;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > localfile.csv
-B means make the output as tab separated.