Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Access to MS Server

by monktim (Friar)
on Nov 06, 2003 at 16:39 UTC ( [id://305080]=note: print w/replies, xml ) Need Help??

in reply to Access to MS Server

You can write code to set up the data source. I've only done it using Win32::ODBC.
use strict; use warnings; use Win32::ODBC; my $server = 'matt'; my %data_source = Win32::ODBC::DataSources(); if (not defined($data_source{$server})) { # # Create a system DSN to the SQL Server # if (!Win32::ODBC::ConfigDSN(ODBC_ADD_SYS_DSN, 'SQL Server', ( "DSN=$server", "DESCRIPTION=$server", "SERVER=$server", 'DATABASE=First_trial', 'NETWORK=DBMSSOCN' ) )) { die "Unable to create DSN for $server"; } }

Replies are listed 'Best First'.
Re: Re: Access to MS Server
by Win (Novice) on Nov 10, 2003 at 10:40 UTC
    Other things that confuse me about this code:

    Should DESCRIPTION not be put down as DATA_SOURCE_DESCRIPTION?

    When I run this code I get:

    Undefined subroutine &Win32::ODBC::DataSources called at lin +e 13.

    What is the subroutine that I need for this code to work?

    Can I specify the Server as 'local'?

    I have tried switching Win32 to WinNT.

    When do I use Win32::ODBC and when do I use DBD::ODBC?

    Please answer any points that you can.
      Hi Win,

      The code should work as is. Try to run this code by itself and then check the ODBC data sources in the Control Pannel. You should see "matt" or whatever you assign $server to.

A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://305080]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (None)
    As of 2024-04-25 00:53 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found