[ic] interchange Sybase connection

Chen Naor chen at lilux.co.il
Tue Jul 22 14:13:56 EDT 2003

> I am using IC-4.9.8
> I am trying to connect to MS SQL server using dbi:Sybase
> I am able to connect to the database with a perl script
> but because of the Safe.pm in interchange i still can't connect to the
> database from within the interchange
> I used UserTag for aliasing to include the DBI but still the connect
> method call returns with error:::
> Safe: Can't locate object method "connect" via package "DBI"

You can use Global subs to overpass the Safe, but it open a security hole...
for doing so put in interchange.cfg

AllowGlobal <your catalog name>

and add a GlobalSub, this is an example:

GlobalSub <<EOF
 sub mssql_pass {
use strict;
use DBI;
use DBD::Sybase;
my $a =  shift  || 'null';
my $b =  shift  || 'null';
my $dsn = 'dbi:Sybase:server=aaa.bbb.ccc.ddd;database=foo';
my $dbh = DBI->connect($dsn, 'lametayel', 'uncrackable') or die $DBI::errstr;
my $sth = $dbh->prepare('sp_subscribe_shop @user_id=\'' . $a . '\', @sku=\'' . $b . '\'');

You call it in the page as follow:

 [perl subs=1 global=1 interpolate=1] 
  mssql_pass([scratch a],[scratch b]);

Hope you got a hint

Chen Naor
Lilux Systems
mail: chen at lilux.co.il

More information about the interchange-users mailing list