MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 21st, 2000, 04:27 AM
mattrogers mattrogers is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: London
Posts: 2 mattrogers User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
All,

Firstly, this is my first post to this group, so thanks in advance. I have searched the archive for an answer with success.

I am trying to connect to a MySQL database from Perl, Everything works fine when I run the script locally, but as soon as I try and run the script through a server I get the follow error message:

- Can't create IP socket (10106)

From the DBI module. I can guess at what it means, but have no idea how to resolve it. Any help would be greatly appreciated.

Cheers,

Matt.

Reply With Quote
  #2  
Old September 21st, 2000, 07:36 AM
Carpe Diem
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Hi

The basic script I use is as follows :-

#!/usr/bin/perl

use DBI;

$db = "test";
$sock = "/tmp/mysql.sock";
$user = "user";
$pass = "password";
$dsn = "DBI:mysql:$db;mysql_socket=$sock";

$dbh = DBI->connect($dsn,$user,$pass);
$sth = $dbh->prepare("SELECT * FROM Test");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "ID = $ref->{'ID'}, Name = $ref->{'Name'}n";
}
$sth->finish();
$dbh->disconnect();

###########

I tend to connect via the unix socket rather then an IP address style connection (Only works locally)

Regards
Darren http://www.php4hosting.com/ $ http://www.php4hosting.co.uk/ £

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Accessing a MySQL database from Perl


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT