Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Is bind useful for one-time queries and commands?

by sabari (Beadle)
on May 20, 2008 at 11:34 UTC ( #687584=note: print w/ replies, xml ) Need Help??


in reply to Re: Is bind useful for one-time queries and commands?
in thread Is bind useful for one-time queries and commands?

Dear Friends,
I am very new to perl ,can any one post the sample code for the database operation with bind ?.

Best Regards, S.Sabarinathan,


Comment on Re^2: Is bind useful for one-time queries and commands?
Re^3: Is bind useful for one-time queries and commands?
by sathiya.sw (Monk) on Nov 19, 2008 at 14:06 UTC
    check the following sample code ( for sabari )..
    #Establish the connection to the database. my $dbh = DBI->connect( 'dbi:Pg:database=test','test','1234',{RaiseErr +or => 1,AutoCommit => 0}) || die "Database connection not made: $DBI::errstr"; #It get the port number and IP address from the data base. my $sql = qq{ SELECT port,ipaddr,log_file FROM details where name='$na +me'}; my $sth = $dbh->prepare( $sql ); $sth->execute(); #bind_columns - It stored the port number and IP address to variable. my( $port, $ipaddr,$log_file ); $sth->bind_columns(\$port, \$ipaddr,\$log_file); #It fetch the values from table $sth->fetch(); $sth->finish(); #Dis-connect the database,if we miss it tells warnings, that destroy h +ad been #called with out disconnect. $dbh->disconnect();

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://687584]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-09-16 20:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (48 votes), past polls