DBD::Go...::stream(3)

πŸ’– DBD::Go...::stream πŸ’–

okay bestie, welcome to the manual page for DBD::Gofer::Transport::stream β€” it's a DBD::Gofer transport that does its whole thing over stdio streaming, and honestly? it's iconic. this is part of the User Contributed Perl Documentation and it's giving remote database realness. let's get into it 🫢


✨ NAME ✨

DBD::Gofer::Transport::stream β€” the DBD::Gofer transport that handles stdio streaming. that's the whole vibe. that's the name. periodt πŸ’…


🌈 SYNOPSIS 🌈

you wanna connect? say less. you can do it the direct way:

DBI->connect('dbi:Gofer:transport=stream;url=ssh:username@host.example.com;dsn=dbi:...',...)

or, if you're feeling lazy (valid), just set the DBI_AUTOPROXY environment variable and let it cook:

export DBI_AUTOPROXY='dbi:Gofer:transport=stream;url=ssh:username@host.example.com'

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea. if you don't pass a url= parameter, it just launches a subprocess like this:

perl -MDBI::Gofer::Transport::stream -e run_stdio_hex

and then it feeds requests into it and reads responses back out of it. cute! but… ngl, not very useful. it's giving "technically works" energy. 😭

now, with a url=ssh:username@host.example.com parameter? bestie. it uses ssh to launch that subprocess on a remote system, and that's where it gets good πŸ”₯

it hands you secure remote access to DBI databases on literally any system you can log in to. and because ssh is doing the heavy lifting, you also get optional compression and a whole buffet of other features β€” go peek at the ssh manual for how to configure that and many other options via your ~/.ssh/config file. iykyk πŸŽ€

the actual command it invokes looks something like this:

ssh -xq ssh:username@host.example.com bash -c $setup $run

where $run is the command shown above, and $command is:

. .bash_profile 2>/dev/null || . .bash_login 2>/dev/null || . .profile 2>/dev/null; exec "$@"

which is trying β€” in a limited and fairly unportable way β€” to set up the environment (PATH, PERL5LIB, etc.) exactly like it would be if you had actually logged in to that system. it's trying its best, okay? πŸ™ˆ

also: that "perl" used in the command defaults to the value of $^X whenever you're not using ssh. on most systems that's the full path to the perl that's currently executing. slay ⭐


πŸ‘‘ PERSISTENCE πŸ‘‘

as of right now, gofer stream connections persist (meaning: stay connected) even after all database handles have been disconnected. which means later connections in the same process are very fast. obsessed πŸ’–

and currently, up to 5 different gofer stream connections (keyed on url) can persist at once. if more than 5 are chillin' in the cache when a new connection shows up, the cache gets cleared before the new connection is added. simple but effective, no notes ✨


πŸ’€ TO DO πŸ’€

stuff that's still on the vision board:

  • document the go_perl attribute
  • automatically reconnect (within reason) if there's a transport error
  • decide on the default for persistent connection β€” on or off? limits? ttl?

we'll get there. someday. 🧚


🌸 AUTHOR 🌸

Tim Bunce, <http://www.tim.bunce.name>


Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved.

this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. see perlartistic.


πŸ’œ SEE ALSO πŸ’œ

  • DBD::Gofer::Transport::Base
  • DBD::Gofer

and that's the whole page, bestie 🫢 this was perl v5.42.3, dated 2026-10-19, and you just read DBD::Go...::stream(3). go forth and stream ur stdio responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from