SPUG: Unix to MS SQL Server Using Perl and ODBC
Greg Mushen
greg.mushen at gettyimages.com
Wed Feb 9 19:41:54 CST 2000
I did this once and got it working. I had a similar environment to your
(Solaris and NT). I had to use a couple different pieces. I'm not sure if
this is the best way to do it though.
Here's what you'll need on the Microsoft side:
1. PlRPC version version 0.2012 or higher
2. Net-Daemon version 0.27 or higher
3. Bundle-DBI
4. DBD-ODBC version 0.20 or higher
There is a utility called dbiproxy that comes with either the DBI bundle or
the DBD-ODBC module. This is going to be the key utility in the process.
Basically, it sits on the Microsoft box waiting for queries. Configure a
dbiproxy configuration file (I've included the one I used) and then start
the daemon from the command line (you can also use certain utilities to
convert this into an actual service):
c:\dbiproxy --configfile=<path-to-your-config>
Then on the UNIX side, you'll need the following:
1. PlRPC
2. Net-Daemon
3. DBI
On the perl side, you will be able to connect to the database as normal. Be
sure to include the DSN, etc. such as:
$dbh = DBI->connect("dbi:Proxy:hostname=<your-host>;
port=<port>;
dsn=<dsn>,
<db user id>,
<db password>)
or die "DBI->errstr\n";
Hope this helps! Here's the configuration file...
-Greg Mushen
#File: dbiproxy.ini
#Author: Greg Mushen (greg.mushen at gettyimages.com)
#Date: 9/1/99
#Version: 1.0
#
# This is a configuration file for dbiproxy
# For more information on this file, consult the Net::Daemon documentation
at:
# http://theory.uwinnipeg.ca/CPAN/data/Net-Daemon/Net/Daemon.html
#
# Copy this version out and save as an ini file
{
##localport -- Specify the port number you want the service running on here
'localport' => 9999,
##pidfile -- Arbitrary file specifying the process number of the daemon
# must specify the full path to the file
'pidfile' => 'c:\tmp\dbiproxy.pid',
##logfile -- This specifies the path to the log file. Setting this value to
# 1 will cause logging to go to standard error.
'logfile' => 1,
##debug -- This option turns debugging mode to on (1). Change this value
# to zero if you wish to turn debugging off.
'debug' => 1,
##mode -- The daemon can run in three different modes: threads, fork
# and single connection mode. I tested in fork, but then decided
# to run it in single connection mode(default). This may need
# to be changed in the future if we decide to have more than one
# concurrent connection to the database.
#'mode' => '',
##timeout -- Defines the timeout period for each connection in seconds.
'timeout' => 60,
##clients -- Clients is an array reference with a list of clients. You can
# specify patterns of authentication with the mask element.
# This mask element is a Perl regular expression with either an
# IP address or a client's hostname. You can then specify
# whether or not this client is authorized by setting the
# "accept" variable to 1 (accept) or 0 (deny).
#
'clients' => [
{
'mask' => '.*',
'accept' => 1
}
] # End of client list
} #End of configuration
-----Original Message-----
From: Wegley, Harry L [mailto:Harry.Wegley at pss.boeing.com]
Sent: Wednesday, February 09, 2000 3:39 PM
To: 'spug-list at pm.org'
Cc: 'myself'
Subject: SPUG: Unix to MS SQL Server Using Perl and ODBC
Has anyone configured Perl on a Unix box (Solaris in my case) to
query
a remote Microsoft SQL server using ODBC? If so, what Perl modules
did
you use? What did you use for the driver and the driver manager? I
haven't
been able to put all the pieces together for what I thought was a
pretty
simple problem.
Any help would be greatly appreciated.
Harry Wegley
E-mail: Harry.L.Wegley at Boeing.Com
Phone: 206.655.8531
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list