Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

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 February 21st, 2013, 12:22 AM
Milap Milap is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 6 Milap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 58 sec
Reputation Power: 0
Connecting Database on Unix server through Windows Perl script

I am just wondering if I can connect the database that is on Linux server through Windows Perl script.

Is it possible ?? If the answer is yes then any idea how we can connect Unix database with Windows Perl programming.

Thanks in advance.

Reply With Quote
  #2  
Old February 21st, 2013, 01:28 AM
Laurent_R Laurent_R is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2012
Posts: 511 Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Laurent_R User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 4 Days 19 h 58 m 22 sec
Reputation Power: 405
Yes, in principle you can, using the DBI (database interface) module. Of course, it will depend on which database type it is and how you can access to your linux server from your windows box, but it is usually possible and even quite simple.

Reply With Quote
  #3  
Old February 21st, 2013, 02:15 AM
Milap Milap is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 6 Milap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 58 sec
Reputation Power: 0
Okey, so we can connect like this,

$dsn = "DBI:driver:database=$database;host=$hostname;port=$port";

Let me try this, Thanks a lot :-)

Reply With Quote
  #4  
Old February 21st, 2013, 08:58 AM
Axweildr's Avatar
Axweildr Axweildr is offline
'fie' on me, allege-dly
Click here for more information.
 
Join Date: Mar 2003
Location: in da kitchen ...
Posts: 12,874 Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)Axweildr User rank is General 81st Grade (Above 100000 Reputation Level)  Folding Points: 162285 Folding Title: Super Ultimate Folder - Level 1Folding Points: 162285 Folding Title: Super Ultimate Folder - Level 1Folding Points: 162285 Folding Title: Super Ultimate Folder - Level 1Folding Points: 162285 Folding Title: Super Ultimate Folder - Level 1Folding Points: 162285 Folding Title: Super Ultimate Folder - Level 1Folding Points: 162285 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Months 2 Weeks 1 Day 20 h 28 m 56 sec
Reputation Power: 6421
Send a message via Google Talk to Axweildr
Orkut
Assuming a MySQL db, it would need to be configured to permit access from remote hosts ...
__________________
--Ax
without exception, there is no rule ...
Handmade Irish Jewellery
Targeted Advertising Cookie Optout (TACO) extension for Firefox
The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones


09 F9 11 02
9D 74 E3 5B
D8 41 56 C5
63 56 88 C0
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
-- Jamie Zawinski
Detavil - the devil is in the detail, allegedly, and I use the term advisedly, allegedly ... oh, no, wait I did ...
BIT COINS ANYONE

Reply With Quote
  #5  
Old February 22nd, 2013, 01:31 AM
Milap Milap is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 6 Milap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 58 sec
Reputation Power: 0
Thank you very much for your inputs.

@Axweildr, yes I am using MySql DB (that is on unix server). Any idea how to give the permit access for the remote host ??

code snippet :-

use DBI;

my $database ="test";
my $hostname = "IP ADDRESS";
my $port = "3306";

$dsn = "DBI:mysql:database=$database;host=$hostname;p ort=$port";

#$dbh = DBI->connect($dsn, $user, $password);

$dbh = DBI->connect($dsn, 'mysql', '', {RaiseError => 1});
$drh = DBI->install_driver("mysql");

$sth = $dbh->prepare("SELECT * FROM employee");
$sth->execute;


Error :-
DBI connect('database=test;host=IP ADDRESS;port=3306','mysql',...) failed: Can't connect to MySQL server on 'IPADDRESS' (10060) at ....

Looks like I need to give remote permission to MySql ....

Thanks in advance :-)

Reply With Quote
  #6  
Old February 22nd, 2013, 03:27 AM
Milap Milap is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 6 Milap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 58 sec
Reputation Power: 0
Granted the permission to the mysql user for windows box ip id....

mysql> GRANT ALL PRIVILEGES ON test.* TO mysql@'WINDOWS_IP_ADDRESS' IDENTIFIED BY '';
Query OK, 0 rows affected (0.00 sec)

Can you please let me know if the above way is correct for permission granting...

Reply With Quote
  #7  
Old February 22nd, 2013, 08:15 AM
FishMonger FishMonger is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2009
Posts: 1,652 FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 5 h 32 m 21 sec
Reputation Power: 1170
That is the correct way to assign/grant the db permissions, but there is one additional step to enable those permissions.

Quote:
mysql> flush privileges;
Query OK, 0 rows affected (0.11 sec)

Reply With Quote
  #8  
Old February 28th, 2013, 11:48 PM
Milap Milap is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 6 Milap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 58 sec
Reputation Power: 0
Thanks FishMonger :-)

My Perl code seems to be correct but I think the MySql port 3306 is not enable for listening on my Windows box because of firewall security.

Thanks to you all once again.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Connecting Database on Unix server through Windows Perl script

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap