Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Table creation

by moxliukas (Curate)
on Nov 24, 2003 at 13:17 UTC ( #309519=note: print w/replies, xml ) Need Help??

in reply to Table creation

Well, you have


before the second sql statement, so you are no longer connected to the database when you try to create the second table.

Replies are listed 'Best First'.
Re: Re: Table creation
by Win (Novice) on Nov 24, 2003 at 13:33 UTC
    I tried removing that before and it gave me the error message:
    Can't call method "do" on an undefined value at ....
      my $dbh->do(...) Aha... You didn't open your database handle, did you? ;-)

      You have to make sure there is a database connection before issuing SQL commands. If you do not call DBI->connect, your database handle will be undefined. In your case, you have created a new lexical with my $dbh in your second part of the code, which will be undefined unless you call the connect, or use the existing handle by dropping that my in front of $dbh->do(...) (assuming that you have dropped that first $dbh->disconnect of course). Here's an example on how to connect to the database using DBI and DBD.
      #!/usr/bin/perl -w use strict; use DBI; use DBD::Sybase; my $dbh = DBI->connect("dbi:Sybase:server=XXXX;database=XXXX", "USER", +"PASSWD") or die "Failed to connect to the database!"; my $sth = $dbh->prepare( qq{ SQL statement } ); $sth->execute(); my @column_headings = @{$sth->{NAME}}; while (my @row = $sth->fetchrow()) { # Data elements $row[0] ... $row[-1] ... } $sth->finish; $dbh->disconnect;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://309519]
[Corion]: Maybe doing a double-fork (daemonizing) can make go that information away, but maybe not
[Corion]: But I think my knowledge of unix/Linux datastructures is several decades out of date, so I don't really know what information it keeps on processes
[oiskuu]: The useful bits that relate to your process can be found under /proc/self. What information are you thinking of? Tty name?
[tye]: I just daemonized and getlogin() still knew who I had been.
[tye]: perhaps loginuid ? Not that I concede that something not being in /proc means it is not useful.
[Corion]: tye: That's really interesting, but maybe it is because getlogin() returns the name, or the uid, so if that user has been replaced by another user with the same uid in the meantime, that's no problem to the system...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2017-06-23 19:36 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (554 votes). Check out past polls.