On Jan 17, 10:46 am, "mike g." <[email protected]> wrote:
> I'm using Sequel in JRuby to connect to an Oracle database through the
> JDBC driver. I need to pass a connection option to the JDBC driver
> setting escape processing to false. I've tested the option in Java so
> I know this functionality is supported and should be accessible in the
> same manner as the user and password options.
>   Properties info = new Properties();
>   info.setProperty("user", username);
>   info.setProperty("password", password);
>   info.setProperty("processEscapes", "false");
>   Connection connection =
> DriverManager.getConnection("jdbc:oracle:thin:@" + server_url + ":
> 1521:" + database, info);
>
> When I try the same parameters passed into the Sequel connection, the
> driver is processing escapes. Is there a reason Sequel would not pass
> this option like the others?
>   Sequel.connect("jdbc:oracle:thin:@#{server_url}:1521:#{database}",
> {:user => user, :password => password, :processEscapes => "false"})

With Sequel's current jdbc adapter, no extra options are passed to
JDBC, you have to include all options in the connection string, which
is passed verbatim to JDBC.  :user and :password are the only
exception.

If there isn't a way to add the :processEscapes to the connection
string, we can probably update the adapter to support arbitrary
properties:

diff --git a/lib/sequel/adapters/jdbc.rb b/lib/sequel/adapters/jdbc.rb
index f4b8b35..fb5ea1b 100644
--- a/lib/sequel/adapters/jdbc.rb
+++ b/lib/sequel/adapters/jdbc.rb
@@ -168,6 +168,7 @@ module Sequel
               props.setProperty("user", opts[:user])
               props.setProperty("password", opts[:password])
             end
+            opts[:jdbc_properties].each{|k,v|
props.setProperty(k.to_s, v)} if opts[:jdbc_properties]
             begin
               driver.new.connect(args[0], props)
             rescue => e2

You would have to change your options hash to be:

  {:user => user, :password =>
password, :jdbc_properties=>{:processEscapes => "false"}}

Can you give that a shot and let me know if it works?

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to