From DBD::ODBC 0.21, you can put all of the connection attributes specified in your odbc.ini file in the connection string passed to DBI->connect()
.
For example, suppose your odbc.ini file looked like this:
[dsn_name] ServerPort = demo.easysoft.com:8888; LogonUser = fred LogonAuth = password TargetDSN remotedsn
You can do away with the entire odbc.ini file and use the following Perl instead:
my $DSN = 'DRIVER={OOB};ServerPort=demo.easysoft.com:8888;'; $DSN = $DSN . 'LogonUser=fred;LogonAuth=password;TargetDSN=remotedsn'; my $dbh = DBI->connect("dbi:ODBC:$DSN", "database_user", "database_password") || die "Database connection failed: $DBI::errstr";
This can be particularly useful if you want to hide your usernames and password. For example, if you do not want them visible in the odbc.ini file. You could retrieve the username and password from somewhere else or even prompt for them.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.