I'm using a scalable app on openshift and I'm trying to access its database from a local app but I am having trouble setting up the connection. I need to access my MySql 5.5 database.
IDE: Netbeans 7.4
I am using the environment variable values for the connection. I have no trouble connecting to it using my JBoss app in Openshift. Any help would be much appreciated. Sorry for the incomplete info. I am new here in SOF.
If you have the rhc client installed (see Client Tools Installation Guide if not), you can have it port forward to the server via rhc port-froward. Use localhost as the Host and port number it tells you, with the user name and password supplied from the application page.
Note this will only work when running locally, and the the rhc command will have to be running as well
See also 10.13. Port Forwarding
Related
I've been recently learning how databases work and how to write a service that can operate the database. So the situation is following:
I have a MySQL database ran on a localhost server (XAMPP). Accessing the database is simple: localhost:3036/my_database.
In addition to that, I wrote a Java Spring service (actually just copied the sample from https://github.com/spring-guides/gs-accessing-data-mysql.git) that is supposed to be an interface accepting curl requests and based on them to operate the database. So far so good. Everything works. The problem is that this service also runs on a localhost address: localhost:8080.
I would like to implement the MySQL server into my Spring service so that I can just run this service and the database will run and be hosted on the same port. The data is supposed to be available only through this service so I don't want an additional independent MySQL server to be running on a different localhost port.
At the end of the day, I would like to generate an executable jar file that when ran provides me the service on a localhost address and deals with locally stored database seamlessly.
Edit:
I wouldn't like my database to be independent form the service. I don't want to take care of running it and connecting to the service. What I'm searching for is sommething like #jr593 mentioned in the answers below, an embedded database. But is it possible for such databases to save the data locally on the device that the service is running beetwen service runs?
There is a few solution for this.
Change port for java app. It it's Spring Boot you could check property server.port and set it to e.g 8081.
You can chcek what is working on XAMPP on port 8080 and shoud down it (it could be apache or something else)
You don't need XAMPP to have MySQL on local host. You can stop/remove xampp and install standalone MySql, so you will take only port 3036 and nat 8080 and 3036.
You could use Docker with MySql image instead of XAMPP.
I am trying to connect locally by using pgAdmin or sql developer to the remote database. Database is on GCP however I dont know what I am missing.
On the screenshot
It is configured in GCP as a Cloud SQL instance and the problem is that initially It did not have public IP only private IP. So I exposed one by following the instruction from: https://cloud.google.com/sql/docs/postgres/authorize-networks#authorized-networks
This is how currently looks like (I am using username and password from the application.properties of a java project that is in VM instance to connect to sqlDeveloper):
screen of the configuration of CloudSql
And the configuration of the sql developer:
sqlDeveloper setup
There is definitely something missing or I am doing it wrong.
Can someone help me with connecting locally to the database.
I am totally new to GCP. I am used to configuration files like in tomcat context.xml
If you haven't a public IP, you can't connect your instance from outside GCP. So you can't (easily) from your local environment.
I wrote an article on this. Have a look, you will understand what's the problem and how to solve it (the hard way!)
I have a appengine-java-sdk1.9.34. I can to run app engine java project at a time one project in this app engine development server.
I need to run apps like appid.appspot.com. How to configure the appengine java sdk in local machine? And how to configure the customized local server as cloud platform with local domain(appid.appspot.com).
Most simple way will be to setup such hostname in /etc/hosts.
For Unix and MacOS it's located in /etc/hosts, and on Windows at C:\Windows\System32\Drivers\etc\hosts. Just add following into this file:
127.0.0.1 appid.appspot.com
And also you probably need to use port 80 instead of default 8080.
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
I am currently implementing a single signon solution for a customer that is based on Java, Tomcat and Kerberos.
Users are to access the URL of an intranet Tomcat application from their client browsers, the Tomcat application acquires the users' credentials via Kerberos and redirects them to the actual web application.
Our customer's environment is a typical mixture of a Windows AD server acting as the KDC and Linux Tomcat application servers. The SSO functionality is supposed to be used from both Windows and Linux clients. This is what appears to be different from most answers I can find on the net where people have Linux web application servers but only use Windows clients.
Now, in my local setup I get some strange behaviour. My development environment is a Tomcat 7.0.26 running from MyEclipse 8.6 under Windows 7. My test environment is a Tomcat 7.0.26 or 7.0.53 behind an Apache web server on a Centos 6 machine. I have set up the AD server correctly, generated the necessary keytab files etc. and everything is running smoothly in the development environment. I can access the Tomcat application from both Linux and Windows clients using IE and Firefox, Kerberos authentication proceeds and I get redirected properly.
When deploying the Tomcat application on the test server this keeps working when trying to sign on from Windows clients. However, when I try to access the test server from a Linux client (I have tried from Linux Mint 13 and Ubuntu 13.10), I get the following error:
javax.servlet.ServletException: GSSException: No credential found for: 1.3.6.1.5.2.51.3.6.1.5.2.5 usage: Accept
net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:233)
I have to admit that I do not properly understand this message. Does it point to a problem with the credentials supplied by the client or a problem with the application server negotiating with the KDC? I have done some research on this problem and have found out that the indicated oid 1.3.6.1.5.2.5 stands for GSS_IAKERB_MECHANISM and not GSS_KRB5_MECHANISM or GSS_SPNEGO_MECHANISM which I find strange. Also, nobody else appears to have exactly the same problem.
I have tried switching from MIT Kerberos to Heimdal Kerberos and back. I have tried Firefox and Chromium, on the application server I have switched between Tomcat 7.0.26 and 7.0.53, the problem still persists. I am using the latest spnego.jar.
Now: Calls from Linux to the Tomcat running on the Windows development machine succeed and calls from Linux clients to the Linux application server fail with the same error message for both browsers tried.
Any ideas on this one?
GSS_IAKERB_MECHANISM means that the client is not able to determine the realm/kdc to create a service ticket and asks the server to serve as an intermediate to the target KDC. Check Wireshark traffic. Your task now is to analyze why the client is not able to create a service ticket for that SPN. I have observed this issue on Heimdal on FreeBSD with Microsoft KDC.
So the problem ist not your Tomcat instance.