Am Mittwoch, 24. Januar 2018 15:43:59 UTC+1 schrieb Jeremy Evans:
>
> On Wednesday, January 24, 2018 at 6:39:55 AM UTC-8, Nicolai Sticht wrote:
>>
>> I have some problems to access the underlying connection when using 
>> Sequel with a jndi connection pool.
>>
>> My code works fine as long as I'm using the following connection url:
>>
>> url = "jdbc:oracle:thin:#{userid}/#{password}@#{host_ip}:1521:#{db_name}"
>>
>> DB = Sequel.connect(url)
>>
>> When is switch to our jndi connection pool 
>>
>> url = 'jdbc:jndi:java:comp/env/jdbc/name'
>>
>> I get the following error:
>>
>> NoMethodError: undefined method `createARRAY' for 
>> #<Java::OrgApacheTomcatDbcpDbcp::PoolingDataSource::PoolGuardConnectionWrapper:0x24c55ed0>
>>
>> Is there an easy way to access the underlying oracle connection when 
>> using jndi connection pool with Sequel?
>>
>> Any help would be very much appreciated.
>>
>
> You can get access to the connection object that Sequel uses via 
> Database#synchronize:
>
> DB.synchronize do |connection|
> end
>
> Anything lower level than that will require calling Java methods on the 
> yielded Java connection object.
>
> Thanks,
> Jeremy
>

Thanks. Then I have to figure out how to call the right Java methods on the 
yielded connection. 

Probably something similar to this answer which I have found on 
stackoverflow.

https://stackoverflow.com/a/14327357/4303742
 

OracleConnection oracleConnection = null;
try {
    if (connection.isWrapperFor(OracleConnection.class)) {
        oracleConnection = connection.unwrap(OracleConnection.class);
    }
} catch (SQLException ex) {
    // do something
}
return oracleConnection;



-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to