[
https://issues.apache.org/jira/browse/DERBY-3419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15441854#comment-15441854
]
Bryan Pendleton commented on DERBY-3419:
----------------------------------------
Thanks for looking at this issue.
I think that the error arises as follows:
{quote}
at
org.apache.derby.tools.JDBCDisplayUtil.checkNotNull(JDBCDisplayUtil.java:738)
at org.apache.derby.impl.tools.ij.ij.haveConnection(ij.java:280)
at org.apache.derby.impl.tools.ij.ij.DisconnectStatement(ij.java:1981)
at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:1112)
at
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:353)
at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:251)
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)
{quote}
I think that the fix should be in the DisconnectStatement method.
Note that it's a bit tricky to follow this part of the code because {{ij.java}}
is a generated file, generated from the parser file {{ij.jj}}.
So you can find the generated {{ij.java}} code in the generated code area of
your build, but the changes must be made to the {{ij.jj}} parser file.
Here is an idea to try:
# in ijException.java, add a new helper method, named {{noCurrentConnection()}}
that throws an exception with the message {{IJ_NoCurreConne}}, following the
existing pattern in that class.
# in ij.jj, in the DisconnectStatement method, change the handling of the case
where {{( a == null )}} and {{(n == null)}} to add:
{quote}
if (currentConnEnv.getSession() == null)
throw ijException.noCurrentConnection();
{quote}
Can you try that approach, and see if it seems like it would work? Thanks!
> Incorrect error message in ij for disconnect with no active connections
> -----------------------------------------------------------------------
>
> Key: DERBY-3419
> URL: https://issues.apache.org/jira/browse/DERBY-3419
> Project: Derby
> Issue Type: Bug
> Components: Tools
> Affects Versions: 10.2.2.0
> Reporter: Deepthi Devaki A R
> Priority: Minor
> Labels: derby_triage10_5_2
> Attachments: DERBY-3419.diff
>
>
> Using ij, before connecting to the database, when the disconnect command is
> issued, the error message which is printed is:IJ ERROR: Unable to establish
> connection
> bash-3.00# ij
> ij version 10.4
> ij> disconnect;
> IJ ERROR: Unable to establish connection
> The error message should be changed to "No connection available" for a better
> understanding.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)