Tuesday, March 17, 2009

EMCVisualSRM, MSSQL, ODBC, and perl

What I used to make it work:

drivers and libraries:
  1. freetds-0.82, provides odbc drivers, config files and libraries
perl modules:
  1. Class-DBI-MSSQL-0.122
  2. DBD-ODBC-1.18
  3. DBIx-Class-0.08012
There may be others, but these seem to be sufficient.

This is the script that worked:


#!/usr/bin/perl

use DBI;
# use DBIx::Class::Storage::DBI::Sybase::MSSQL;
$database = "EMCVisualSRM";
$host = "cewa165059";
$port = 1433;

# $dsn = "DBI:MSSQL:databse=$database;host=$host;port=$port";
# $dbh = DBI->connect($dsn, "srmreport", "srmreport");
$dbh = DBI->connect('dbi:ODBC:MSSQL', '-------', '-------');
$query = "select * from Mount";
$query2 = "select SrmResource.Name,Mount.MountPoint,Mount.FSType,Mount.TotalSizeBytes,Mount.TotalUsedBytes from SrmResource,Mount where Mount.ResourceId=SrmResource.Id";

$sth = $dbh->prepare($query2);
$sth->execute();


configuration of /etc/odbc.ini



[MSSQL]
Driver = /usr/local/lib/libtdsodbc.so
Description = MSSQL Server
Trace = No
Server = cewa165059
Database = EMCVisualSRM
Port = 1433
TDS_Version = 8.0

0 Comments:

Post a Comment

<< Home