NAME

DBIO::AccessBroker::Static - One fixed set of connection parameters as an AccessBroker

VERSION

version 0.900004

DESCRIPTION

Static brokers keep a single set of connection details and are transaction-safe by default. See "TRANSACTION SAFETY" in DBIO::AccessBroker.

METHODS

new

my $broker = DBIO::AccessBroker::Static->new(
  host     => 'localhost',
  port     => 5432,
  dbname   => 'myapp',
  username => 'myapp',
  password => 'secret',
);

Stores one fixed set of connection details. host, port and dbname are kept only when given; username and password default to the empty string. Each is readable (and writable) through the accessor of the same name.

connect_info_for

my $info = $broker->connect_info_for;

Returns the stored details as a hashref { host, port, dbname, user, password } (note: the username attribute is returned under the key user). The $mode argument is accepted for back-compat and ignored.

These are connection parameters, not a DSN, and they name no driver. A DBIO::Storage::DBI builds the DSN from dbname, host and port for the driver its storage class belongs to, in the form that driver's DBD takes ("_connect_params_dsn" in DBIO::Storage::DBI, ADR 0057) -- dbi:Pg:dbname=myapp;host=localhost;port=5432 for a schema that loaded the PostgreSQL component -- and leaves out the parts not given. So the schema must load its driver component: a storage that would learn its driver from the DSN has nothing to build one for, and refuses the broker. A driver whose DBD has no such form refuses too (ODBC); give it the whole DSN as dbname (dbname => 'dbi:ODBC:DSN=myapp'), which is taken as the DSN -- with host and port left out, since they cannot be put into it.

needs_refresh

Always false: static credentials never rotate.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.