List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 1 2000 3:55pm
Subject:Re: perl dbi trouble getting example code to work
View as plain text  
At 5:02 AM -0800 02-01-2000, NEO MAN wrote:
>Now I copied this code directly from the mySQL book
>and I set the database name, username and password.
>The script just keeps crashing.  I didn't set the

What do you mean by "crash"?  Do you get an error message?
What is it?


>local host because I don't know exactly what a local
>host is.  Do I have to put the name of my site
>www.whatever.com for the local host or just
>whatever.com?  Or do I put the name of the server I am
>hosted on which is psiweb therefore put psiweb.com or
>www.psiweb.com.

The host is the host where the MySQL server is running.


>This is the only problem I can see other than that I'm
>not specifying my local host.  Here's the source code
>right from page 278 in the book called "mySQL".  I
>can't see there being a problem with code taken
>straight from the "mySQL" book itself.
>
>use DBI;
>use strict;
>
># I don't specify a host below because I didn't know
>exactly what to put and also it tells me that the
>local host will default to the one you are on.
>
>my ($dsn) = "DBI:mysql:testing";
>my ($username) = "myusername";
>my ($password) = "mypassword";
>my ($dbh, $sth);
>my (@ary);
>
>$dbh = DBI->connect ($dsn, $username, $password, {
>RaiseError => 1 });
>
># the letters are corresponding to the rows in an
>excel file I uploaded.  A is the product number and
>that is the order I wanted it to be in.
>
>$sth = $dbh->prepare ("SELECT A, B, C, D, E, F, G, H,
>I, J, K, L, M, N, O,"
>	. "P, Q, R, S, T, U, V, W, X, Y, Z, AA FROM
>mydatabase ORDER BY A");
>$sth->execute ();
>
>while (@ary = $sth->fetchrow_array ())
>{
>	print join ("\t", @ary), "\n";
>}
>$sth->finish ();
>
>$dbh->disconnect ();
>exit (0);

-- 
Paul DuBois, paul@stripped
Thread
perl dbi trouble getting example code to workNEO MAN1 Feb
  • Re: perl dbi trouble getting example code to worksasha1 Feb
  • Re: perl dbi trouble getting example code to workPaul DuBois1 Feb