I’m facing an issue when I try to connect to PostgreSQL Database after connected SSH successfully. I’m using Java + JSCH library to help connect to DB PostgreSQL via SSH tunnel. Please help to take a look on my code: An exception is thrown at following step: Here is result: I used value above to connect PostgreSQL manually, using pgAdmin4,
Tag: jsch
Executing multiple commands over SSH “exec” channel on firewall device with Java JSch does not work
I referred the question Multiple bash commands and implemented as below. I am connecting to a device for which first command should be configure then only I will get a prompt to execute all other commands. I don’t get output for any of the commands and the control does not return. The following are the commands that work in terminal.
Providing input/subcommands to command executed over SSH with JSch
I’m trying to manage router via Java application using Jcraft Jsch library. I’m trying to send Router Config via TFTP server. The problem is in my Java code because this works with PuTTY. This my …
Running command using “exec” channel with JSch does not return any output
I am trying to execute a command on a Linux server using SSH from Android with JSch. As far as I know I am connecting to the server, but when I attempt to retrieve the results of the command I am getting nothing. Connect to server: Retrieve data: What am I missing here? Answer You disconnect immediately after you start
My JSch session doesn’t execute command
I’m trying to write a Java code that can ssh into a Unix server and reset a user’s password. So I tried to implement some of the code found in SO. Eg. Sending commands to remote server through ssh …
Kill process before disconnecting
I am using Jsch to tail a server-log. When I close my exec-channel and session, the “tail -f …” process still stays alive at server side. I tried to do channel.sendSignal(“KILL”) but it throws an exception: com.jcraft.jsch.JSchException: failed to send channel request how can I do a clean disconnect? Answer I know this is an old post but I’m posting
Using JSch, is there a way to tell if a remote file exists without doing an ls?
Using JSch, is there a way to tell if a remote file exists without doing an ls and looping through the files to find a name match? Thanks
JSchException: Algorithm negotiation fail
I am trying to connect to remote sftp server over ssh with JSch (0.1.44-1) but during session.connect(); I am getting this exception: Logs from JSch: I am able to log in to remote server with linux sftp command. I was trying to find any kind of clue in the internet but I failed. Debug output from linux sftp command: Answer
Connect to remote MySQL database through SSH using Java
How can I connect to remote MySQL database through SSH from java application? Small code example is helpful for me and I’d appreciate this. Answer My understanding is that you want to access a mysql server running on a remote machine and listening on let’s say port 3306 through a SSH tunnel. To create such a tunnel from port 1234