ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | c-jdbc List | May 2005 Index

<--  Date Index  --> <--  Thread Index  -->

Re: [c-jdbc] Problems Executing Stored Procedures


I noticed in my own testing that setting that property on the URL string didn't seem to work.  I might be missing something, but I couldn't see in the code where it was being set.  (I see where it's checked for if a Properties object is passed into DriverManager.getConnection(), and I see where CjdbcUrl.parseUrlParams parses the option and adds it to a HashMap, but I don't see where it ever gets referenced again).

In our application, we were able to just use Connection.setDriverProcessed().  Not sure if that would work for you in JBoss -- but, if not, the below patch to Driver.java should make passing the variable on the URL work.  It just takes all the parameters from the CjdbcUrl params and adds them to the Properties object when a connection is first created.  Probably not the best solution, but seems safe enough.

One other thing I noticed about URL parameters: the documentation seems slightly wrong in its example.  See http://c-jdbc.objectweb.org/current/doc/userGuide/html/ar01s04.html#cjdbc_jdbc_url.  It shows the following example:

DriverManager.getConnection("jdbc:cjdbc://host/db?user=me;password=secret")

I don't think that will work.  Looking at CjdbcUrl, it looks like you can start-off the URL parameters with a question mark, but then they must be separated by ampersands, not semi-colons.  You can also separate the parameters by semi-colons, but then they must also start with a semi-colon, not a question mark.  e.g., the following examples should both work:

DriverManager.getConnection("jdbc:cjdbc://host/db?user=me&password=secret")
DriverManager.getConnection("jdbc:cjdbc://host/db;user=me;password=secret")

It looks like that wouldn't affect you, since you're only passing in one parameter, but it may be something to keep in mind if you ever pass additional parameters on the URL string.

- James

Index: Driver.java
===================================================================
RCS file: /cvsroot/c-jdbc/c-jdbc/src/org/objectweb/cjdbc/driver/Driver.java,v
retrieving revision 1.98
diff -u -r1.98 Driver.java
--- Driver.java    27 May 2005 16:01:30 -0000    1.98
+++ Driver.java    27 May 2005 21:21:21 -0000
@@ -273,6 +273,11 @@
           cjdbcUrl = new CjdbcUrl(url);
           urlCache.put(url, cjdbcUrl);
         }
+        Iterator paramIterator = cjdbcUrl.getParameters().keySet().iterator();
+        while(paramIterator.hasNext()) {
+          String key = (String) paramIterator.next();
+          properties.setProperty(key, (String) cjdbcUrl.getParameters().get(key));
+        }
       }
     }

On 5/27/05, Dylan Hansen <dhansen@xxxxxxxx> wrote:
Hi Emmanuel, thanks for your reply.

On 27-May-05, at 7:13 AM, Emmanuel Cecchet wrote:

I have double checked the code and that should not happen. There is a problem with the way you set driverProcessed to false in your URL. Coud you debug the call to Connection.setDriverProcessed(boolean) to see which actual value is set with the URL you are using?

It turns out that driverProcessed had a null value in the driver, which caused it to revert to the default value for the variable (which was true).  I changed the default value to "false" in the code and recompiled the driver, and the statement that didn't execute previously now did.

Here is an example of the connection statement that we are using in our JBoss data source file.  What are we doing wrong here?

<connection-url>jdbc:cjdbc://host1:25322,host2:25322/h2st?driverProcessed=false</connection-url>

This could also be an issue with JBoss turfing parameters passed to the connection-url.  I'm going to do some hunting around and see if there's any issues related to that.

For the time being, is setting the variable in the driver to default to 'false' a viable solution?  Or with this cause problems in other areas?

Thanks!

Dylan Hansen
How2Share Technologies



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.