DB2 can't connect to the server - database

I am tring to set up a db2 server on a Windows 7 machine and I cant connect to database from remote, only from local. I think I might miss some configuration.
1) I turned off the firewall
2) my database information is:
Database 2 entry:
Database alias = SAMPLE
Database name = SAMPLE
Local database directory = C:
Database release level = f.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
Part of the output from netstat -a command is:
TCP [::]:49155 WIN-whatever:0 LISTENING
TCP [::]:49164 WIN-whatever:0 LISTENING
TCP [::]:49165 WIN-whatever:0 LISTENING
TCP [::]:50000 WIN-whatever:0 LISTENING
From the client if I ping my server it does not respond
Also if I scan it with nmap -sV <server_ip_address> it doesn't return me open ports and services which use it
From the client, to connect, I run the following commands:
db2 list node directory
SQL1027N The node directory cannot be found.
catalog tcpip node <i am not sure what does here> remote <server_ip_address> server <port_number>
no output
this implies that something is wrong. I tried couple of things for node and nothing works
I am have no idea what is going on and how to fix it.
Thank you for help

First of all, the fact that you cannot ping the server and nmap doesn't see the open ports means your problem, at least at this point, lies outside DB2. Once you fix your network issues, here's the procedure you can follow to set up remote connectivity to a DB2 database via TCP/IP.
1) Optional. You can use either a service name or a port number to configure the DB2 instance. If you want to use the service name, on the server add a line to /etc/services similar to db2c_db2inst1 50000/tcp, which assigns the service name "db2c_db2inst1" to the port 50000.
2) On the server update the DB2 instance configuration: db2 update dbm cfg using svcename db2c_db2inst1 (or db2 update dbm cfg using svcename 50000 if not using the service name). To verify: db2 get dbm cfg | grep SVCENAME.
3) On the server update the DB2 registry variable: db2set DB2COMM=TCPIP. To verify: db2set DB2COMM.
4) On the server restart the instance: issue db2stop force, then db2start.
5) On the remote client, assuming the DB2 client software is installed, issue db2 catalog tcpip node whatever remote <your server IP address> service <your DB2 port number>. Note that the node name ("whatever" in this example) is limited to 8 ASCII characters.
6) On the remote client issue db2 catalog database <your database name> at node whatever, referring to the node name ("whatever") that you defined in step 5.
7) On the remote client verify connectivity: db2 connect to <your database name> user <user name> using <password>

Try to do a telnet on the instance port to check that everything is right from the client to the server
telnet DB2-Server-name 50000
Where DB2-Server-name is the server name or IP address. Make sure you can get the server.
50000 is the most often DB2 port, but you have to check the configuration.
Once you get connection to the server, you can configure the node with the previous answer.

Related

SQL Server TCP/IP times out

I have to connect to a fresh SQL Server Express 2017 on a machine not part of my domain. I have configured
Mixed Mode Installation with sa with password
SSMS -> Server -> Properties -> Connections -> Allow remote connections
SQL Configuration Manager -> Instance "EXPRESS2017" -> TCP/IP: Enable and Active and Port 1438
Restarted the "SQL Server (EXPRESS2017)" service.
I now tried to access from a remote computer, and got a timeout. I then tried to connect from the local SSMS, which works without special settings, but when under options, forced "Protocol: TCP/IP" is set, with the same credentials as before, I also got a timeout.
So am I right that I can rule out the firewall or problems finding the instance, and everything points towards a configuration issue in TCP/IP protocol, or did I overlook some setting?
EDIT: I have disabled Windows firewall, and no other firewall is installed on the computer. I have restarted the computer. I also found this article about PortQry and had a check - locally:
C:\Users\Administrator\Downloads>PortQry.exe -n 172.17.41.124 -p UDP -e 1434
Querying target system called:
172.17.41.124
Attempting to resolve IP address to a name...
IP address resolved to WIN-AECL8CJVS7E.test.local
querying...
UDP port 1434 (ms-sql-m service): NOT LISTENING
EDIT: I have run NETSTAT and it seems no port in the 14xx range is open at all, although the SQL Server Browser service is running. I must be missing something there...
You did not show your connection string, but I suppose you use your instance name here.
In order to connect to SQL Server the network library has to know 2 things: IP address and a port. Your instance is named and uses non-default port 1438.
So your connection string should use 172.17.41.124,1438 as server name, or, alternatively, you can use instance name like this: 172.17.41.124\EXPRESS2017 but SQL Server Browser should run.

Connect Database to Excel via SSH tunnel

I am trying to connect Excel to my companies database but am running into problems because we use an SSH tunnel. The SSH tunnel connects to Nexcess which is where our servers are stored.
Has anyone else encountered this problem?
Any help is appreciated. Thanks!
Use putty, set up your SSH link to the server.
Under auth select 'allow agent forwarding'
In tunnels set source port to 3306 and then put the domain of your mysql server in the destination followed by :3306 (update this port number if your mysql server is on a different port obviously, but keep the local port the same)
Connect
In mysql workbench, add a new connection: localhost, port 3306, user / pass etc
Then from excel, connect away

Unable to connect to remote SQL server using SSIS

I am using Visual Studio 2012 s/w and going to create a SSIS project with OLEDB connection to connect to a remote SQL server. My Goal is to transfer data from one table to another table. I create a new connection manager and put the server name and db name. But when I clicked on test connection, every time it failed to connect. I am not sure what need to put in server name and where to put IP and port. please help me and provide the step by step process
First you should determine the activated protocols (TCP/IP, NetBios) and ports on the remote server with the SQL Configuration Manager / Network Services. If the SQL server is in standard configuration it will be port 1433.
If the remote server is not configured for TCP/IP and you're on a different network subnet with your dev machine, it is possible that you cannot get thru to the server.
You can check that with a ping or tracert. Try
only the servername
the FQDN like servername.sub-domain.domain.net
If TCP/IP is working with either the servername or the FQDN you create a SQL client configuration on your machine that corresponds to the name and the remote port you found out in the first step.
You can do that again with SQL Configuration Manager / Client Services or if not available you trick it by starting odbcad32.exe, creating a SQL Server 6 system or user DSN that represents your and progress to the point where you can click "Client configuration". When this is working with SSIS you may delete the DSN again. Only the SQL client configuration entry is important.
Another way is to create a .reg file and add it to the registry directly:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo]
"servername"="DBMSSOCN,servername.domain.net,1433"
That's out of the top of my head. Sorry that I cannot be more precise, but I have no actual SQL machine at hand here.

How can I set a remote computer as the target for MSSQL Server 2008 R2's Copy Database task?

The target database is located on a LAN with a local IP. The local IPs are distributed by my modem's DHCP server and is something like 192.168.1.xxx. I've already redirected port 1433 to the machine which holds the sql server (192.168.1.xxx) and I can reach to it with a SQL Management Studio connection, using my WAN IP from the source machine. However, when I write my WAN IP as the Copy Database task's target, it returns an error which indicates that connection cannot be established.
Might I be missing the writing convention for the target? I tried the following (my WAN IP is 78.187.xxx.xxx and my target MSSQL Server's name is EXP32):
78.187.xxx.xxx
78.187.xxx.xxx\EXP32
\\78.187.xxx.xxx
\\78.187.xxx.xxx\EXP32
GO TO
-> SQL server configuration manager
-> On network configuration -> protocol for mssqlserver -> enable except VIA
-> go to component services and on services restart sqlserver and express if you have

Databse Connection error By Giving Specific IP address-Drupal

I have created database and user and give all the privilege to the user.When i give the IP as Database host.It will show the following errors.Giving hostname as localhost it will work fine.
I am using phpmyadmin 3.3.2...
The error message is given below.
Failed to connect to your MySQL database server. MySQL reports the following message: Can't connect to MySQL server on '192.168.85.10' (111)
It seems that the IP address you use is your "external" IP and not the IP localhost would resolve to, which is most of the time your loopback: 127.0.0.1.
So if you are trying to connect from the same computer as the database is running you should use 127.0.0.1 as the IP address.
If you are trying to connect to your database from another computer on the network, you should enable MySQL remote access in your my.conf (MySQL config file). Because by default MySQL disables remote incoming connections.
You do this by setting the "bind-address" line to your real (external) server IP as such:
bind-address = 192.168.xx.xx (assuming its on your local network)
Or put the bind-address in comment.
Also make sure that the skip-networking option is commented as such:
#skip-networking
And then restart your MySQL server.
Now also make sure that your MySQL users are also allowed to connect from locations other then "#localhost".
I hope this helps!
Cheers,
Timusan

Resources