db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Van Couvering <David.Vancouver...@Sun.COM>
Subject Re: [jira] Updated: (DERBY-289) Enable code sharing between Derby client and engine
Date Wed, 16 Nov 2005 00:53:19 GMT
Hi, Deepa, thanks for doing this test.  I am going to think about Dan's 
suggestions for simplifying the code for message ids, and will respond 
directly to his email.

In the meantime, let's focus on the issue you encountered.  It's funny, 
the error isn't that the message id was not found.  Instead, we weren't 
able to find org.apache.derby.loc.client-messages.properties.

I wonder if it's missing from derby.jar?  Can you check and see?  It's 
odd, though, because if it can't find it from derby.jar, you would think 
it would find it in derbyclient.jar.

I also noticed you had to do "new CommonInfo()".  That wasn't my intent, 
I had planned that there be a singleton pattern so you didn't have to 
"new" the instance everywhere.  I'll fix that.

David


Deepa Remesh wrote:
> Hi David,
> 
> I applied the patch for DERBY-289 and tried a use case which adds a
> new parameter to an existing message. I did the following:
> 
> Step 1:
> First, I tried moving a message (07000) from
> org.apache.derby.loc.messages_en.properties to
> org.apache.derby.loc.common-messages_en.properties. I moved the
> following to common-messages_en.properties:
> 07000=At least one parameter to the current statement is uninitialized.
> 
> SQLState.java has this:
> String LANG_MISSING_PARMS                                          = "07000";
> 
> In client driver, I changed 'checkThatAllParametersAreSet' method in
> org.apache.derby.client.am.PreparedStatement to use SQLException2 with
> SQLState.LANG_MISSING_PARMS.
> 
> if (!parameterSet_[i] && !parameterRegistered_[i]) {
>                     throw new SqlException2(agent_.logWriter_,
> SQLState.LANG_MISSING_PARMS);
>                 }
> 
> I ran a repro to get this error message with client driver and it works fine.
> 
> Step 2:
> Next I added a parameter to this message. For this, I kept the old
> message and added another message with a new message id to
> common-messages_en.properties as below:
> 07000=At least one parameter to the current statement is uninitialized.
> 07000.new=Parameter ''{0}'' not initialized.
> 
> I added 07000.new to SQLState.java:
> String LANG_MISSING_PARMS                                          = "07000";
> String LANG_MISSING_PARMS2                                         =
> "07000.new";
> 
> I added a new feature in CommonFeatures.java and set MAX_FEATURES to
> this value as below:
> public static int SQLSTATE_07000_NEW = 1;
> public static int MAX_FEATURE = SQLSTATE_07000_NEW;
> 
> I changed client driver to use the new message:
> 		if (!parameterSet_[i] && !parameterRegistered_[i]) {
> 			CommonInfo cInfo = new CommonInfo();
> 		   	if(cInfo.hasFeature(CommonFeatures.SQLSTATE_07000_NEW))
> 		    		throw new SqlException2(agent_.logWriter_,
> SQLState.LANG_MISSING_PARMS2, new Integer (i));
> 		    	else
> 		      		throw new SqlException2(agent_.logWriter_,
> SQLState.LANG_MISSING_PARMS);
> 		}
> 
> 
> I ran the repro with client driver and I got the new message.
> 
> .....................
> 
> Now, I tried mixing jars.
> jars from Step 1 --> v1
> jars from step 2 --> v2
> 
> I used v1 jars for starting network server. At client side, I set
> CLASSPATH with v1/derby.jar before v2/derbyclient.jar. Then I ran the
> repro and I get the following exception:
> 
> java.util.MissingResourceException: Can't find bundle for base name
> org.apache.derby.loc.client-messages.properties, locale en_US
>         at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:839)
>         at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:729)
>         at java.util.ResourceBundle.getBundle(ResourceBundle.java:579)
>         at org.apache.derby.common.i18n.MessageUtil.getCompleteMessage(MessageUtil.java:177)
>         at org.apache.derby.common.i18n.MessageUtil.getCompleteMessage(MessageUtil.java:208)
>         at org.apache.derby.common.i18n.MessageUtil.getCompleteMessage(MessageUtil.java:96)
>         at org.apache.derby.client.am.SqlException2.<init>(SqlException2.java:57)
>         at org.apache.derby.client.am.SqlException2.<init>(SqlException2.java:93)
>         at org.apache.derby.client.am.PreparedStatement.checkThatAllParametersAreSet(PreparedStatement.java:1655)
>         at org.apache.derby.client.am.PreparedStatement.flowExecute(PreparedStatement.java:1257)
>         at org.apache.derby.client.am.PreparedStatement.executeX(PreparedStatement.java:908)
>         at org.apache.derby.client.am.PreparedStatement.execute(PreparedStatement.java:899)
>         at parameter.main(parameter.java:27)
> 
> Have I missed something here? I would appreciate your help in this.
> 
> Thanks,
> Deepa

Mime
View raw message