User Tools

Site Tools


database:preconditions

Preconditions for database connectivity

Firewall ports between client and database are open

  • PostgreSQL : TCP 5432
  • MySQL: 3306
  • MS-SQL: TCP 1433

You can test connections to these ports with telnet:

telnet <db_address> <db_port>

Network route to db server exists AND is persistent

On Red Hat

:?: See also network configuration

Persistent routes can be added on the interface configuration files under /etc/sysconfig/network-scripts/

Create a file named “route-eth2” for routes on interface eth2. The config will be read on interface boot up.

192.168.63.32/27 via 192.168.63.254
192.168.63.0/27 via 192.168.63.254

On Windows

Add a persitent route over the command line:

route add -p 192.168.63.225 MASK 255.255.255.255 192.168.63.254

Database accepts connections from the client IP and from the db user

Check Database access from remote server

MySQL

mysql -u <username> -p -h <db server ip>

Simple php test script:

<?php
# php script to test mysql connectivity
# credentials have to be changed...
$user="root";
$password="";
$database="database";
$host="localhost";
 
# test connection
mysql_connect($host,$user,$password) or die("Unable to connect to database");
 
# test if database is accessible
@mysql_select_db($database) or die("Unable to select database");
mysql_close();
?>

PostgreSQL

psql -U <username> <databasename> -h <db server ip>

MS-SQL

sqlcmd  -U <login id> -P <password> -S <server name> -d <db name>
/srv/wiki.niwos.com/data/pages/database/preconditions.txt · Last modified: 2009/08/15 19:16 (external edit)