<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>Windows Perl Scripting Forums &#187; Tag: database - Recent Posts</title>
<link>http://www.roth.net/forums/</link>
<description>Windows Perl Scripting Forums &#187; Tag: database - Recent Posts</description>
<language>en</language>
<pubDate>Fri, 24 May 2013 08:03:37 +0000</pubDate>

<item>
<title>zhu zhu hamster on "DBI permissions problem"</title>
<link>http://www.roth.net/forums/topic.php?id=15#post-639</link>
<pubDate>Tue, 01 Jun 2010 23:56:59 +0000</pubDate>
<dc:creator>zhu zhu hamster</dc:creator>
<guid isPermaLink="false">639@http://www.roth.net/forums/</guid>
<description>&#60;p&#62;you installed it by hand? i'am wondering if the make test worked for you? if a test fails and i think this is no problem, i usually just use (with cpanp) skiptest 1 and so the tests are not performed and often the module installs fine.
&#60;/p&#62;</description>
</item>
<item>
<title>Dave on "DBI-Conenct Problem"</title>
<link>http://www.roth.net/forums/topic.php?id=78#post-210</link>
<pubDate>Sun, 21 Jan 2007 13:33:24 +0000</pubDate>
<dc:creator>Dave</dc:creator>
<guid isPermaLink="false">210@http://www.roth.net/forums/</guid>
<description>I do not have very much experience with DBI but of the experience I do have the syntax you used seems correct. I use something akin to:&#60;br /&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
use DBI;&#60;br /&#62;
my $server ='foo_server';&#60;br /&#62;
my $db ='my_database_name';&#60;br /&#62;
my $usrnme ='my_user_name';&#60;br /&#62;
my $pwd ='my_password';&#60;br /&#62;
&#60;br /&#62;
my $hDB = DBI-&#38;gt;connect&#38;#40;&#38;quot;dbi&#38;#58;mysql&#38;#58;$db&#38;#58;$server&#38;quot;, $usrnme, $pwd&#38;#41; &#124;&#124; die $DBI&#38;#58;&#38;#58;errstr;&#60;br /&#62;
&#60;br /&#62;
my $query=&#38;quot;SELECT * FROM ping_lab&#38;quot;;&#60;br /&#62;
my $sth = $dbh-&#38;gt;prepare&#38;#40;$query&#38;#41;;&#60;br /&#62;
$sth-&#38;gt;execute&#38;#40;&#38;#41;;&#60;br /&#62;
while &#38;#40;my $row = $sth-&#38;gt;fetchrow_arrayref&#38;#41;&#60;br /&#62;
&#38;#123;&#60;br /&#62;
&#38;nbsp; &#38;nbsp; print join&#38;#40;&#38;quot;\t&#38;quot;, @$row&#38;#41;,&#38;quot;\n&#38;quot;;&#60;br /&#62;
&#38;#125;&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;&#60;br /&#62;
&#60;br /&#62;
Have you tried changing the code your host provider gave you?</description>
</item>
<item>
<title>shaffiahmed on "DBI-Conenct Problem"</title>
<link>http://www.roth.net/forums/topic.php?id=78#post-184</link>
<pubDate>Sat, 20 Jan 2007 08:22:01 +0000</pubDate>
<dc:creator>shaffiahmed</dc:creator>
<guid isPermaLink="false">184@http://www.roth.net/forums/</guid>
<description>I have a website which is already working. I have decided to chnage my hosting company. But i am having a problem getting my perl script working.&#60;br /&#62;
&#60;br /&#62;
If you click on the link below it displays a list of all proeprties:&#60;br /&#62;
&#60;a href=&#34;http://www.goarealestates.com/cgi-bin/housing.pl?search=1&#38;amp;amp;category=Buy&#38;amp;;submit=Go&#34; rel=&#34;nofollow&#34;&#62;http://www.goarealestates.com/cgi-bin/housing.pl?search=1&#38;amp;amp;category=Buy&#38;amp;;submit=Go&#60;/a&#62;!!!&#60;br /&#62;
&#60;br /&#62;
Within my script file, i have a statement as below which connects to the database&#60;br /&#62;
$dbh = db_connect($database,$user,$password); &#60;br /&#62;
&#60;br /&#62;
And the function db_connect() is as below:-&#60;br /&#62;
sub db_connect {&#60;br /&#62;
   ($database,$user,$password) = @_;&#60;br /&#62;
   my $h = DBI-&#38;gt;connect(&#38;quot;DBI:mysql:$database&#38;quot;, $user, $password)&#60;br /&#62;
   or printError(&#38;quot;Unable to connect to $database&#38;quot; . $DBI::errstr);&#60;br /&#62;
   return $h;&#60;br /&#62;
}&#60;br /&#62;
&#60;br /&#62;
&#60;br /&#62;
I have also got a db.cfg file which is as below&#60;br /&#62;
# script config file&#60;br /&#62;
 $database = &#38;quot;shafi&#38;quot;;&#60;br /&#62;
 $user = &#38;quot;shafi&#38;quot;; &#60;br /&#62;
 $password =&#38;quot;shafi&#38;quot;;&#60;br /&#62;
1;&#60;br /&#62;
&#60;br /&#62;
&#60;br /&#62;
&#60;br /&#62;
&#60;br /&#62;
But the present hosting provider has given an example of how to connect to the mysql database as below:-&#60;br /&#62;
=================================================&#60;br /&#62;
#!/usr/bin/perl&#60;br /&#62;
use DBI;&#60;br /&#62;
print &#38;quot;Content-type:text/html\n\n&#38;quot;;&#60;br /&#62;
$db_handle = DBI-&#38;gt;connect(&#38;quot;dbi:mysql:database=dbxxxxxxxx;host=dbxxx.oneandone.co.uk;user=dboxxxxxxxx;password=xxxxxxxx&#38;quot;)&#60;br /&#62;
    or die &#38;quot;Couldn't connect to database: $DBI::errstr\n&#38;quot;;&#60;br /&#62;
&#60;br /&#62;
    $sql = &#38;quot;SELECT * FROM puretest&#38;quot;;&#60;br /&#62;
    $statement = $db_handle-&#38;gt;prepare($sql)&#60;br /&#62;
    or die &#38;quot;Couldn't prepare query '$sql': $DBI::errstr\n&#38;quot;;&#60;br /&#62;
&#60;br /&#62;
    $statement-&#38;gt;execute()&#60;br /&#62;
    or die &#38;quot;Couldn't execute query '$sql': $DBI::errstr\n&#38;quot;;&#60;br /&#62;
    while ($row_ref = $statement-&#38;gt;fetchrow_hashref())&#60;br /&#62;
          {&#60;br /&#62;
              print &#38;quot;Name &#38;lt;b&#38;gt;$row_ref-&#38;gt;{name}&#38;lt;/b&#38;gt; has email address::&#38;lt;b&#38;gt;$row_ref-&#38;gt;{email}&#38;lt;/b&#38;gt;.&#38;lt;br&#38;gt;&#38;quot;;&#60;br /&#62;
           }&#60;br /&#62;
&#60;br /&#62;
    $db_handle-&#38;gt;disconnect();&#60;br /&#62;
===================================================&#60;br /&#62;
&#60;br /&#62;
The DBI-&#38;gt;connect statement is different and deosnt seem to work. Could someone tell me how my function should change to adapt to this hsoting provider.</description>
</item>
<item>
<title>keithh on "Win32::ODBC"</title>
<link>http://www.roth.net/forums/topic.php?id=4#post-97</link>
<pubDate>Fri, 27 Oct 2006 01:57:55 +0000</pubDate>
<dc:creator>keithh</dc:creator>
<guid isPermaLink="false">97@http://www.roth.net/forums/</guid>
<description>I've used the Win32::ODBC in the past with no issues.  But now I use ADO via the Win32 OLE&#60;br /&#62;
&#60;br /&#62;
Ive added some snippets below to give the general idea.  It works really well for me.&#60;br /&#62;
e.g.&#60;br /&#62;
&#60;br /&#62;
use Win32::OLE;&#60;br /&#62;
use Win32::OLE::Const 'Microsoft ActiveX Data Objects';&#60;br /&#62;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );&#60;br /&#62;
use MIME::Lite;&#60;br /&#62;
use Net::SMTP;&#60;br /&#62;
use File::Copy;&#60;br /&#62;
use File::Path;&#60;br /&#62;
&#60;br /&#62;
#my $ConnStr=&#38;quot;Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DEDS;Data Source=dambuster&#38;quot; ;&#60;br /&#62;
&#60;br /&#62;
&#60;br /&#62;
########&#60;br /&#62;
&#60;br /&#62;
Some code to pull from a database&#60;br /&#62;
&#60;br /&#62;
my $Statement = &#38;quot;SELECT * FROM FTP_Pull_list WHERE Active ='1'&#38;quot;;&#60;br /&#62;
my $RS;&#60;br /&#62;
if(! ($RS = $Conn-&#38;gt;Execute($Statement)))&#60;br /&#62;
{&#60;br /&#62;
	#print Win32::OLE-&#38;gt;LastError() ;&#60;br /&#62;
  errorlog(&#38;quot;Database Execute Error&#38;quot;, Win32::OLE-&#38;gt;LastError(),3, __LINE__);&#60;br /&#62;
	exit;;&#60;br /&#62;
}&#60;br /&#62;
while (! $RS-&#38;gt;EOF)&#60;br /&#62;
{&#60;br /&#62;
	$pull_list_name{$RS-&#38;gt;Fields(&#38;quot;Name&#38;quot;)-&#38;gt;value}=$RS-&#38;gt;Fields(&#38;quot;email&#38;quot;)-&#38;gt;value;&#60;br /&#62;
  $pull_list_ftp_server{$RS-&#38;gt;Fields(&#38;quot;Name&#38;quot;)-&#38;gt;value}=$RS-&#38;gt;Fields(&#38;quot;FTP_Server&#38;quot;)-&#38;gt;value;&#60;br /&#62;
  $pull_list_password{$RS-&#38;gt;Fields(&#38;quot;Name&#38;quot;)-&#38;gt;value}= $RS-&#38;gt;Fields(&#38;quot;password&#38;quot;)-&#38;gt;value;&#60;br /&#62;
	$pull_list_userid{$RS-&#38;gt;Fields(&#38;quot;Name&#38;quot;)-&#38;gt;value} = $RS-&#38;gt;Fields(&#38;quot;Userid&#38;quot;)-&#38;gt;value;&#60;br /&#62;
  $pull_list_directory{$RS-&#38;gt;Fields(&#38;quot;Name&#38;quot;)-&#38;gt;value}=$RS-&#38;gt;Fields(&#38;quot;directory&#38;quot;)-&#38;gt;value;&#60;br /&#62;
  $files_sendto{$RS-&#38;gt;Fields(&#38;quot;Name&#38;quot;)-&#38;gt;value}=$RS-&#38;gt;Fields(&#38;quot;sendto&#38;quot;)-&#38;gt;value;&#60;br /&#62;
  $files_ext{$RS-&#38;gt;Fields(&#38;quot;Name&#38;quot;)-&#38;gt;value}=$RS-&#38;gt;Fields(&#38;quot;ext_to_get&#38;quot;)-&#38;gt;value;&#60;br /&#62;
  $zipname{$RS-&#38;gt;Fields(&#38;quot;Name&#38;quot;)-&#38;gt;value}=$RS-&#38;gt;Fields(&#38;quot;zip_name&#38;quot;)-&#38;gt;value;&#60;br /&#62;
&#60;br /&#62;
  $RS-&#38;gt;MoveNext;&#60;br /&#62;
}&#60;br /&#62;
$RS-&#38;gt;Close;&#60;br /&#62;
$Conn-&#38;gt;Close;&#60;br /&#62;
}</description>
</item>
<item>
<title>msperl on "DBI permissions problem"</title>
<link>http://www.roth.net/forums/topic.php?id=15#post-36</link>
<pubDate>Fri, 11 Aug 2006 01:36:11 +0000</pubDate>
<dc:creator>msperl</dc:creator>
<guid isPermaLink="false">36@http://www.roth.net/forums/</guid>
<description>Alot of coders use the integer value of time(). You can then pass that into localtime(). Set up your SQL table to accept the date stamp as an 32 bit integer then in your insert command pass in the result of time(). Since it is an integer it is easy for SQL to index it.&#60;br /&#62;
In a SQL query you can get the date as a string by using the function FROM_UNIXTIME().</description>
</item>
<item>
<title>akearins on "DBI permissions problem"</title>
<link>http://www.roth.net/forums/topic.php?id=15#post-35</link>
<pubDate>Thu, 10 Aug 2006 21:33:16 +0000</pubDate>
<dc:creator>akearins</dc:creator>
<guid isPermaLink="false">35@http://www.roth.net/forums/</guid>
<description>thanks for all your help , found fix for it.Problem connecting with password&#60;br /&#62;
Ran command mysql -u root -p test&#60;br /&#62;
But still one slight problem.&#60;br /&#62;
&#60;br /&#62;
I have added tp previous code to insert the output from the file directly intoa table in MqSql database.&#60;br /&#62;
&#60;br /&#62;
But I have a problem with the date format.&#60;br /&#62;
&#60;br /&#62;
My SQl is using Type dateTime (YYY-MM-DD hh:mm:ss)&#60;br /&#62;
but was using my $date = localtime (Wed Jul 26 10:52:46 2006) in perl script.&#60;br /&#62;
&#60;br /&#62;
is there a date format I can use in perl to be the same as format I am suing in MySql dbase. Need both to be the same as getting errors when running script.</description>
</item>
<item>
<title>akearins on "DBI permissions problem"</title>
<link>http://www.roth.net/forums/topic.php?id=15#post-34</link>
<pubDate>Thu, 10 Aug 2006 18:41:42 +0000</pubDate>
<dc:creator>akearins</dc:creator>
<guid isPermaLink="false">34@http://www.roth.net/forums/</guid>
<description>how do i check that</description>
</item>
<item>
<title>Dave on "DBI permissions problem"</title>
<link>http://www.roth.net/forums/topic.php?id=15#post-33</link>
<pubDate>Thu, 10 Aug 2006 12:51:14 +0000</pubDate>
<dc:creator>Dave</dc:creator>
<guid isPermaLink="false">33@http://www.roth.net/forums/</guid>
<description>I tried your code on my system and it worked just fine. Are you sure that the server is listening to the default port (I think it is 3306)? If not then make sure that you specify the port number.</description>
</item>
<item>
<title>akearins on "DBI permissions problem"</title>
<link>http://www.roth.net/forums/topic.php?id=15#post-32</link>
<pubDate>Thu, 10 Aug 2006 04:18:38 +0000</pubDate>
<dc:creator>akearins</dc:creator>
<guid isPermaLink="false">32@http://www.roth.net/forums/</guid>
<description>Running it from a command line now for testing</description>
</item>
<item>
<title>Dave on "DBI permissions problem"</title>
<link>http://www.roth.net/forums/topic.php?id=15#post-31</link>
<pubDate>Thu, 10 Aug 2006 02:08:34 +0000</pubDate>
<dc:creator>Dave</dc:creator>
<guid isPermaLink="false">31@http://www.roth.net/forums/</guid>
<description>How are you running the script? Is it on a command line or from a service or web page?</description>
</item>
<item>
<title>akearins on "DBI permissions problem"</title>
<link>http://www.roth.net/forums/topic.php?id=15#post-30</link>
<pubDate>Thu, 10 Aug 2006 02:02:53 +0000</pubDate>
<dc:creator>akearins</dc:creator>
<guid isPermaLink="false">30@http://www.roth.net/forums/</guid>
<description>getting the following error when I run the code below:&#60;br /&#62;
&#60;br /&#62;
DBI connect('db_name:server_name','test'.........) failed:Access denied for user 'test'@server_name(using passowrd NO)at.....(path to database).&#60;br /&#62;
&#60;br /&#62;
When i run MySql command line client I enetr the password and no problem looking at databases, tables etc. or writing queries.&#60;br /&#62;
&#60;br /&#62;
But when i run teh script bang,......&#60;br /&#62;
&#60;br /&#62;
Is there any way i can check to see if I have permisiosn to use database&#60;br /&#62;
&#60;br /&#62;
Any help greatful&#60;br /&#62;
&#60;br /&#62;
&#60;br /&#62;
use strict;&#60;br /&#62;
use DBI;&#60;br /&#62;
&#60;br /&#62;
&#60;br /&#62;
my($query);&#60;br /&#62;
my $server ='server_name';&#60;br /&#62;
my $db ='db_name';&#60;br /&#62;
my $usrnme ='test';&#60;br /&#62;
&#60;br /&#62;
my $pwd ='21';&#60;br /&#62;
&#60;br /&#62;
my $dbh = DBI-&#38;gt;connect(&#38;quot;dbi:mysql:$db:$server&#38;quot;, $usrnme, $pwd)&#60;br /&#62;
	or die $DBI::errstr;&#60;br /&#62;
&#60;br /&#62;
&#60;br /&#62;
my $query=&#38;quot;SELECT * FROM ping_lab&#38;quot;;&#60;br /&#62;
&#60;br /&#62;
my $sth = $dbh-&#38;gt;prepare($query);&#60;br /&#62;
$sth-&#38;gt;execute();&#60;br /&#62;
&#60;br /&#62;
while (my $row = $sth-&#38;gt;fetchrow_arrayref) {&#60;br /&#62;
	print join(&#38;quot;\t&#38;quot;, @$row),&#38;quot;\n&#38;quot;;&#60;br /&#62;
}&#60;br /&#62;
&#60;br /&#62;
$dbh-&#38;gt;disconnect;</description>
</item>
<item>
<title>UNKILBEEG on "Win32::ODBC"</title>
<link>http://www.roth.net/forums/topic.php?id=4#post-6</link>
<pubDate>Wed, 19 Jul 2006 14:36:14 +0000</pubDate>
<dc:creator>UNKILBEEG</dc:creator>
<guid isPermaLink="false">6@http://www.roth.net/forums/</guid>
<description>Is the Win32::ODBC package still available? I tried to install it via the ActiveState PPM script and the installation bombed. &#60;br /&#62;
&#60;br /&#62;
I downloaded the most recent version I could find from the ftp site, &#60;a href=&#34;ftp://ftp.roth.net/pub/ntperl&#34; rel=&#34;nofollow&#34;&#62;ftp://ftp.roth.net/pub/ntperl&#60;/a&#62;, but even that is quite old. My version of Active State is Build 817, and the only documentation I found for installing Win32::ODBC assumed a build of approximately 300.&#60;br /&#62;
&#60;br /&#62;
I've played with the install and have had some luck getting it installed, but should I trust it with a Perl version so drastically different than the one it was apparently built for?</description>
</item>

</channel>
</rss>
