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).
Related
I'm trying to setup an easily-replicable (or even manual and I do it once a month or so) process for moving data from a large Azure PostgreSQL database to a more manageable Azure SQL database for end users that are most familiar with SQL Server. I've successfully connected to the PostgreSQL database via PGAdmin, so I know all my connection string info.
I started by installing the latest ODBC driver from here.
I then used a connection string which was given to me from the Azure portal, filled in the proper database name and password, and attempted to use the following drivers:
PostgreSQL ODBC Driver(UNICODE)
PostgreSQL ODBC Driver(ANSI)
I am getting the following error with either of them:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
What step am I missing in this process? Or how best can I troubleshoot this?
After more research, I attempted to add the ODBC driver here:
And got the following error (I'm not sure why Tableau is relevant to this?):
Thank you.
After about a year and half, I am finally able to connect to the DB2 database we have through dBeaver. The connection is successful as a LUW (Our db2 is z/os). I was able to get the drivers required after installing IBM Data Studio.
Once I am connected, I go down the schema, get to Tables, and on clicking that, I get the below error.
SQL Error [42704]: SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
THE DESCRIBE STATEMENT DOES NOT SPECIFY A PREPARED STATEMENT. SQLCODE=-516, SQLSTATE=26501, DRIVER=3.69.56
THE CURSOR SQL_CURLH200C1 IS NOT IN A PREPARED STATE. SQLCODE=-514, SQLSTATE=26501, DRIVER=3.69.56
SQL Error [42704]: SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
However, if ignore the error and go to New SQL query and write a simple
Select * from schema.table
it works fine and get the results I want.
Considering the time i have spent to get till here, this is sufficient, but to deploy as a solution in my department, I need to be able to look at a Table List (schema).
Any help would be awesome.
EDIT1: What the issue is here, is that there is no SCHEMA with the name SYSCAT and no table named SCHEMATA.
The z/OS Db2 catalog has different names than the ones used on Db2 on distributed (Linux Unix Windows aka LUW). Here is a list of objects on Db2 z/OS that you can review.
It looks like you are using dBeaver to navigate through a UI the objects on Db2 for z/OS. You will need to ensure you have a db2 jcc driver that is for z/OS Db2. It looks like you may be using one from LUW as the SYSCAT.SCHEMATA is an LUW object, not a z/OS object.
Your other query works because you are specifying a known table name. Other queries should be fine. The issue is the interface in dbeaver is looking at Db2 system objects for LUW and not z/OS. This will continue until you are able to resolve the driver issue.
The IBM Data Server Drivers also require server sided set-up. Please see this information https://www.ibm.com/support/knowledgecenter/SSEPEK_12.0.0/java/src/tpc/imjcc_jccenablespsandtables.html
In DBeaver, when you create a connection choose the "DB2 z/OS driver" option under the Db2 drop down, when connecting to DB2 for z/OS
BTW DBeaver can shell share with Data Studio, so you can (if you wish) use both products in one install. No guarantees that they share happily in all cases, but it appears to work reasonably well.
All,
I'm running a query on the target server that retrieves data from a source server. My query is using the digest function. Digest is on both servers. It is embedded in a UDF that is also present on both servers. BTW, the "select" portion of the query runs perfectly on the source server.
I would think that when you submit a remote query it will execute on the remote box. I am receiving a "1 function digest(text, unknown) does not exist ..." error. Also, since all the functions are in the public schema on both servers, I don't see how Postgres is failing is find the function.
Any help appreciated.
TIA,
Mike
Queries are executed on server specified in connection string. If no host was given, then on localhost. They are executed using role from connection string. That also includes search_path of that role.
Unrelated to your question, but I would try 2 things while debugging that issue you described:
Connect to remote server using the same role as dblink connection string and executing query
schema qualify that function in dblink: public.digest(..)
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.
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'