I was doing the same configuration and after spending some hours I found the solution:
http://db.apache.org/derby/docs/10.2/adminguide/derbyadmin.pdf
Page 34:
By default, the Derby Network Server will only listen on the localhost (...)
One solution is to create a [derby.properties] file with the following content:
derby.drda.host=0.0.0.0
The place where you save the properties file may vary:
- in one machine for me it was directly under 'javadb', sibling of 'bin', 'lib', etc
- at my 2nd machine it was under the 'bin' directory, sibling of *.bat files.
To verify if your properties is being read (it doesn't exist at first, Derby doc explicitly tells that it won't create it for you), is to add this property as well:
derby.stream.error.file=derbyNewLog.log
If you execute
bin/startNetworkServer
it will create the new log file in case your properties is correctly being read.
After you confirm that your new properties file is being read, you can use the bin/ij tool to execute connect statements to your DB (both local and remote). This is how I could verify it quickly (my db name is 'differentRequestsAndPerformance'):
c:\glassfish4\javadb\bin>ij
ij version 10.10
ij> connect 'jdbc:derby://localhost:1527/differentRequestsAndPerformance';
ij> show tables;
TABLE_SCHEM |TABLE_NAME |REMARKS
------------------------------------------------------------------------
SYS |SYSALIASES |
(...)
ij> disconnect;
>> this 'connect' with localhost is expected to work always - you can append ';create=true' to the DB name in case it doesn't exist already; now change it to your remote ip (I'm assuming you previously confirmed with 'ping' command that you actually can see the server remote machine, otherwise it's a network problem, not a Derby problem)
ij> connect 'jdbc:derby://192.168.1.14:1527/differentRequestsAndPerformance';
ij> show tables;
TABLE_SCHEM |TABLE_NAME |REMARKS
------------------------------------------------------------------------
SYS |SYSALIASES |
(...)
ij> disconnect;
One additional comment: I'm not sure how much the 0.0.0.0 setting will open your machine to malicious software because I only wanted to verify my code and I disabled it right after I was satisfied. More research on this is required in case you want to use this for real programs.
In case your 'ij' tool complains about some driver, add the javadb/lib directory to the CLASSPATH system variable.
Another thing (obvious but better safe than sorry): this configuration must be set at the remote db (where your requests will arrive), in case like me you have 2 machines both with the database running.