# FAKE Sequel connestion string that includes hash characters in psswd
schema = 'SCHEMA_FAKE'
psswd   = 'aaa###bbbccc'
host     = 'my.host.el'
port     = '1521'
sid       = 'SIDDB'
conn_string = "oracle://#{ schema }"  + ':' + psswd + '@' + host + ':' + 
port + '/' + sid

The returning error: 

C:/Ruby193/lib/ruby/1.9.1/uri/common.rb:176:in `split': bad URI(is not 
URI?): oracle://SCHEMA_FAKE:aaa###[email protected]:1521/SIDDB 
(URI::InvalidURIError)
  from C:/Ruby193/lib/ruby/1.9.1/uri/common.rb:211:in `parse'
  from C:/Ruby193/lib/ruby/1.9.1/uri/common.rb:747:in `parse'
  from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sequel-3.41.0/lib/sequel/database/connecting.rb:52:in
 
`connect'
  from 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sequel-3.41.0/lib/sequel/core.rb:147:in 
`connect'
  from C:/Users/etypaldos/Desktop/prod-wrk.rb:35:in `<main>'
[Finished in 0.2s with exit code 1]


This is due to lib/sequel/database/connecting.rb: in line 52:
uri = URI.parse(conn_string)

One way to resolve this could be to url-encode(escape) the conn_string
uri = URI.parse(URI.escape(conn_string))
and properly URI.unescape  where is appropriate. 

require 'uri'
conn_string="oracle://SCHEMA_FAKE:###[email protected]:1521/SIDDB"
uri = URI.parse(URI.escape(conn_string))
print "uri: ", uri, "\n"
print "uri.scheme: ", URI.unescape(uri.scheme), "\n"
print "uri.password: ", URI.unescape(uri.password), "\n"

now it seems to work:  
uri: oracle://SCHEMA_FAKE:%23%23%[email protected]:1521/SIDDB
uri.scheme: oracle
uri.password: ###aaabbbccc
[Finished in 0.2s]

I had no time to check further as it seems to affect more parts. Please 
suggest how it could be handled in an elegant way.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/a9gqp8CluKUJ.
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