HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Accessing Sql Server thur Perl on HP-UX
Operating System - HP-UX
1831043
Members
2427
Online
110019
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2008 03:38 AM
03-19-2008 03:38 AM
Accessing Sql Server thur Perl on HP-UX
I want to connect Sql server database from my perl script. I have installed DBD::ODBC module and unixODBC pacakge in the unix server
please find the versions below:
perl 5.8.3
DBD-ODBC 1.15
DBI 1.52
when i run the below perl script am getting the following error
[unixODBC][Driver Manager]Data source name not found, and no default
driver specified (SQL-IM002)
This is my script:
#!/opt/perl5/bin/perl
use strict;
use DBI;
my $DSN = "DRIVER={SQL Server};Server=d3w9201G;database=Test;uid=user;pwd=pwd";
my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n";
my $getsdate =
$dbh->prepare("SELECT getdate()");
$getsdate->execute;
my $sdate = $getsdate->fetchrow_array;
print "$sdate\n";
Can anybody help on this to reslove this issue?
Thanks in Advance.
Shiv.
please find the versions below:
perl 5.8.3
DBD-ODBC 1.15
DBI 1.52
when i run the below perl script am getting the following error
[unixODBC][Driver Manager]Data source name not found, and no default
driver specified (SQL-IM002)
This is my script:
#!/opt/perl5/bin/perl
use strict;
use DBI;
my $DSN = "DRIVER={SQL Server};Server=d3w9201G;database=Test;uid=user;pwd=pwd";
my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n";
my $getsdate =
$dbh->prepare("SELECT getdate()");
$getsdate->execute;
my $sdate = $getsdate->fetchrow_array;
print "$sdate\n";
Can anybody help on this to reslove this issue?
Thanks in Advance.
Shiv.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2008 01:57 AM
03-20-2008 01:57 AM
Re: Accessing Sql Server thur Perl on HP-UX
Hi Shiv,
Though I am afraid that I have never had any exposure to MSSQL DB servers,
I think that your DSN may be malformed.
I would suggest that you carefully read the POD of DBD::ODBC and some API reference of your DBMS (I would think that even those for other programming languages like C(++), Java etc. would suffice).
There must somewhere appear examples how a proper DSN string needs to be formatted.
Also, for now forget about any other SQL code
until you successfully have connected to your DB.
Usually invocation of DBI's generic constructor along with a ping should be enough for testing this.
e.g.
DBI->connect($DSN, {PrintError=>1})->ping
Of course, it goes without saying that the user who is running the connect requires to have been granted at least connect (and probably some select) permissions for the targeted DB (and views).
Good Luck
Ralph
Though I am afraid that I have never had any exposure to MSSQL DB servers,
I think that your DSN may be malformed.
I would suggest that you carefully read the POD of DBD::ODBC and some API reference of your DBMS (I would think that even those for other programming languages like C(++), Java etc. would suffice).
There must somewhere appear examples how a proper DSN string needs to be formatted.
Also, for now forget about any other SQL code
until you successfully have connected to your DB.
Usually invocation of DBI's generic constructor along with a ping should be enough for testing this.
e.g.
DBI->connect($DSN, {PrintError=>1})->ping
Of course, it goes without saying that the user who is running the connect requires to have been granted at least connect (and probably some select) permissions for the targeted DB (and views).
Good Luck
Ralph
Madness, thy name is system administration
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP