patternMinor
DB2 Defining remote database alias
Viewed 0 times
db2databaseremotealiasdefining
Problem
I'm using DB2 9.7.0.3 for AIX.
I want to select data from a remote database, also running DB2 9.7.0.3 for AIX, and insert it into the local database I'm connected to.
I believe the query for this is
How do I define REMOTEDB as an alias to a remote database connection?
I want to select data from a remote database, also running DB2 9.7.0.3 for AIX, and insert it into the local database I'm connected to.
I believe the query for this is
INSERT INTO SCHEMA.TABLE
SELECT * FROM REMOTEDB.SCHEMA.TABLEHow do I define REMOTEDB as an alias to a remote database connection?
Solution
First you need to catalog the remote instance.
Issue
Now you can actually catalog the remote database.
And once again issue
Here is an example of what this could look like:
Now you can connect to that local database using either the db name (crmdb) or the alias name (remotedb) depending on your needs.
Note: Sometimes you can run into issues where it will say things about a null package id. This would mean that particular packages need to be bound for the connection to work. Easiest way to solve this is to have your instance owner id (of the remote database) make the first connection and then disconnect or to have your id you are using have
db2 catalog tcpip node remote server Issue
db2 terminate to make sure the catalog entry remains.Now you can actually catalog the remote database.
db2 catalog db as at node And once again issue
db2 terminateHere is an example of what this could look like:
db2 catalog tcpip node devinst1 remote devservera server 50100;
db2 terminate;
db2 catalog db crmdb as remotedb at node devinst1;
db2 terminate;Now you can connect to that local database using either the db name (crmdb) or the alias name (remotedb) depending on your needs.
Note: Sometimes you can run into issues where it will say things about a null package id. This would mean that particular packages need to be bound for the connection to work. Easiest way to solve this is to have your instance owner id (of the remote database) make the first connection and then disconnect or to have your id you are using have
BINDADD authority. Then the correct packages will get bound. You may not run into this, especially if you are on the same version and fix pack level of DB. If you ever differ between "client" and "server" is when you for sure have to do this.Code Snippets
db2 catalog tcpip node <my alias node name> remote <host or host alias name> server <port>db2 catalog db <remote database name> as <local alias> at node <node alias supplied above>db2 catalog tcpip node devinst1 remote devservera server 50100;
db2 terminate;
db2 catalog db crmdb as remotedb at node devinst1;
db2 terminate;Context
StackExchange Database Administrators Q#29899, answer score: 2
Revisions (0)
No revisions yet.