Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl - m$sql - freetds

Status
Not open for further replies.

j0nxuser

Technical User
May 4, 2003
31
US
I am running a x86 RHL9 box and want to connect to a MS SQL server via a perl script. I think that I successfully installed freetds and DBD::Sybase. I think that I am able to connect to the server via a tsql statement.

****************************
[root@npsdev bin]# tsql -S ntlkp328.mycompany.net -U jsmith -P angst123
locale is "en_US.UTF-8"
charset is "UTF-8"
1>
****************************

I have read thru the FreeTDS readme as well as the DBD::Sybase documentation and still can't get where I want to go.

Several questions.

1) With the above info, does it look like I have successfully established a connection from my RHL9 box to the M$ sql server?

2) Does anyone have a test perl script that they have, that I can use to run a sample query? (maybe something like a "show tables"??)

I have searched on several message boards and they all lead me back to the vendor/package web pages.

Advice?
Thanks a million,
Mark
 
Without your table structure I can't not give you a real query but try something like :

---
$sth=$dbh->prepare("SELECT * FROM YOURTABLE");
# Replace YOURTABLE with a real table
$sth->execute();
print "Retrieved " , $sth->rows,"\n" ;
while(my $temp = $sth->fetchrow_hashref){
print "Got a row\n" ;
}


---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top