Derby Database Access thorugh a local network LAN - networking

I created a java desktop application with derby client driver using netbeans 8.1.
I used this code to get connected to the database.
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/LibertySchool;create=true;user=liberty;password=liberty");
conn.setSchema("LIBERTY");
Statement s = conn.createStatement();
s.executeQuery("SELECT * FROM USUARIOS");
ResultSet rs = s.getResultSet();
if (rs.next()) {
Login entrar = new Login();
entrar.setVisible(true);
}
The standalone application is working normal on the pc that it was created on after build the dist file has the app.jar file and everything works normal.
I created this so few client computers can access the same application to update data. I have started the derby network on client machine, I have also change the connection from localhost to use the app database location ip server.
But my app does not work on clients on the same network only on the computer where it was built. Other applications that do not use databases works well over the network, it seems that derby database folder has to be moved also to the client machine.
I need to know how to set the client machine properly so users can access the app with the database.
Can someone please give some hints.

If you want to make a client-server connection with the client on a different machine than the server, you'll have to do several things:
Change localhost to a valid externally visible address for the server machine. You can use an IP address, or a host name, e.g., 192.168.1.104:1527 or Carlos-Mac-Pro.att.net:1527, but you're going to need to figure out the right network address to use. localhost:1527 will only work when the client and server are on the same machine.
Ensure that your network allows connections between the client machines and the server machine. Nowadays, most machines will, by default, prevent most inbound network connections from other machines, as a security measure, so you'll need to configure the server machine's firewall, as well as any network devices that are being used in your local network between the client machines and the server machine, to allow TCP/IP connections on port 1527.
I don't think you want to move the derby database folder to the client machines. That would be a completely different architecture for your application (embedded vs client-server). Here's some good background material about the differences between the two configurations: https://db.apache.org/derby/docs/10.13/getstart/cgsquck70629.html

Related

Configuring ODBC to remote web server (QuickBooks Remote Connector)

I have a local MAC machine that RDPs into a windows VM. On that windows VM/desktop I have Power BI Desktop installed along with the Cdata PowerBI/Quickbooks ODBC driver (https://www.cdata.com/drivers/quickbooks/download/powerbi/).
On a separate server (which I can RDP into from the virtual machine) I have quickbooks desktop installed (https://www.acecloudhosting.com/) and in single-user mode (opened a company file w/ an admin user). On that server I have also setup QuickBooks Remote Connector (http://remoteconnector.com/), which essentially is used to create an authenticated connection to QuickBooks. This "remote connector" also acts as a lightweight web server that listens for incoming requests (such as a power bi direct query) and uses that to communicate with Quickbooks hosted on a separate server.
However, I keep getting an HTTP protocol error and not sure if it is because the ports are not setup properly or if something in my ODBC connection is incorrect. It is very odd that I can RDP into the remote server from my VM, but when I try to ping the server my request time out despite allowing ICMP responses in the windows file sharing options so I find that odd.
I have worked on this for about 4 hours, but have run out of things to try.
http://cdn.cdata.com/help/RQB/odbc/pg_connectiono.htm

azure connect between azure myWebRole and nonazure server not working

My webapplication hosted on windows azure, needs to communicate with TFS Server. When any one login to my web app using live id, I want the logged in user to use my Team foundation server(TFS) credentials -username,password and domain to programatically authenticate and connect to our TFS server and create some work items.
I configured my azure connect for the communication to happen between azure WebRole and TFS server (our TFS is non-azure ).I added both the WebRole and the TFS Server into single Connection Group
In my azureportal ,I can see mywebrole and my TFSServer as connected the machine endpoint is active, and that it refreshes since the last connected updates
.But when I try to run my web application from azure and when it tries to communicate with our TFS server ,its throwing error message saying Error message : Team Foundation services are not available from server eg.,http://xyz-abcxyx-01:8080/tfs/eas/. Technical information (for administrator): The remote name could not be resolved: 'xyz-abcxyx-01'
Any suggestions to resolve this issue ?
You should enable remote desktop on your WebRole and connect to one of your instances. Then, try to ping the IP of your TFS server (not the hostname xyz-abcxyx-01). Maybe this is simply a DNS issue (even though using hostnames works with Windows Azure Connect).
If pinging the IP works, but pinging the hostname doesn't work you have a few options left:
Use the IP instead of the hostname. This won't work if you configured your TFS to use host headers.
Create an elevated startup task to modify the hosts file and map the IP to the hostname. In your code you can keep working with the hostname.
Try to modify the DNS server configured in your WebRole to use the default DNS server + your internal DNS server. But to me this doesn't look like a clean solution.
Anyways, in each solution you'll want to store the IP/hostname in the ServiceConfiguration and make sure your code supports changes to the ServiceConfiguration. This will allow you to change the IP/hostname without having to redeploy.
You should check if TFS server is listening on all network interfaces, include the one created by Azure Connect (start with 2a01). Next try to connect to TFS from a machine on the local LAN, just to make sure it is configured correctly. You don't need to use IP for referring to TFS, DNS name is definitely supported out of box.

Connecting to remote Glassfish hosted EJB

The application i'm currently working on start to enter in a pre-release phase.
In this phase, the server-side application components are to be deployed on Amazon VMs while the client-side application remains on the user machine.
This applications connects to server using JNDI and RMI to call remote EJB methods. This works well on localhost and local network.
But, when trying to connect to Amazon host, the application hangs up on context.lookup method. that's to say a JNDI context can be obtained from this remote server, but no lookup can be performed on that context.
What can I do to obtain good diagnostic on the failure ?
Are there logs that can be generated for the RMI handshake/whatever ?
Is there any way to see on server side if query really drive its way through the internet to the server ?
Also notice I've already enabled public IP usage on my Glassfish server (using recommended Oracle procedure).
EDIT According to a fast TCP capture on server, it seems that server receives the client context query with in-lan client address, which it of course isn't aware of :
query is
[3/27/2012 11:05:22 AM:169]
GIOP.......(................NameService....._is_a...................
NEO................ª.......(IDL:omg.org/SendingContext/CodeBase:1.0.
...........n........172.27.63.145.ܺ....¯«Ë........e................
........... ................... ... ...........&...............(IDL:
omg.org/CosNaming/NamingContext:1.0.
reply is
[3/27/2012 11:05:22 AM:171]
GIOP.......2............NEO................0.......(IDL:omg.org/Send
ingContext/CodeBase:1.0............ô........46.137.114.67.'5....¯
«Ë........d........................... ................... .........
.....&...........!...|...............$....f............10.241.42.208
.'6.#........g..............g........default...................g....
...........+IDL:omg.org/CosNaming/NamingContextExt:1.0..............
.......10.241.42.208.'5...M¯«Ë.... ...d... S1AS-ORB............Root
POA....TNameService............................... .................
.. ... ...........&......
(as read using SmartSniff ASCII output).
The IP in query (172.27.63.145) is my IP in my company LAN. From what I understand of communication over itnernet, it should be my company LAN public IP, no ? How can I make Glassfish client udnerstand it should use that IP ?
Diagnostic has been clearly obtained : the client, which connects from a LAN to the server, sends its own internal network private address to server, which server can't forward any answer to. As a consequence, server doesn't answer, hence the hangup.

Accessing remote web application using LogMeIn Hamachi2

I am trying to remotely access a web application hosted on the office LAN.
I have setup LogMeIN Hamachi and I can connect to an office machine and see shared resources (folders and printers) on that machine.
I selected a Hub-and-spoke network and made the machine with the web app the hub.
While in the office I type http://192.168.1.6:8080/mituz_oc in my browser to get access to the web app.
However, when I try to do the same remotely I get the message "Firefox can't establish a connection to the server at 192.168.1.6:8080."
So I see that the IP address to the computer I have VPN-ed to is 5.14.212.196 and so I try to gain access to the web app by replacing the office LAN's IP with the Hamachi IP (I can only post one hyperlink hence the verbose alternative )
I get the same error message as before, only this time with the HAMACHI IP address.
I can access all the shared resources but can not access the web app.
Is it possible to do what am attempting - remotely access a web application on office server?
If so what am I doing wrong / not doing ?
TIA.
Clemens
1) Check if your Windows Personal Firewall setting blocks connections from Hamachi's 5.x.x.x IP address ranges.
2) Check if your Web Server listens on 5.x.x.x. You can find it out by this command:
netstat -na
Look for local address of "0.0.0.0:8080" which is in the state of "LISTENING".
3) Replace Hamachi with different VPN provider, like www.remobo.com
(Disclosure: I work for the Remobo team)

Could not open a connection to SQL Server

I have problems connecting to my database server. The database server is not local, I am connected via its IP address.
It works fine in my development machine. After publishing the website to my server, it can not connect to my database server.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Why can't my publish server connect to the database server, whereas it works fine through the development machine?
I often had that problem. Mostly it's because of two problems.
Open the SQL Server Configuration Manager.
Check if the SQL Server Network Configuration supports TCP/IP, if it's disabled, enable it.
e.g. SqlServer 2005 Network Configuration, Protocols for SQLEXPRESS
Open the SQL Server Management Studio
Click on the Sql Server Properties (right click on the server name and
select properties).
After that, select the page "Security" and switch the check to "SQL Server and Windows Authentication mode".
That's all.
I'll attempt to go two for two on the psychic debugging for today...
I will assume that you are not using integrated security? If so it might explain things as the account on your local machine probably has permissions, but the SYSTEM account that is running on the server does not. Just a shot in the dark though.
It sounds like your server can't make the network connection, rather than a security issue.
Ensure that any firewalls on both the DB and app servers allow traffic on the port (1433).
Ensure you're able to ping or tracert from both machines.
Is it your first time you publish your website on the web server ? if it is , Are you sure you have set your connection string properly ?
You need to create a login ( of curse a password for that too ) and the IP Address of that SQL on the web server .
So you need IP Address of the sql server host , Database Name , UId , Pwd .
I will agree that this sounds like a network issue and not a security issue.
Remote into the web server and ping the DB server by IP address. If this does not work, your server cannot see the DB server via that address (different subnet, incorrect firewall/proxy setup, etc). There may be a proxy address you must use to get to the DB server from the web server, or your web server may also be the gateway and IIS doesn't know to look for the DB server on the LAN. If it does work, the computers may not be talking on the same port, or the firewall may be blocking that port exiting the web server.
I have spent hours trying to connect to SQL server using sqlcmd. I disabled my firewall, checked all ip listed in "Protocols for SQLEXPRESS", edited my hosts file. I tried using different ips and machinename to connect to the server. But none of work worked. After hours of investigation, I found out that I made absolutely stupid blunder making me unable to connect.
I want to remind people that the connection string is not case sensitive. But the option is!!
what i did is I put
sqlcmd -s .\sqlserver
But the correct string is
sqlcmd -S .\sqlserver
so watch out, people

Resources