[jira] [Issue Comment Deleted] (DERBY-5411) Client that does not have Security manager permission to connect gets "ERROR 08006: Insufficient data while reading from the network" Message should be clea

2019-03-08 Thread Kavin Ranawella (JIRA)


 [ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kavin Ranawella updated DERBY-5411:
---
Comment: was deleted

(was: Can you please explain the steps that were followed to get the resulting 
errors? And the running of the .sh is not clear.)

> Client that does not have Security manager permission to connect gets "ERROR 
> 08006: Insufficient data while reading from the network" Message should be 
> clearer
> ---
>
> Key: DERBY-5411
> URL: https://issues.apache.org/jira/browse/DERBY-5411
> Project: Derby
>  Issue Type: Bug
>  Components: Network Client
>Affects Versions: 10.8.2.2
>Reporter: Kathey Marsden
>Priority: Minor
>  Labels: derby_triage10_9
>
> I was doing a little remote testing for the release candidate and noticed if 
> a machine does not have permission to connect, then the client shows the 
> following exception:
> ij> connect  'jdbc:derby://x.xx.xxx.xx:1527/wombat';
> ERROR 08006: Insufficient data while reading from the network - expected a 
> minimum of 6 bytes and received only 0 bytes.  The connection has been term
> inated.
> java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
> from the network - expected a minimum of 6 bytes and received only 0 byte
> s.  The connection has been terminated.
> at 
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
> at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
> Source)
> at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager.java:322)
> at java.sql.DriverManager.getConnection(DriverManager.java:297)
> at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
> at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
> at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
> at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown 
> Source)
> at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
> at org.apache.derby.tools.ij.main(Unknown Source)
> Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
> while reading from the network - expected a minimum of 6 bytes and receiv
> ed only 0 bytes.  The connection has been terminated.
> at org.apache.derby.client.net.Reply.fill(Unknown Source)
> at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
> Source)
> at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
> at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
> Source)
> at 
> org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
> at org.apache.derby.client.net.NetConnection.flowConnect(Unknown 
> Source)
> at org.apache.derby.client.net.NetConnection.(Unknown Source)
> at org.apache.derby.client.net.NetConnection40.(Unknown Source)
> at 
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
>  Source)
> ... 12 more
> It would be good to have a clearer error message:
> To Reproduce, use the script and policy file below changing the url for 
> derby.codejars to the correct path for  your enviroment also in the policy 
> file my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
> disallowed host.  Then try to connect from the disllowed host with connect  
> 'jdbc:derby://x.x.x.x:1527/wombat';
> Script startServer.sh:
> java  -Djava.security.manager 
> -Dderby.codejars="file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/"
>  -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerControl 
> start -h 0.0.0.0
> Policy File my.policy (change x.

[jira] [Assigned] (DERBY-5411) Client that does not have Security manager permission to connect gets "ERROR 08006: Insufficient data while reading from the network" Message should be clearer

2018-08-12 Thread Kavin Ranawella (JIRA)


 [ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kavin Ranawella reassigned DERBY-5411:
--

Assignee: (was: Kavin Ranawella)

> Client that does not have Security manager permission to connect gets "ERROR 
> 08006: Insufficient data while reading from the network" Message should be 
> clearer
> ---
>
> Key: DERBY-5411
> URL: https://issues.apache.org/jira/browse/DERBY-5411
> Project: Derby
>  Issue Type: Bug
>  Components: Network Client
>Affects Versions: 10.8.2.2
>Reporter: Kathey Marsden
>Priority: Minor
>  Labels: derby_triage10_9
>
> I was doing a little remote testing for the release candidate and noticed if 
> a machine does not have permission to connect, then the client shows the 
> following exception:
> ij> connect  'jdbc:derby://x.xx.xxx.xx:1527/wombat';
> ERROR 08006: Insufficient data while reading from the network - expected a 
> minimum of 6 bytes and received only 0 bytes.  The connection has been term
> inated.
> java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
> from the network - expected a minimum of 6 bytes and received only 0 byte
> s.  The connection has been terminated.
> at 
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
> at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
> Source)
> at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager.java:322)
> at java.sql.DriverManager.getConnection(DriverManager.java:297)
> at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
> at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
> at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
> at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown 
> Source)
> at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
> at org.apache.derby.tools.ij.main(Unknown Source)
> Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
> while reading from the network - expected a minimum of 6 bytes and receiv
> ed only 0 bytes.  The connection has been terminated.
> at org.apache.derby.client.net.Reply.fill(Unknown Source)
> at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
> Source)
> at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
> at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
> Source)
> at 
> org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
> at org.apache.derby.client.net.NetConnection.flowConnect(Unknown 
> Source)
> at org.apache.derby.client.net.NetConnection.(Unknown Source)
> at org.apache.derby.client.net.NetConnection40.(Unknown Source)
> at 
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
>  Source)
> ... 12 more
> It would be good to have a clearer error message:
> To Reproduce, use the script and policy file below changing the url for 
> derby.codejars to the correct path for  your enviroment also in the policy 
> file my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
> disallowed host.  Then try to connect from the disllowed host with connect  
> 'jdbc:derby://x.x.x.x:1527/wombat';
> Script startServer.sh:
> java  -Djava.security.manager 
> -Dderby.codejars="file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/"
>  -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerControl 
> start -h 0.0.0.0
> Policy File my.policy (change x.x.x.x and y.y.y.y) to the allowed and 
> disallowed host respectively. )Since the y.y.y.y li

[jira] [Commented] (DERBY-5411) Client that does not have Security manager permission to connect gets "ERROR 08006: Insufficient data while reading from the network" Message should be clearer

2017-09-25 Thread Kavin Ranawella (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16180070#comment-16180070
 ] 

Kavin Ranawella commented on DERBY-5411:


Can you please explain the steps that were followed to get the resulting 
errors? And the running of the .sh is not clear.

> Client that does not have Security manager permission to connect gets "ERROR 
> 08006: Insufficient data while reading from the network" Message should be 
> clearer
> ---
>
> Key: DERBY-5411
> URL: https://issues.apache.org/jira/browse/DERBY-5411
> Project: Derby
>  Issue Type: Bug
>  Components: Network Client
>Affects Versions: 10.8.2.2
>Reporter: Kathey Marsden
>Assignee: Kavin Ranawella
>Priority: Minor
>  Labels: derby_triage10_9
>
> I was doing a little remote testing for the release candidate and noticed if 
> a machine does not have permission to connect, then the client shows the 
> following exception:
> ij> connect  'jdbc:derby://x.xx.xxx.xx:1527/wombat';
> ERROR 08006: Insufficient data while reading from the network - expected a 
> minimum of 6 bytes and received only 0 bytes.  The connection has been term
> inated.
> java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
> from the network - expected a minimum of 6 bytes and received only 0 byte
> s.  The connection has been terminated.
> at 
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
> at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
> Source)
> at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager.java:322)
> at java.sql.DriverManager.getConnection(DriverManager.java:297)
> at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
> at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
> at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
> at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown 
> Source)
> at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
> at org.apache.derby.tools.ij.main(Unknown Source)
> Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
> while reading from the network - expected a minimum of 6 bytes and receiv
> ed only 0 bytes.  The connection has been terminated.
> at org.apache.derby.client.net.Reply.fill(Unknown Source)
> at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
> Source)
> at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
> at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
> Source)
> at 
> org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
> at org.apache.derby.client.net.NetConnection.flowConnect(Unknown 
> Source)
> at org.apache.derby.client.net.NetConnection.(Unknown Source)
> at org.apache.derby.client.net.NetConnection40.(Unknown Source)
> at 
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
>  Source)
> ... 12 more
> It would be good to have a clearer error message:
> To Reproduce, use the script and policy file below changing the url for 
> derby.codejars to the correct path for  your enviroment also in the policy 
> file my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
> disallowed host.  Then try to connect from the disllowed host with connect  
> 'jdbc:derby://x.x.x.x:1527/wombat';
> Script startServer.sh:
> java  -Djava.security.manager 
> -Dderby.codejars="file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/"
>  -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerCont

DERBY-5411

2017-09-05 Thread RANAWELLAGE LILANTHA KAVIN RANAWELLA
Can you please explain the steps that were followed to get the resulting
errors? And the running of the .sh is not clear.

-- 
Kavin


[jira] [Assigned] (DERBY-5411) Client that does not have Security manager permission to connect gets "ERROR 08006: Insufficient data while reading from the network" Message should be clearer

2017-07-18 Thread Bryan Pendleton (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bryan Pendleton reassigned DERBY-5411:
--

Assignee: Kavin Ranawella

> Client that does not have Security manager permission to connect gets "ERROR 
> 08006: Insufficient data while reading from the network" Message should be 
> clearer
> ---
>
> Key: DERBY-5411
> URL: https://issues.apache.org/jira/browse/DERBY-5411
> Project: Derby
>  Issue Type: Bug
>  Components: Network Client
>Affects Versions: 10.8.2.2
>Reporter: Kathey Marsden
>Assignee: Kavin Ranawella
>Priority: Minor
>  Labels: derby_triage10_9
>
> I was doing a little remote testing for the release candidate and noticed if 
> a machine does not have permission to connect, then the client shows the 
> following exception:
> ij> connect  'jdbc:derby://x.xx.xxx.xx:1527/wombat';
> ERROR 08006: Insufficient data while reading from the network - expected a 
> minimum of 6 bytes and received only 0 bytes.  The connection has been term
> inated.
> java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
> from the network - expected a minimum of 6 bytes and received only 0 byte
> s.  The connection has been terminated.
> at 
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
> at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
> Source)
> at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager.java:322)
> at java.sql.DriverManager.getConnection(DriverManager.java:297)
> at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
> at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
> at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
> at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown 
> Source)
> at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
> at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
> at org.apache.derby.tools.ij.main(Unknown Source)
> Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
> while reading from the network - expected a minimum of 6 bytes and receiv
> ed only 0 bytes.  The connection has been terminated.
> at org.apache.derby.client.net.Reply.fill(Unknown Source)
> at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
> Source)
> at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
> at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
> Source)
> at 
> org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
>  Source)
> at 
> org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
> at org.apache.derby.client.net.NetConnection.flowConnect(Unknown 
> Source)
> at org.apache.derby.client.net.NetConnection.(Unknown Source)
> at org.apache.derby.client.net.NetConnection40.(Unknown Source)
> at 
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
>  Source)
> ... 12 more
> It would be good to have a clearer error message:
> To Reproduce, use the script and policy file below changing the url for 
> derby.codejars to the correct path for  your enviroment also in the policy 
> file my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
> disallowed host.  Then try to connect from the disllowed host with connect  
> 'jdbc:derby://x.x.x.x:1527/wombat';
> Script startServer.sh:
> java  -Djava.security.manager 
> -Dderby.codejars="file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/"
>  -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerControl 
> start -h 0.0.0.0
> Policy File my.policy (change x.x.x.x and y.y.y.y) to the allowed and 
> disallowed host resp

[jira] [Updated] (DERBY-5411) Client that does not have Security manager permission to connect gets ERROR 08006: Insufficient data while reading from the network Message should be clearer

2012-09-27 Thread Kathey Marsden (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kathey Marsden updated DERBY-5411:
--

Description: 
I was doing a little remote testing for the release candidate and noticed if a 
machine does not have permission to connect, then the client shows the 
following exception:
ij connect  'jdbc:derby://x.xx.xxx.xx:1527/wombat';
ERROR 08006: Insufficient data while reading from the network - expected a 
minimum of 6 bytes and received only 0 bytes.  The connection has been term
inated.
java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
from the network - expected a minimum of 6 bytes and received only 0 byte
s.  The connection has been terminated.
at 
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
Source)
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:322)
at java.sql.DriverManager.getConnection(DriverManager.java:297)
at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
at org.apache.derby.tools.ij.main(Unknown Source)
Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
while reading from the network - expected a minimum of 6 bytes and receiv
ed only 0 bytes.  The connection has been terminated.
at org.apache.derby.client.net.Reply.fill(Unknown Source)
at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
Source)
at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
Source)
at 
org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
 Source)
at 
org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
 Source)
at 
org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
 Source)
at 
org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
at org.apache.derby.client.net.NetConnection.init(Unknown Source)
at org.apache.derby.client.net.NetConnection40.init(Unknown Source)
at 
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
 Source)
... 12 more

It would be good to have a clearer error message:

To Reproduce, use the script and policy file below changing the url for 
derby.codejars to the correct path for  your enviroment also in the policy file 
my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
disallowed host.  Then try to connect from the disllowed host with connect  
'jdbc:derby://x.x.x.x:1527/wombat';

Script startServer.sh:
java  -Djava.security.manager 
-Dderby.codejars=file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/
 -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerControl 
start -h 0.0.0.0

Policy File my.policy (change x.x.x.x and y.y.y.y) to the allowed and 
disallowed host respectively. )Since the y.y.y.y line is commented it is not 
really relevant except for testing that remote connections work properly)


grant codeBase ${derby.codejars}derby.jar
{
//
// These permissions are needed for everyday, embedded Derby usage.
//
  permission java.lang.RuntimePermission createClassLoader;
  permission java.util.PropertyPermission derby.*, read;
  permission java.util.PropertyPermission user.dir, read;
  permission java.util.PropertyPermission derby.storage.jvmInstanceId, 
  write; 
  permission java.io.FilePermission ${user.dir}${/}-, read;
  permission java.io.FilePermission ${derby.system.home},read;
  permission java.io.FilePermission ${derby.system.home}${/}-, 
read,write,delete;

//
// This permission lets a DBA reload the policy file while the server
// is still running. The policy file is reloaded by invoking the
// SYSCS_UTIL.SYSCS_RELOAD_SECURITY_POLICY() system procedure.
//
  permission java.security.SecurityPermission getPolicy;

//
// This permission lets you backup and restore databases
// to and from arbitrary locations in your file system.
//
// This permission also lets you import/export data

[jira] [Updated] (DERBY-5411) Client that does not have Security manager permission to connect gets ERROR 08006: Insufficient data while reading from the network Message should be clearer

2012-02-17 Thread Kathey Marsden (Updated) (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kathey Marsden updated DERBY-5411:
--

Urgency: Low
 Labels: derby_triage10_9  (was: )

Triaging for 10.9. Marking urgency as low as the problem is that with incorrect 
usage (incorrect permissions) we throw an ugly and informative error instead of 
an informative one.

 Client that does not have Security manager permission to connect gets ERROR 
 08006: Insufficient data while reading from the network Message should be 
 clearer
 ---

 Key: DERBY-5411
 URL: https://issues.apache.org/jira/browse/DERBY-5411
 Project: Derby
  Issue Type: Bug
  Components: Network Client
Affects Versions: 10.8.2.2
Reporter: Kathey Marsden
Priority: Minor
  Labels: derby_triage10_9

 I was doing a little remote testing for the release candidate and noticed if 
 a machine does not have permission to connect, then the client shows the 
 following exception:
 ij connect  'jdbc:derby://9.72.133.41:1527/wombat';
 ERROR 08006: Insufficient data while reading from the network - expected a 
 minimum of 6 bytes and received only 0 bytes.  The connection has been term
 inated.
 java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
 from the network - expected a minimum of 6 bytes and received only 0 byte
 s.  The connection has been terminated.
 at 
 org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
 Source)
 at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
 Source)
 at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
 at java.sql.DriverManager.getConnection(DriverManager.java:322)
 at java.sql.DriverManager.getConnection(DriverManager.java:297)
 at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
 at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
 at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
 at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown 
 Source)
 at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
 at org.apache.derby.tools.ij.main(Unknown Source)
 Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
 while reading from the network - expected a minimum of 6 bytes and receiv
 ed only 0 bytes.  The connection has been terminated.
 at org.apache.derby.client.net.Reply.fill(Unknown Source)
 at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
 Source)
 at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
 at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
 Source)
 at 
 org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
 at org.apache.derby.client.net.NetConnection.flowConnect(Unknown 
 Source)
 at org.apache.derby.client.net.NetConnection.init(Unknown Source)
 at org.apache.derby.client.net.NetConnection40.init(Unknown Source)
 at 
 org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
  Source)
 ... 12 more
 It would be good to have a clearer error message:
 To Reproduce, use the script and policy file below changing the url for 
 derby.codejars to the correct path for  your enviroment also in the policy 
 file my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
 disallowed host.  Then try to connect from the disllowed host with connect  
 'jdbc:derby://x.x.x.x:1527/wombat';
 Script startServer.sh:
 java  -Djava.security.manager 
 -Dderby.codejars=file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/
  -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerControl 
 start -h 0.0.0.0
 Policy File my.policy (change x.x.x.x and y.y.y.y) to the allowed and 
 disallowed host respectively. )Since the y.y.y.y line is commented it is not 
 really relevant except for testing that remote connections work properly)
 grant codeBase ${derby.codejars}derby.jar

[jira] [Updated] (DERBY-5411) Client that does not have Security manager permission to connect gets ERROR 08006: Insufficient data while reading from the network Message should be clearer

2012-02-15 Thread Kathey Marsden (Updated) (JIRA)

 [ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kathey Marsden updated DERBY-5411:
--

Component/s: Network Client

 Client that does not have Security manager permission to connect gets ERROR 
 08006: Insufficient data while reading from the network Message should be 
 clearer
 ---

 Key: DERBY-5411
 URL: https://issues.apache.org/jira/browse/DERBY-5411
 Project: Derby
  Issue Type: Bug
  Components: Network Client
Affects Versions: 10.8.2.2
Reporter: Kathey Marsden
Priority: Minor

 I was doing a little remote testing for the release candidate and noticed if 
 a machine does not have permission to connect, then the client shows the 
 following exception:
 ij connect  'jdbc:derby://9.72.133.41:1527/wombat';
 ERROR 08006: Insufficient data while reading from the network - expected a 
 minimum of 6 bytes and received only 0 bytes.  The connection has been term
 inated.
 java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
 from the network - expected a minimum of 6 bytes and received only 0 byte
 s.  The connection has been terminated.
 at 
 org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
 Source)
 at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
 Source)
 at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
 at java.sql.DriverManager.getConnection(DriverManager.java:322)
 at java.sql.DriverManager.getConnection(DriverManager.java:297)
 at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
 at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
 at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
 at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown 
 Source)
 at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
 at org.apache.derby.tools.ij.main(Unknown Source)
 Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
 while reading from the network - expected a minimum of 6 bytes and receiv
 ed only 0 bytes.  The connection has been terminated.
 at org.apache.derby.client.net.Reply.fill(Unknown Source)
 at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
 Source)
 at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
 at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
 Source)
 at 
 org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
 at org.apache.derby.client.net.NetConnection.flowConnect(Unknown 
 Source)
 at org.apache.derby.client.net.NetConnection.init(Unknown Source)
 at org.apache.derby.client.net.NetConnection40.init(Unknown Source)
 at 
 org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
  Source)
 ... 12 more
 It would be good to have a clearer error message:
 To Reproduce, use the script and policy file below changing the url for 
 derby.codejars to the correct path for  your enviroment also in the policy 
 file my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
 disallowed host.  Then try to connect from the disllowed host with connect  
 'jdbc:derby://x.x.x.x:1527/wombat';
 Script startServer.sh:
 java  -Djava.security.manager 
 -Dderby.codejars=file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/
  -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerControl 
 start -h 0.0.0.0
 Policy File my.policy (change x.x.x.x and y.y.y.y) to the allowed and 
 disallowed host respectively. )Since the y.y.y.y line is commented it is not 
 really relevant except for testing that remote connections work properly)
 grant codeBase ${derby.codejars}derby.jar
 {
 //
 // These permissions are needed for everyday, embedded Derby usage.
 //
   permission java.lang.RuntimePermission createClassLoader;
   permission java.util.PropertyPermission derby.*, read;
   permission java.util.PropertyPermission user.dir, read;
   permission

[jira] [Commented] (DERBY-5411) Client that does not have Security manager permission to connect gets ERROR 08006: Insufficient data while reading from the network Message should be clearer

2011-09-28 Thread Dag H. Wanvik (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13116942#comment-13116942
 ] 

Dag H. Wanvik commented on DERBY-5411:
--

The server side shows the error clearly on both console and derby.log:

java.security.AccessControlException: access denied (java.net.SocketPermission 
192.168.1.5:50110 accept,resolve)
at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
at 
java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkAccept(SecurityManager.java:1157)
at java.net.ServerSocket.implAccept(ServerSocket.java:466)
at java.net.ServerSocket.accept(ServerSocket.java:430)
at org.apache.derby.impl.drda.ClientThread$1.run(ClientThread.java:67)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.derby.impl.drda.ClientThread.run(ClientThread.java:62)

so I guess it's the client side error message that could be more constructive, 
maybe saying something like could not connect to Derby server on host:port 
and then list possible reasons. Is that what you had in mind? (I presume we 
can't tell exactly what went wrong from the client side)

 Client that does not have Security manager permission to connect gets ERROR 
 08006: Insufficient data while reading from the network Message should be 
 clearer
 ---

 Key: DERBY-5411
 URL: https://issues.apache.org/jira/browse/DERBY-5411
 Project: Derby
  Issue Type: Bug
Affects Versions: 10.8.2.1
Reporter: Kathey Marsden
Priority: Minor

 I was doing a little remote testing for the release candidate and noticed if 
 a machine does not have permission to connect, then the client shows the 
 following exception:
 ij connect  'jdbc:derby://9.72.133.41:1527/wombat';
 ERROR 08006: Insufficient data while reading from the network - expected a 
 minimum of 6 bytes and received only 0 bytes.  The connection has been term
 inated.
 java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
 from the network - expected a minimum of 6 bytes and received only 0 byte
 s.  The connection has been terminated.
 at 
 org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
 Source)
 at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
 Source)
 at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
 at java.sql.DriverManager.getConnection(DriverManager.java:322)
 at java.sql.DriverManager.getConnection(DriverManager.java:297)
 at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
 at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
 at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
 at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown 
 Source)
 at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
 at org.apache.derby.tools.ij.main(Unknown Source)
 Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
 while reading from the network - expected a minimum of 6 bytes and receiv
 ed only 0 bytes.  The connection has been terminated.
 at org.apache.derby.client.net.Reply.fill(Unknown Source)
 at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
 Source)
 at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
 at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
 Source)
 at 
 org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
 at org.apache.derby.client.net.NetConnection.flowConnect(Unknown 
 Source)
 at org.apache.derby.client.net.NetConnection.init(Unknown Source)
 at org.apache.derby.client.net.NetConnection40.init(Unknown Source)
 at 
 org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
  Source)
 ... 12 more
 It would be good to have

[jira] [Commented] (DERBY-5411) Client that does not have Security manager permission to connect gets ERROR 08006: Insufficient data while reading from the network Message should be clearer

2011-09-28 Thread Dag H. Wanvik (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13116949#comment-13116949
 ] 

Dag H. Wanvik commented on DERBY-5411:
--

I can see this without requiring an extra box: by just allowing localhost in 
the policy file, if I use explicit host name in the connect. Sometimes I also 
see this message:which is more reasonable. Mostly, I see what you did, though. 

ERROR 08006: A communications error has been detected: Connection reset.
java.sql.SQLNonTransientConnectionException: A communications error has been 
detected: Connection reset.
at 
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
at 
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:364)
at org.apache.derby.jdbc.ClientDriver.connect(ClientDriver.java:166)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.apache.derby.impl.tools.ij.ij.dynamicConnection(ij.java:1528)
at org.apache.derby.impl.tools.ij.ij.ConnectStatement(ij.java:1358)
at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:1143)
at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:347)
at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:245)
at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
at org.apache.derby.tools.ij.main(ij.java:59)
Caused by: org.apache.derby.client.am.DisconnectException: A communications 
error has been detected: Connection reset.
at 
org.apache.derby.client.net.NetAgent.throwCommunicationsFailure(NetAgent.java:425)
at org.apache.derby.client.net.Reply.fill(Reply.java:174)
at 
org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Reply.java:216)
at org.apache.derby.client.net.Reply.readDssHeader(Reply.java:318)
at 
org.apache.derby.client.net.Reply.startSameIdChainParse(Reply.java:1160)
at 
org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(NetConnectionReply.java:54)
at 
org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(NetConnection.java:802)
at 
org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(NetConnection.java:746)
at 
org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(NetConnection.java:600)
at 
org.apache.derby.client.net.NetConnection.flowConnect(NetConnection.java:410)
at 
org.apache.derby.client.net.NetConnection.init(NetConnection.java:220)
at 
org.apache.derby.client.net.NetConnection40.init(NetConnection40.java:74)
at 
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(ClientJDBCObjectFactoryImpl40.java:269)
at org.apache.derby.jdbc.ClientDriver.connect(ClientDriver.java:157)
... 11 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at org.apache.derby.client.net.Reply.fill(Reply.java:172)
... 23 more

 Client that does not have Security manager permission to connect gets ERROR 
 08006: Insufficient data while reading from the network Message should be 
 clearer
 ---

 Key: DERBY-5411
 URL: https://issues.apache.org/jira/browse/DERBY-5411
 Project: Derby
  Issue Type: Bug
Affects Versions: 10.8.2.1
Reporter: Kathey Marsden
Priority: Minor

 I was doing a little remote testing for the release candidate and noticed if 
 a machine does not have permission to connect, then the client shows the 
 following exception:
 ij connect  'jdbc:derby://9.72.133.41:1527/wombat';
 ERROR 08006: Insufficient data while reading from the network - expected a 
 minimum of 6 bytes and received only 0 bytes.  The connection has been term
 inated.
 java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
 from the network - expected a minimum of 6 bytes and received only 0 byte
 s.  The connection has been terminated.
 at 
 org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
 Source)
 at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
 Source)
 at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
 at java.sql.DriverManager.getConnection(DriverManager.java:322)
 at java.sql.DriverManager.getConnection(DriverManager.java:297

[jira] [Commented] (DERBY-5411) Client that does not have Security manager permission to connect gets ERROR 08006: Insufficient data while reading from the network Message should be clearer

2011-09-28 Thread Dag H. Wanvik (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-5411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13116964#comment-13116964
 ] 

Dag H. Wanvik commented on DERBY-5411:
--

It seems the read from the socket in Reply.fill:

 actualBytesRead = netAgent_.getInputStream().read(buffer_, count_, 
buffer_.length - count_);

sometimes throws, and sometimes return -1 (end of stream). It appears to be 
timing dependent: If, in the debugger, I let there be a time between the write 
on the socket and the read of the reply, I get the java.net.SocketException: 
Connection reset, if not I mostly get the -1. Not sure what goes on...

 Client that does not have Security manager permission to connect gets ERROR 
 08006: Insufficient data while reading from the network Message should be 
 clearer
 ---

 Key: DERBY-5411
 URL: https://issues.apache.org/jira/browse/DERBY-5411
 Project: Derby
  Issue Type: Bug
Affects Versions: 10.8.2.1
Reporter: Kathey Marsden
Priority: Minor

 I was doing a little remote testing for the release candidate and noticed if 
 a machine does not have permission to connect, then the client shows the 
 following exception:
 ij connect  'jdbc:derby://9.72.133.41:1527/wombat';
 ERROR 08006: Insufficient data while reading from the network - expected a 
 minimum of 6 bytes and received only 0 bytes.  The connection has been term
 inated.
 java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
 from the network - expected a minimum of 6 bytes and received only 0 byte
 s.  The connection has been terminated.
 at 
 org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
 Source)
 at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
 Source)
 at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
 at java.sql.DriverManager.getConnection(DriverManager.java:322)
 at java.sql.DriverManager.getConnection(DriverManager.java:297)
 at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
 at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
 at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
 at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown 
 Source)
 at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
 at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
 at org.apache.derby.tools.ij.main(Unknown Source)
 Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
 while reading from the network - expected a minimum of 6 bytes and receiv
 ed only 0 bytes.  The connection has been terminated.
 at org.apache.derby.client.net.Reply.fill(Unknown Source)
 at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
 Source)
 at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
 at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
 Source)
 at 
 org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
  Source)
 at 
 org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
 at org.apache.derby.client.net.NetConnection.flowConnect(Unknown 
 Source)
 at org.apache.derby.client.net.NetConnection.init(Unknown Source)
 at org.apache.derby.client.net.NetConnection40.init(Unknown Source)
 at 
 org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
  Source)
 ... 12 more
 It would be good to have a clearer error message:
 To Reproduce, use the script and policy file below changing the url for 
 derby.codejars to the correct path for  your enviroment also in the policy 
 file my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
 disallowed host.  Then try to connect from the disllowed host with connect  
 'jdbc:derby://x.x.x.x:1527/wombat';
 Script startServer.sh:
 java  -Djava.security.manager 
 -Dderby.codejars=file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/
  -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerControl 
 start -h 0.0.0.0
 Policy File my.policy (change x.x.x.x and y.y.y.y) to the allowed and 
 disallowed host

[jira] [Created] (DERBY-5411) Client that does not have Security manager permission to connect gets ERROR 08006: Insufficient data while reading from the network Message should be clearer

2011-09-14 Thread Kathey Marsden (JIRA)
Client that does not have Security manager permission to connect gets ERROR 
08006: Insufficient data while reading from the network Message should be 
clearer
---

 Key: DERBY-5411
 URL: https://issues.apache.org/jira/browse/DERBY-5411
 Project: Derby
  Issue Type: Bug
Affects Versions: 10.8.2.1
Reporter: Kathey Marsden
Priority: Minor


I was doing a little remote testing for the release candidate and noticed if a 
machine does not have permission to connect, then the client shows the 
following exception:
ij connect  'jdbc:derby://9.72.133.41:1527/wombat';
ERROR 08006: Insufficient data while reading from the network - expected a 
minimum of 6 bytes and received only 0 bytes.  The connection has been term
inated.
java.sql.SQLNonTransientConnectionException: Insufficient data while reading 
from the network - expected a minimum of 6 bytes and received only 0 byte
s.  The connection has been terminated.
at 
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
Source)
at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:322)
at java.sql.DriverManager.getConnection(DriverManager.java:297)
at org.apache.derby.impl.tools.ij.ij.dynamicConnection(Unknown Source)
at org.apache.derby.impl.tools.ij.ij.ConnectStatement(Unknown Source)
at org.apache.derby.impl.tools.ij.ij.ijStatement(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
at org.apache.derby.tools.ij.main(Unknown Source)
Caused by: org.apache.derby.client.am.DisconnectException: Insufficient data 
while reading from the network - expected a minimum of 6 bytes and receiv
ed only 0 bytes.  The connection has been terminated.
at org.apache.derby.client.net.Reply.fill(Unknown Source)
at org.apache.derby.client.net.Reply.ensureALayerDataInBuffer(Unknown 
Source)
at org.apache.derby.client.net.Reply.readDssHeader(Unknown Source)
at org.apache.derby.client.net.Reply.startSameIdChainParse(Unknown 
Source)
at 
org.apache.derby.client.net.NetConnectionReply.readExchangeServerAttributes(Unknown
 Source)
at 
org.apache.derby.client.net.NetConnection.readServerAttributesAndKeyExchange(Unknown
 Source)
at 
org.apache.derby.client.net.NetConnection.flowServerAttributesAndKeyExchange(Unknown
 Source)
at 
org.apache.derby.client.net.NetConnection.flowUSRIDONLconnect(Unknown Source)
at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
at org.apache.derby.client.net.NetConnection.init(Unknown Source)
at org.apache.derby.client.net.NetConnection40.init(Unknown Source)
at 
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
 Source)
... 12 more

It would be good to have a clearer error message:

To Reproduce, use the script and policy file below changing the url for 
derby.codejars to the correct path for  your enviroment also in the policy file 
my.policy exchange x.x.x.x with the permitted host and y.y.y.y with the 
disallowed host.  Then try to connect from the disllowed host with connect  
'jdbc:derby://x.x.x.x:1527/wombat';

Script startServer.sh:
java  -Djava.security.manager 
-Dderby.codejars=file:c:/cygwin/home/kmarsden/projects/10.8.2testing/db-derby-10.8.2.1-lib/lib/
 -Djava.security.policy=my.policy org.apache.derby.drda.NetworkServerControl 
start -h 0.0.0.0

Policy File my.policy (change x.x.x.x and y.y.y.y) to the allowed and 
disallowed host respectively. )Since the y.y.y.y line is commented it is not 
really relevant except for testing that remote connections work properly)


grant codeBase ${derby.codejars}derby.jar
{
//
// These permissions are needed for everyday, embedded Derby usage.
//
  permission java.lang.RuntimePermission createClassLoader;
  permission java.util.PropertyPermission derby.*, read;
  permission java.util.PropertyPermission user.dir, read;
  permission java.util.PropertyPermission derby.storage.jvmInstanceId, 
  write; 
  permission java.io.FilePermission ${user.dir}${/}-, read;
  permission java.io.FilePermission ${derby.system.home},read;
  permission java.io.FilePermission ${derby.system.home}${/}-, 
read,write,delete;

//
// This permission lets a DBA reload the policy file while the server