SAS Connection to DB2 Via ODBC Error - db2

I have been working in SAS connecting to DB2 via ODBC for a while now and this PROC SQL step generally works:
proc sql;
connect to odbc(dsn=DSQ user="UserID" password="Password");
execute (set current degree = 'ANY' ) by ODBC;
create table tempTable as select * from connection to odbc (
select *
from schemaName.tableName
);
quit;
However, occassionally I get the following error, and when I get this error I won't be able to run another ODBC query for quite some time because everytime I try to run the query I get the same error:
ERROR: CLI error trying to establish connection: [IBM][CLI Driver] SQL1042C An unexpected system
error occurred. SQLSTATE=58004
After some time the error either resolves itself or I do something that I am not aware of that fixes the issue. This is a very frustrating issue and since I never know how long this issue is going to persist I would like a more robust solution to this issue. I have checked the db2diag.log file and here is the part that describes this error:
2015-06-03-08.17.34.345000-300 I60888H446 LEVEL: Error
PID : 4452 TID : 7804 PROC : sas.exe
INSTANCE: DB2 NODE : 000
HOSTNAME:
EDUID : 7804
FUNCTION: DB2 Common, Cryptography, cryptDynamicLoadGSKitCrypto, probe:998
MESSAGE : ECF=0x90000007=-1879048185=ECF_UNKNOWN
Unknown
DATA #1 : unsigned integer, 4 bytes
60
DATA #2 : String, 11 bytes
gsk8sys.dll
I was trying to find an example to put in this post so I ran this snippet of code in SAS to see if the error would come back, however it seemed to have resolved the error because after running this piece of code, I ran the initial code and it worked. Here is the code that seemed to have resolved the issue.
proc sql;
connect to odbc(dsn=DSQ user="UserID" password="Password");
execute (set current degree = 'ANY' ) by ODBC;
create table column_names as select * from connection to odbc (
select * from sysibm.syscolumns
);
quit;
I have tried googling this issue, but there isn't much help on this particular error. Is there any reason that the second SAS code would have fixed the issue I was having? Is there any way to fix this problem so it won't come back in the future?
Please note, when the error occurs, I am still able to run queries via ODBC in Microsoft Access without any problems. It appears this is an issue with just a particular instance.
System Setup:
Windows 7 64-bit
SAS 9.3 (32)
DB2 v10.5.300.125
Thanks in advance for your help!
Update:
On a few occasions, I was able to go into task manager and delete some processes that were still running and then this issue would resolve itself, however today when this problem occurred, those processes weren't there. Any thoughts on this would be greatly appreciated.

The symptom may be depended on the installation order of Db2 connect and a program (sas.exe). If DB2 connect is installed first, it should not be occurred. So it is suggested to remove and re-install both products once then install Db2 connect first.
Hope this helps.

Related

AWS SCT error while connecting to PostgreSQL 13.4

I get the following error when trying to connect to postgres as a target using AWS SCT:
LOADER ERROR: Error executing 'load-contexts' query: org.postgresql.util.PSQLException: ERROR: relation "aws_oracle_context.context" does not exist'
It appears to occur on the LOADER step load-contexts
All steps for LOADER until that point executed successfully per the log file.
Why would it be looking for a relation that appears to be related to oracle?
Referenced relation triggering error: aws_oracle_context.context
Postgres RDS version: 13.4
AWS SCT version: 1.0.660
Postgres JDBC Driver: 42.3.3 and 42.2.19
Any ideas / insight would be appreciated!
It appears the fix is to un-check Server Level Objects completely for the PostgreSQL connection you create under the Servers drop-dwon on the right hand side of the SCT interface.
It's selected by default when you connect so the tool will always fail on that job step for PostgreSQL it seems. Other aspects of the tool seem to work fine.
If anyone has anymore insight into this, feel free to share!

ERROR: cannot execute SELECT in a read-only transaction when connecting to DB

When trying to connect to my Amazon PostgreSQL DB, I get the above error. With pgAdmin, I get "error saving properties".
I don't see why to connect to a server, I would do any write actions?
There are several reasons why you can get this error:
The PostgreSQL cluster is in recovery (or is a streaming replication standby). You can find out if that is the case by running
SELECT pg_is_in_recovery();
The parameter default_transaction_read_only is set to on. Diagnose with
SHOW default_transaction_read_only;
The current transaction has been started with
START TRANSACTION READ ONLY;
You can find out if that is the case using the undocumented parameter
SHOW transaction_read_only;
If you understand that, but still wonder why you are getting this error, since you are not aware that you attempted any data modifications, it would mean that the application that you use to connect tries to modify something (but pgAdmin shouldn't do that).
In that case, look into the log file to find out what statement causes the error.
This was a bug which is now fixed, Fix will be available in next release.
https://redmine.postgresql.org/issues/3973
If you want to try then you can use Nightly build and check: https://www.postgresql.org/ftp/pgadmin/pgadmin4/snapshots/2019-02-17/

DB2 Connection String

I have a problem connecting to DB2 through VBScript. I am using the connecting string as
Driver={IBM DB2 ODBC
DRIVER};Database=mydatabase;Hostname=myHostName;Port=myPortName;Protocol=TCPIP;Uid=myUserID;Pwd=myPassword;
Upon using the above connection string, I am getting an error message stating:
[IBM][CLI Driver] SQL3006 1N The database alias or database name
"myDatabase" was not found at the remote node. SQLSTATE=08004
Can anyone please suggest a solution for this? I tried using DBALIAS in place of Database, but it says the parameter is incorrect.
Suggestions?
Looks like your database name is incorrect.
You can find the correct value by issuing following query in either QMF or SPUFI :
SELECT CURRENT SERVER FROM SYSIBM.SYSDUMMY1
Yes, most likely incorrect database name has been specified. Also you can not perform SQL without connection as proposed by Vivek8086, bit you can try to find it in Db2 MSTR output in JES if you have ID on remote system or try to perform -DIS DDF Db2 command (if you know Db2 SYSID).

return null from select in oracle sql developer

I'm using oracle database 12c in windows x64.
I imported an oracle database(from a .dmp file). The detail information view from oracle sql developer shows:
NUM_ROWS:74524900; BLOCKS:1356877; AVG_ROW_LEN:126; SAMPLE_SIZE:2000
However, when I try to run sql commands:
select * from <table_name> where rownum<=10;
or select * from <table_name>;
I got nothing returned. And the status show the retrieved number of rows: 0 ("提取的所有行:0").
I also try to run these commands in cmd, and failed again. The returned information is "No row is selected" (未选定行).
Please help. Thx!
Thanks nop77svk. This is because I failed to import the table. A close look at the import log file show that the table failed to pass 8192 extension (oracle error 1653). A drawback of 42679603 lines occurred.
I guess I may need to import the table one by one. And turn on the autoextend option of the tablespaces.
Thanks anyway.

DB2 connect SQL1042C error

When I give DB2 CONNECT command I get the error saying "SQL1042C An unexpected system error occurred". The most weird thing is this issue is intermittant.
sqlcode: -1042;
sqlstate: 58004;
DB2 connect command: connect to dbname user db2admin using password;
My DB2 version is: DB2/NT64 9.5.0
There are a few directions in the Information Center on how you might be able to fix this error, one of which involves calling IBM for support.
Hope that helps!
Try to use
db2 "? sql-1042"
for more information.
On the other hand, if you just installed new db2 software code, try to use
db2iupdt instance_name
to update db2 instance.
You might find additional information in the file db2diag.log, which is located in a place like /home/db2inst1/sqllib/db2dump/db2diag.log . Or you can use the command db2diag with an option like db2diag -lastrecords 100
Actually SQL1042C can be happened with many reasons.
It's better to check db2diag.log first as it will give the idea about what this may be about.
And if that happens with DB activation by first connect,
db2stop
db2diag -A
db2start
db2 connect to dbname user db2admin using password
=> SQL1042C
Check what's recorded on new db2diag.log.
As William mentioned previously, 'db2iupdt' is the good attempt when you have no idea right away.
run db2iupdt,
looks like issues with binaries ,
let me know , when you got this error.
if possible upload following command output
db2diag -g 'level=Critical'