Last active
November 14, 2016 18:27
-
-
Save olleolleolle/d729c4de703276953cdd267d575e2f95 to your computer and use it in GitHub Desktop.
Sequel fixed a thing - here is a way to try that fix out - https://github.com/jeremyevans/sequel/commit/c65b4b48bbbe0f749abccf03a13da8e3fe534516
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby -G --dev | |
| $: << __dir__ | |
| require 'java' | |
| require 'jdbc/postgres' | |
| require 'sequel' | |
| require 'sequel/adapters/jdbc' | |
| require 'thread' | |
| # Pre-requisite: Set up a failing "SQL server" to not connect to | |
| # | |
| # nc -l 5700 | |
| $q = Queue.new | |
| # A broken "SQL Server" | |
| t0 = Thread.new do | |
| IO.popen("nc -l 5700") { |io| io.puts($q.read) } | |
| end | |
| # Connecting to it, using JDBC | |
| t1 = Thread.new do | |
| dsn = 'jdbc:postgresql://localhost:5700/my_thing' | |
| DB = p(Sequel.connect(dsn, login_timeout: 1)) | |
| # Here, we *actually* connect to the jdbc connect() method | |
| p(DB.tables) | |
| end | |
| sleep 3 | |
| $q.push "" | |
| t1.join |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Without the
:respond_to?:With the
:respond_to?: