You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Oskar Zinger (JIRA)" <ji...@apache.org> on 2012/11/14 02:36:12 UTC

[jira] [Created] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely

Oskar Zinger created DERBY-5994:
-----------------------------------

             Summary: Different SQL State is returned when executing "shutdown=true" - locally or remotely
                 Key: DERBY-5994
                 URL: https://issues.apache.org/jira/browse/DERBY-5994
             Project: Derby
          Issue Type: Bug
          Components: JDBC, Network Client, Network Server, Replication
    Affects Versions: 10.8.2.2
         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
            Reporter: Oskar Zinger


Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely.

Here is some background information:
- Using the embedded Derby Network Server deployment (derbynet.jar)
- Using the JDBC Derby Client (derbyclient.jar)
- Using the Derby Engine (derby.jar)

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
  DriverManager.getConnection("jdbc:derby:<database_name>;shutdown=true;deregister=false", user, pass);

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
  DriverManager.getConnection("jdbc:derby://<host>:<port>/<database_name>;shutdown=true;deregister=false", user, pass);

The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.

Here is the error message: 
Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'

Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.

The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13497705#comment-13497705 ] 

Kathey Marsden commented on DERBY-5994:
---------------------------------------

No DERBY-2068 has not been fixed yet.  I was just wondering if you thought  this might be a manifestation of that issue.

I see the error codes documented in the context of this property
http://db.apache.org/derby/docs/10.8/ref/rrefproper26985.html


                
> Different SQL State is returned when executing "shutdown=true" - locally or remotely
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely.
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:<database_name>;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://<host>:<port>/<database_name>;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely

Posted by "Oskar Zinger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oskar Zinger updated DERBY-5994:
--------------------------------

    Description: 
Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Using "embedded" vs "client" Derby drivers.

Here is some background information:
- Using the embedded Derby Network Server deployment (derbynet.jar)
- Using the JDBC Derby Client (derbyclient.jar)
- Using the Derby Engine (derby.jar)

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
  DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
  DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);

The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.

Here is the error message: 
Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'

Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.

The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).


  was:
Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Using "embedded" vs "client" Derby drivers.

Here is some background information:
- Using the embedded Derby Network Server deployment (derbynet.jar)
- Using the JDBC Derby Client (derbyclient.jar)
- Using the Derby Engine (derby.jar)

Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
  DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
  DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);

The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.

Here is the error message: 
Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'

Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.

The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).


    
> Different SQL State is returned when executing "shutdown=true" - locally or remotely
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>         Attachments: Derby5994Repro.java
>
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Using "embedded" vs "client" Derby drivers.
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13499242#comment-13499242 ] 

Kathey Marsden commented on DERBY-5994:
---------------------------------------

If you agree that this is an embedded/client difference then  it would be good to adjust the title accordingly and then address in conjunction with DERBY-2068 in a feature release if deemed worth the risk of changing SQLStates.

Perhaps it would be good to send a separate email to the user list about your general replication best practices question:
"The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host). "

 
I am not familiar with replication really at all but this seems a valid best practices question and I wonder if  shutdown of the database from the client is the recommended way.  As discussed in this thread http://old.nabble.com/How-to-reset-Derby-Database-in-JVM-td34541038.html, client shutdown of the database is not something that is documented or necessarily a good idea.

 
                
> Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver
> -------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>         Attachments: Derby5994Repro.java
>
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver"
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely

Posted by "Oskar Zinger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oskar Zinger updated DERBY-5994:
--------------------------------

    Summary: Different SQL State is returned when executing "shutdown=true" - locally or remotely  (was: Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver)
    
> Different SQL State is returned when executing "shutdown=true" - locally or remotely
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>         Attachments: Derby5994Repro.java
>
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Using "embedded" vs "client" Derby drivers.
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely

Posted by "Oskar Zinger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oskar Zinger updated DERBY-5994:
--------------------------------

    Description: 
Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver"

Here is some background information:
- Using the embedded Derby Network Server deployment (derbynet.jar)
- Using the JDBC Derby Client (derbyclient.jar)
- Using the Derby Engine (derby.jar)

Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
  DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
  DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);

The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.

Here is the error message: 
Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'

Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.

The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).


  was:
Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely.

Here is some background information:
- Using the embedded Derby Network Server deployment (derbynet.jar)
- Using the JDBC Derby Client (derbyclient.jar)
- Using the Derby Engine (derby.jar)

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
  DriverManager.getConnection("jdbc:derby:<database_name>;shutdown=true;deregister=false", user, pass);

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
  DriverManager.getConnection("jdbc:derby://<host>:<port>/<database_name>;shutdown=true;deregister=false", user, pass);

The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.

Here is the error message: 
Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'

Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.

The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).


    
> Different SQL State is returned when executing "shutdown=true" - locally or remotely
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver"
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver

Posted by "Oskar Zinger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oskar Zinger updated DERBY-5994:
--------------------------------

    Description: 
Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Using "embedded" vs "client" Derby drivers.

Here is some background information:
- Using the embedded Derby Network Server deployment (derbynet.jar)
- Using the JDBC Derby Client (derbyclient.jar)
- Using the Derby Engine (derby.jar)

Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
  DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
  DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);

The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.

Here is the error message: 
Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'

Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.

The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).


  was:
Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver"

Here is some background information:
- Using the embedded Derby Network Server deployment (derbynet.jar)
- Using the JDBC Derby Client (derbyclient.jar)
- Using the Derby Engine (derby.jar)

Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
  DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);

When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
  DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);

The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.

Here is the error message: 
Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'

Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.

The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).


    
> Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver
> -------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>         Attachments: Derby5994Repro.java
>
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Using "embedded" vs "client" Derby drivers.
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13497224#comment-13497224 ] 

Kathey Marsden commented on DERBY-5994:
---------------------------------------

Just to throw in some information, which I don't think solves your particular problem but may promote understanding:

Here is the SQL State reference
http://db.apache.org/derby/docs/10.8/ref/rrefexcept71493.html

The SQL State 08004 is I believe a SQL Standard State that the data source rejected establishment of connection and we have multiple messages that map to this state. Some with a nested exception but I think that is available only in embedded for this error.

There is a related, perhaps the same issue as this one:
https://issues.apache.org/jira/browse/DERBY-2068

Misleading XJ004 exception when shutting down a database that is already shutdown. 


                
> Different SQL State is returned when executing "shutdown=true" - locally or remotely
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely.
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:<database_name>;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://<host>:<port>/<database_name>;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver

Posted by "Oskar Zinger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oskar Zinger updated DERBY-5994:
--------------------------------

    Summary: Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver  (was: Different SQL State is returned when executing "shutdown=true" - locally or remotely)
    
> Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver
> -------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver"
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely

Posted by "Oskar Zinger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13497679#comment-13497679 ] 

Oskar Zinger commented on DERBY-5994:
-------------------------------------

Thanks Kathey - this is good information.

Is there a similar reference guide for SQL Error Codes such those that are returned with SQLException.getErroCode()?

As to https://issues.apache.org/jira/browse/DERBY-2068 has this been resolved? I'm using Derby 10.8 and still experience it. Looks like it is in "Unresolved" state.
                
> Different SQL State is returned when executing "shutdown=true" - locally or remotely
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely.
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:<database_name>;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://<host>:<port>/<database_name>;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (DERBY-5994) Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-5994:
----------------------------------

    Attachment: Derby5994Repro.java

Hi Oskar, 

The attached program ReproDerby5594.java tries the double shutdown 
1) With the client driver in the same jvm
2) With the client driver in a different jvm
3) With the embedded driver 

Which driver is used is determined by the URL. jdbc:derby:wombat;shutdown=true (embedded) jdbc:derby:wombat://localhost:1527/wombat;shutdown=true (client)


I see a difference in SQState for the Client and Embedded Drivers but I think the Client driver is consistent whether in the same JVM or a different one.

The output is as follows:

~/repro/derby-5994 $java Derby5994Repro


SAME JVM CLIENT BOOT THEN SHUTDOWN TWICE
Fri Nov 16 14:42:47 PST 2012 : Apache Derby Network Server - 10.8.3.1 - (1407442M) started and ready to accept conne
ns on port 1527
Booting wombat database
Shutdown database once:
SQLState=08006DERBY SQL error: SQLCODE: -1, SQLSTATE: 08006, SQLERRMC: Database 'wombat' shutdown.
Shutdown database again:
SQLState=08004The connection was refused because the database wombat;shutdown=true was not found.


OTHER JVM CLIENT BOOT THEN SHUTDOWN TWICE
exitValue =0 process output =Booting wombat database
Shutdown database once:
SQLState=08006DERBY SQL error: SQLCODE: -1, SQLSTATE: 08006, SQLERRMC: Database 'wombat' shutdown.
Shutdown database again:
SQLState=08004The connection was refused because the database wombat;shutdown=true was not found.



EMBEDDED BOOT AND SHUTDOWN TWICE
Booting wombat database
Embedded Shutdown database once:
SQLState=08006Database 'wombat' shutdown.
Embedded Shutdown database again:
SQLState=XJ004Database 'wombat' not found.
Fri Nov 16 14:42:51 PST 2012 : Apache Derby Network Server - 10.8.3.1 - (1407442M) shutdown
~/repro/derby-5994 $javac -g Derby5994Repro.java
~/repro/derby-5994 $java Derby5994Repro


SAME JVM CLIENT BOOT THEN SHUTDOWN TWICE
Fri Nov 16 14:43:24 PST 2012 : Apache Derby Network Server - 10.8.3.1 - (1407442M) started and ready to accept conne
ns on port 1527
Booting wombat database
Shutdown database once:
SQLState=08006DERBY SQL error: SQLCODE: -1, SQLSTATE: 08006, SQLERRMC: Database 'wombat' shutdown.
Shutdown database again:
SQLState=08004The connection was refused because the database wombat;shutdown=true was not found.


OTHER JVM CLIENT BOOT THEN SHUTDOWN TWICE
exitValue =0 process output =Booting wombat database
Shutdown database once:
SQLState=08006DERBY SQL error: SQLCODE: -1, SQLSTATE: 08006, SQLERRMC: Database 'wombat' shutdown.
Shutdown database again:
SQLState=08004The connection was refused because the database wombat;shutdown=true was not found.



EMBEDDED BOOT THEN SHUTDOWN TWICE
Booting wombat database
Embedded Shutdown database once:
SQLState=08006Database 'wombat' shutdown.
Embedded Shutdown database again:
SQLState=XJ004Database 'wombat' not found.
Fri Nov 16 14:43:28 PST 2012 : Apache Derby Network Server - 10.8.3.1 - (1407442M) shutdown


                
> Different SQL State is returned when executing "shutdown=true" - locally or remotely using ClientDriver
> -------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5994
>                 URL: https://issues.apache.org/jira/browse/DERBY-5994
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client, Network Server, Replication
>    Affects Versions: 10.8.2.2
>         Environment: Derby Embedded Network Server - Not specific to operating systems, software platforms or hardware specifications.
>            Reporter: Oskar Zinger
>         Attachments: Derby5994Repro.java
>
>
> Different SQL State is returned when executing "shutdown=true" Derby URL attribute while executing the shutdown Database connection locally or remotely. Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver"
> Here is some background information:
> - Using the embedded Derby Network Server deployment (derbynet.jar)
> - Using the JDBC Derby Client (derbyclient.jar)
> - Using the Derby Engine (derby.jar)
> Note: in both cases the client driver is used: "org.apache.derby.jdbc.ClientDriver". The only difference is the URL, when host and port is not specified execution happens in the same JVM (local), when host and port is specified execution happens into another JVM (remote).
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "XJ004":
>   DriverManager.getConnection("jdbc:derby:MyDatabase;shutdown=true;deregister=false", user, pass);
> When executing the following - if database has not been booted yet (or already shutdown) - the SQL State Code is "08004":
>   DriverManager.getConnection("jdbc:derby://myhost.mycompany.net:1527/MyDatabase;shutdown=true;deregister=false", user, pass);
> The SQL State Code of "08004" usually is returned with an SQL Exception if "User Authentication is Invalid" for example username and / or password is incorrect.
> Here is the error message: 
> Error Code: '40000', SQL State Code: '08004' and Exception: 'java.sql.SQLNonTransientConnectionException: The connection was refused because the database <database_name>;shutdown=true;deregister=false was not found.'
> Separately, the error message "database was not found" is actually misleading because the database actually does exist and it just has not been been booted yet, or it has already been shutdown. The Derby Network Server has not been shutdown, only the database and it is possible to check if the database exists on the file system.
> The reason why this is important is because when using Derby Replication, when replication is started - the databases must be identical and in sync, so the database must be shutdown cleanly, copied over, and replication will be started. Since the Salve Derby must start before Master Derby, it is required to be able to remotely shutdown the Master Derby database from the Slave Derby instance (host).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira