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 "Mamta A. Satoor (JIRA)" <ji...@apache.org> on 2007/10/19 21:24:50 UTC

[jira] Created: (DERBY-3139) setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range

setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range
------------------------------------------------------------------------------------------------------------------------------------------

                 Key: DERBY-3139
                 URL: https://issues.apache.org/jira/browse/DERBY-3139
             Project: Derby
          Issue Type: Improvement
          Components: Network Server
    Affects Versions: 10.3.1.4, 10.4.0.0
            Reporter: Mamta A. Satoor


In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 

The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 

All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 

I am adding a test case for this in derbynet.PreparedStatementTest.

I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?

Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3139) setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range

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

Kathey Marsden updated DERBY-3139:
----------------------------------

    Derby Categories: [Embedded/Client difference]

> setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3139
>                 URL: https://issues.apache.org/jira/browse/DERBY-3139
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.1.3
>            Reporter: Mamta A. Satoor
>
> In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 
> The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 
> All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 
> I am adding a test case for this in derbynet.PrepareStatementTest.
> I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?
> Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3139) setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range

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

Kathey Marsden commented on DERBY-3139:
---------------------------------------

I think since this is pretty much a usage error, probably noone is going to have their app check for this particular exception.  We document that network client SQLStates might change in:
http://db.apache.org/derby/docs/10.1/ref/rrefexcept71493.html

so if we change it I think it would be best to keep the embedded state.



> setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3139
>                 URL: https://issues.apache.org/jira/browse/DERBY-3139
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>
> In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 
> The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 
> All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 
> I am adding a test case for this in derbynet.PreparedStatementTest.
> I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?
> Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3139) setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range

Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537503 ] 

Mamta A. Satoor commented on DERBY-3139:
----------------------------------------

I will work on this tomorrow ie change the SQL State for network server to match embedded state. I wonder why we used a different SQL state in network server to start with. Maybe just an oversight.

> setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3139
>                 URL: https://issues.apache.org/jira/browse/DERBY-3139
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>
> In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 
> The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 
> All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 
> I am adding a test case for this in derbynet.PreparedStatementTest.
> I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?
> Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-3139) setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range

Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537842 ] 

Mamta A. Satoor commented on DERBY-3139:
----------------------------------------

I want to summarize the status of this Jira entry. 

When I filed this Jira entry, there were 2 items that needed to be tackled.

1)When PreparedStatement does not have any parameter, and a user tries to use setObject(int,Object,int) on it, Embedded threw SQL State 07009 whereas Network Server threw XCL13. I fixed this change in behavior as part of DERBY-3046 (trunk revision 588527).

2)The second issue is specific to Network Server. 
If the PreparedStatement has non-zero number of parameters and user tries to use setObject with out of range parameter number, Network Server throws XCL13(which is same as Embedded Server). This exception is thrown by method org.apache.derby.client.am.PreparedStatement:checkForValidParameterIndex which is called at line 1439 in org.apache.derby.client.am.PreparedStatement:setObject. 
But if the user tries to use say setString with out of range parameter number, Network Server throws XCL14(Embedded throws XCL13). This is because for setString in NetworkServer, we do not call org.apache.derby.client.am.PreparedStatement:checkForValidParameterIndex. Instead, we call (line 931 in org.apache.derby.client.am.PreparedStatement:setString) org.apache.derby.client.am.ColumnMetaData:checkForValidColumnIndex which throws XCL14. I can't change org.apache.derby.client.am.ColumnMetaData:checkForValidColumnIndex to throw XCL13 because that method is also used for calls like ResultSetMetaData:isNullable and if isNullable is called with invalid column number, we do want to throw XCL14. 
One way to fix this problem is to have setString call org.apache.derby.client.am.PreparedStatement:checkForValidParameterIndex just like setObject but that means that for every setString in Network Server, there will 2 checks made for valid parameter number. One check will be in org.apache.derby.client.am.PreparedStatement:checkForValidParameterIndex and next check will be in org.apache.derby.client.am.ColumnMetaData:checkForValidColumnIndex. If the parameter number indeed is invalid, it will be caught in the parameter check in PreparedStatement:checkForValidParameterIndex but if it is valid, then we will do unnecessary check for parameter number again in ColumnMetaData:checkForValidColumnIndex. 
Since all this is happening at compile time, may be it is ok to let the checking happen 2 times. I haven't spent enough time on this to figure out if we can do this in a different way so that we always throw XCL13 when the parameter number for setObject and setString is out of range. Also, the same issue exists for setShort, setInt, setBlob etc

> setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3139
>                 URL: https://issues.apache.org/jira/browse/DERBY-3139
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Mamta A. Satoor
>
> In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 
> The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 
> All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 
> I am adding a test case for this in derbynet.PrepareStatementTest.
> I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?
> Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-3139) setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range

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

Mamta A. Satoor reassigned DERBY-3139:
--------------------------------------

    Assignee: Mamta A. Satoor

> setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3139
>                 URL: https://issues.apache.org/jira/browse/DERBY-3139
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Mamta A. Satoor
>
> In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 
> The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 
> All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 
> I am adding a test case for this in derbynet.PreparedStatementTest.
> I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?
> Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-3139) setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range

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

Mamta A. Satoor updated DERBY-3139:
-----------------------------------

    Description: 
In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 

The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 

All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 

I am adding a test case for this in derbynet.PrepareStatementTest.

I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?

Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.


  was:
In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 

The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 

All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 

I am adding a test case for this in derbynet.PreparedStatementTest.

I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?

Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.



> setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3139
>                 URL: https://issues.apache.org/jira/browse/DERBY-3139
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Mamta A. Satoor
>
> In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 
> The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 
> All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 
> I am adding a test case for this in derbynet.PrepareStatementTest.
> I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?
> Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-3139) setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range

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

Kathey Marsden reassigned DERBY-3139:
-------------------------------------

    Assignee:     (was: Mamta A. Satoor)

> setObject and other setXXX methods on PreparedStatement throw different exceptions in Network Server when parameter number is out of range
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3139
>                 URL: https://issues.apache.org/jira/browse/DERBY-3139
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.3.1.4, 10.4.1.3
>            Reporter: Mamta A. Satoor
>
> In Network Server, when a user executes PreparedStatement.setObject with out of range parameter number, the exception thrown is XCL13 but when the user tries PreparedStatement.setString with out of range parameter number, the exception thrown in Network Server is XCL14. We should throw same exception for both the cases. 
> The reason for this difference in behavior is client.am.PreparedStatement.setObject calls checkForValidParameterIndex for parameter number checking and that method throws exception XCL13. 
> All the other PreparedStatement.setXXX methods end up calling getColumnMetaDataX().getColumnType(parameterIndex); which results into call to client.am.ColumnMetaData:getColumnType() which in turn calls checkForValidColumnIndex for parameter number checking and that method throws exception XCL14. 
> I am adding a test case for this in derbynet.PrepareStatementTest.
> I am wondering if the community has any objection to one of the error message getting changed into another. I wonder if it will cause user applications to break because they rely of different error message. And if not, any ideas on which one we should get rid of?
> Also, the exception thrown for these 2 cases in Embedded server is same but it is not XCL14 or XCL13. I will work on entering another jira entry for difference in exception for embedded and network server.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.