I’m trying to connect to a remote MySQL server via SSH in my Java project.
How can I integrate SSH connection with JPA?
I’m using Netbeans 6.9.1, JPA, MySQL 5.2.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume you want to tunnel to a remote mysql which only listens to localhost (or is firewalled)
The easiest way is then
setup a trust relationship between the account running the application server providig the JPA service to your application
create the tunnel using
ssh -L 3306:localhost:3306 mysql.server.orgto create a tunnel which will connect port 3306 on the appservers host to port 3306 on the mysql server’s localhost port.Configure JPA to connect to
localhost:3306