OpenShift Java application connection to external Amazon RDS Database - java

Amazon RDS Databases require that I supply the IP address of any machine that should be permitted to make connections. In my local Apache Tomcat development server, my Java application is able to connect to my Amazon RDS database, and I had to supply my computer's IP address to allow this connection.
Fast forward to deploying my application to OpenShift. My application is deployed successfully and I can get to my log in page. I created a test page on the application to output the OpenShift server IP address on which my application is running. I added that IP address to the security protocol on Amazon RDS just like I did for my local machine. However, the deployed application on Openshift is still not successfully making a connection to my Amazon RDS database.
I'm using the free OpenShift account. I'm wondering if the free account version doesn't permit external database connections? Or, am I not capturing the correct IP address of the OpenShift server where my application is stored?

In general, you can conduct an experiment:
Create a small function in your application - to fetch some URL at another server you have control over, that is you can read its access.log and it accepts connections from any IP.
Then run this function (by accessing your test page, using remote shell, or by scheduling a cron job).
And check the access.log.
So you will determinate IP address (if it is changed by some kind of proxy).
If nothing is logged, then it seems external connections are blocked.
You need to determinate IP address of openstack's Web Proxy.
See about Web Proxy and ports 8000, 8443 at https://developers.openshift.com/en/managing-port-binding-routing.html
If there are many such IPs, you can create SSH tunnel and forward one port, so your connection to the database will be local.

Related

call localhost web services --> connection refused

I have the problem. Let me describe the situation first.
I have setup the weblogic cluster in two machines on linux OS.
I have deployed the web application and web services on them.
In the web application, it will call "http://localhost:7201/BusinessLogic/services/AccountService?wsdl" web service. But it said connection refused in the log.
But if I change localhost to be ip address of one weblogic machine IP, it is working. e.g. "http://192.168.0.30:7201/BusinessLogic/services/AccountService?wsdl" where 192.168.0.30 is one of ip address of web application machine.
I have checked /etc/hosts, it has mapping 127.0.0.1 localhost.
I checked in my computer to use postman to call web service "http://192.168.0.30:7201/BusinessLogic/services/AccountService?wsdl", it is working. Of course, I cannot test localhost in my computer.
I also think is there a way to check localhost web service on linux machine. is there a way??
Where is the problem??
Please help!!!

Access localhost web application in network

I have deployed a web application in Apache tomcat server. Now I can use application in http://localhost:port_Number/appName.
I want to access appName from another computer which is connected in LAN.
I can see references involving WAMP, but I am simply using Apache tomcat.
First, you need to know your IP address of your server in your LAN. So you can access your server app like
http://192.168.1.100:8080/appName
Where 192.168.1.100 is your IP and "8080" is Tomcat Server port. After this, you have to check, if your Tomcat Server is listening to your LAN IP.

Connecting different user to 1 server(database derby) in netbeans using java

I made an inventory system in netbeans using the language java and i connect it to derby as my database it is already working as a whole system but I want to have a client-server functionality what I mean is I want my program to have a server which holds the database(different computer) and different users with different computers which they can save/view data at the same time to the database means they are connected in one network.
Working with multiple connections to a single database.
What code can I use or method or do I have to import something?
I did some research and the only thing that I found is socket which can be used to create a chat between server and a client.
But I only tried the IP 127.0.0.1 for the client since I am making running the server and the client in the same computer.
And also can I open the connection of the server in the client form and send data like SQLQuery so I can save it in the database of the server?
Where can I see examples for these? Please help thanks
Yes, Derby supports a client-server configuration of your application.
Deploying your application in the client-server configuration is straightforward:
Deploy the Derby Network Server, for example by running the startNetworkServer script that is included with the Derby distribution.
Ensure that derbyclient.jar is in your application's CLASSPATH, and that you register "org.apache.derby.jdbc.ClientDriver" with the JDBC DriverManager.
Change your JDBC Connection URL from jdbc:derby:<db details> to jdbc:derby://<host:port>/<db details>.
If this is your first time using Derby, I strongly recommend working your way through the Derby tutorial at https://db.apache.org/derby/docs/10.12/getstart/index.html
For more information about running the Derby Network Server to service database requests for your applications, read the Derby Admin Guide: https://db.apache.org/derby/docs/10.12/adminguide/index.html
Use the IP 0.0.0.0 or for all connections in the server. The the connection url should include the name of the server or the ip address of the server in the network. When you use ip 127.0.0.1 or localhost derby can only accept connections to the database in the same machine, in this case localhost. All of this can be done by your network application server

java: deploying web service on static IP and accessing from outside network

I have designed a REST Web Service in java and I'm running it locally on Apache Tomcat server.
Now I want to access the web service from outside my network. I have a static IP address.
How do I access it from another network?
after having chat with you, i can suggest following.
check if your network/firewall have port 8080 open. if not make it
open for communication.
try doing telnet to that IP with the port 8080 to check if that port is open
for connection to that machine, if not contact to your network
operator.
it seems connection problem to me more than service related issue.

Can't open web application made with Java EE on other local computers

I am trying to look the web application I made with Java EE. The server and database is up and running. It works on localhost:8080, but when I replace localhost with the local IP address all I get is a 404 error. Do I need to configure something?
On windows 7 open the firewall to allow incoming and outgoing traffic on port 8080. Then from the remote machine make sure that you can ping the server's ip address and then try to browse to the address.

Categories

Resources