SSH connection with Java

Use JSch import com.jcraft.jsch.*; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Scanner; /** * @author World */ public class SSHReadFile { public static void main(String args[]) { String user = “john”; String password = “mypassword”; String host = “192.168.100.23”; int port = 22; String remoteFile = “/home/john/test.txt”; try { JSch jsch = new JSch(); Session session = … Read more

Help troubleshooting SqlException: Timeout expired on connection, in a non-load situation

Not Enough Memory This is very likely a Memory problem, perhaps aggravated or triggered by other things, but still inherently a memory problem. there are two other (less likely) possibilities, that you should check and eliminate first (because it is easy to do so): Easy To Check Possibilities: You may have “Auto Close” enabled: Auto … Read more

ansible SSH connection fail

You need to change the ansible_ssh_pass as well or ssh key, for example I am using this in my inventory file: 192.168.33.100 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant After that I can connect to the remote host: ansible all -i tests -m ping With the following result: 192.168.33.100 | SUCCESS => { “changed”: false, “ping”: “pong” } Hope that … Read more

Python requests – Exception Type: ConnectionError – try: except does not work

You should not exit your worker instance sys.exit(1) Furthermore you ‘re catching the wrong Error. What you could do for for example is: from requests.exceptions import ConnectionError try: r = requests.get(“http://example.com”, timeout=0.001) except ConnectionError as e: # This is the correct syntax print e r = “No response” In this case your program will continue, … Read more

Connecting to multiple databases in ruby on rails

For multiple database connection, you need to add the following codes to the database.yml file. Here, I am giving the example of connecting two databases from a rails application config/database.yml development: adapter: mysql2 database: db1_dev username: root password: xyz host: localhost development_sec: adapter: mysql2 database: db2_dev username: root password: xyz host: localhost production: adapter: mysql2 … Read more

Python psycopg2 timeout

When using the keyword arguments syntax to the connect function it is possible to use any of the libpd supported connection parameters. Among those there is connect_timeout in seconds: db = psycopg2.connect ( host=dhost, database=ddatabase, user=duser, password=dpassword, connect_timeout=3 ) http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS http://initd.org/psycopg/docs/module.html A connection time out raises an OperationalError exception.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)