I am trying to use my local DB2 Express-C edition to access remotely a db2 database running on a remote machine at IP 192.168.48.189. The remote machine is running a DB2 Workgroup Server edition.
They are both version v10.1 and I am running them on LINUX.
First of all Is that possible?
When I try the following call it always returns me this error.
If I understood correctly
db2tcp1 is a new node I need to create on my local to be able to connect
db2inst1 is the db2 instance name of the remote db2 instance.
My local instance as well is named db2inst1 like the remote one.
Is my command below correct?
db2 "CATALOG TCPIP NODE db2tcp1 REMOTE 192.168.48.189 SERVER db2inst1"
SQL0512N A three-part name "" that references a remote object is not
supported in the context in which it appears. Reason Code = "".
You can catalog remote databases in your local installation, it does not matter the db2 edition. Your command has a problem with the "server", you put the port number there. I know, that is weird.
Once you have catalooged the instance you will catalog the databases. Make sure to open the ports between two servers.
Related
I have a use case where I have keep sync two databases on my local windows machine.
For example DB_primary and DB_secondary both has one table employee.
How to create a read replica to keep both those DBs in sync?
Please note: I am not using any cloud. I have Postgresql v14 installed on my windows machine.
I have installed postgresql on my new laptop (on Windows).
I see the service postgresql-x64-11 - PostgreSQL Server 11 is running and is automatic. Perfect.
I have installed "dbeaver" (21.21). I would like to create my first database via dbeaver. I always get this message:
Database postgres does not exist
Is it possible to create a database with dbeaver ? Or not ? Or must I do the creation with some command lines ?
I downloaded and installed on Windows the following:
IBM DB2 Runtime Client (64-Bit) 10.5
with the aim of connecting to a remote server database.
It installed here:
C:\Program Files\IBM\SQLLIB
But I don't see any DB2 folders in there.
I tried to catalog the remote db like this:
db2 catalog tcpip node testing remote the.server.com server 446
If I then try to connect to it, I get the following:
SQL1031N The database directory cannot be found on the indicated file system.
There is some wizard installed called the 'Default DB2 and IBM Database Client Interface Selection Wizard'. I ran this and it said it would create a default DB2 copy and would be used by default, called DB2COPY1 and it would be installed to C:\Program Files\IBM\SQLLIB.
But I'm nnot sure what this is doing really.
What do I need to do here to connect to the remote DB2??
EDIT:
I have managed to get a bit further based on this article here:
https://www-01.ibm.com/support/docview.wss?uid=swg21008914
my current commands look like:
db2 catalog tcpip node tstnode remote my.server.com server 446
db2 catalog db db1name as mytstdb at node tstnode authentication server
db2 catalog dcs db db1name as A123456DAT
db2 terminate
db2 connect to mytstdb user <username> using <password>
However the connect fails with:
SQL30061N The database alias or database name "A123456DAT " was not
found at the remote node. SQLSTATE=08004
Any ideas?
If you are connecting through port 446, I guess you are trying to connect to DB2 for IBM z or DB2 for IBM i. If yes, you will need at least Db2 Connect.
Regarding error "SQL30061N The database alias or database name "A123456DAT " was not found at the remote node. SQLSTATE=08004" it happens to me when the userid does not have some priviledges on the source system. If it is an IBM i, look at the corresponding spool file. DRDA Connections are attended by jobs called QRWTSRVR. With the IBM i command WRKSPLF SELECT(USERID) (changing USERID by the user trying the DRDA connection) you can see the spool files for jobs related to your connection. Usually spool file messages are very specific on the cause of the failure.
If you are trying to connect to DB2 on z, I don't have experience.
I have two instances on two separate AIX servers. Both DB2 databases are up with their sample databases. I want to connect with one DB2 instance from the other instance.
I am new on DB2 and want to know how can I do that.
I have executed following commands:
This path is client instance:
#. /home/db2inst2/sqllib/db2profile
db2 catalog tcpip node db2serverinst remote lpar1 server 50005 remote_instance ctginst1
db2 => terminate
DB20000I The TERMINATE command completed successfully.
# db2 connect to db2serverinst user ctginst1
Enter current password for ctginst1: SQL1031N The database directory cannot be found on the indicated file system.
SQLSTATE=58031
The term "Connect to an instance" is not correct. The correct one is to attach:
Machine A
db2inst1
db-1
db-2
sample
Machine B
db2inst2
db-3
db-4
sample
db2inst3
sample
If you want to execute commands from Machine A into Machine B, you have to catalog db2inst2 AND/OR db2inst3 in db2inst1 (catalog tcpip node). Remember that you have to give different names to each cataloged object.
Once you have cataloged a remote instance, you could also issue database commands, but you have to catalog remote databases. You can have a remote sample, and a local sample, but alias should be different.
If you cataloged db2inst2 instance as db2inst2 node in local node from Machine A.
And you cataloged sample database as sample-2 alias in local node from Machine A.
You could execute in Machine A.
db2 attach to db2inst2
db2 connect to sample-2
Attach is for 'administrative' things, like list applciations, create db, etc.
Connect is to use the database.
You have only cataloged DB2 instance. You need to catalog the database at the remote server:
db2 catalog database XXXX at node db2serverinst
Obviously, you'll need to replace the XXXX with the actual name of the remote database. Once you've cataloged the database, you can then connect:
db2 connect to XXXX user ctginst1
Note, this only defines the connection. You won't be able to access objects within this remote database from other databases within the local instance without configuring federation.
I am having problems trying to create a database with DB2 Express C (v9.7).
I already have a another version of DB2 installed on my system:
Product: DB2 Connect Enterprise Edition
Version: 8.2
Copy: DB2COPY1
Instance: DB2
I understand that it is possible to have coexistence.
Express C has seemingly installed OK on my laptop, and I am able to use the Sample Database without a problem. I created new copy DB2COPY2, and new instance DB2_01.
I've installed it as a DB2ADMN.
When I try and create a database I get the error:
SQL22223N The Instance "DB2_01" does not exist on host "host name".
It is saying that the instance does not exist on the host. Which is strange because I installed it locally as a DB2ADMN.
Coexistence is supported. You have to open correct CLP version, and
set db2instance=db2_01
db2cc
and then it should work. If it doesn't you have to probably uncatalog and re-catalog your node and databases.