def self.new(uri_s)
uri = DataObjects::URI::parse(uri_s)
case uri.scheme.to_sym
when :java
warn 'JNDI URLs (connection strings) are only for use with JRuby' unless RUBY_PLATFORM =~ /java/
when :jdbc
warn 'JDBC URLs (connection strings) are only for use with JRuby' unless RUBY_PLATFORM =~ /java/
driver_name = if uri.path.split(':').first == 'sqlite'
'sqlite3'
elsif uri.path.split(':').first == 'postgresql'
'postgres'
else
uri.path.split(':').first
end
conn_uri = uri_s
else
driver_name = uri.scheme
conn_uri = uri
end
DataObjects.const_get(driver_name.capitalize)::Connection.new(conn_uri)
end