dbi Questions

11

Solved

Is CPAN DBI the best database interface to use in Perl for general database use? Are there some better options?
Ideate asked 3/9, 2008 at 22:53

5

Solved

I cannot use %ENV var on my Perl script to use Oracle libs. BEGIN { $ORACLE_HOME = "/usr/lib/oracle/10.2.0.3/client64"; $LD_LIBRARY_PATH = "$ORACLE_HOME/lib"; $ORACLE_SID="prod"; $ENV{ORACLE_S...
Bicameral asked 28/12, 2011 at 14:15

2

Solved

I'm trying to store the runtime mssql error in variable and continue with all other data. my $sth = $dbh->prepare("exec TEST_ABC_DB.dbo.testprocedure"); $sth->execute() ; my $db_error =$DBI...
Boldfaced asked 2/1, 2017 at 8:46

3

Solved

I am using Perl DBI. I know that $dbase->tables() will return all the tables in the corresponding database. Likewise, I want to know the schemas available in the database. Is there any function ...
Fluff asked 25/5, 2010 at 10:58

1

Solved

I have written a sample Perl program to delete data from a database table. This is the code I have written, use DBI; my $dbh = DBI->connect("DBI:Pg:host=192.168.12.23;port=5432;", "adhi"); i...
Osbourne asked 28/7, 2016 at 12:12

4

Solved

Is there a way to reuse the ?'s used on a DBI prepare statement. Consider the following code: $sth=$dbh->prepare("INSERT INTO mytable(a,b,c) SELECT ?,B(?),C(?)"); $sth->execute($a,$a,$a); It wo...
Antonyantonym asked 5/7, 2010 at 16:22

2

Specifically, I need to delete some rows from a table while iterating over all rows in the table. Does DBI have something like an updateable resultset in Java? So, if I do something like: $query_a...
Brindled asked 31/8, 2015 at 9:21

6

Solved

My delicious-to-wp perl script works but gives for all "weird" characters even weirder output. So I tried $description = decode_utf8( $description ); but that doesnt make a difference. I would...
Jive asked 11/6, 2009 at 21:22

2

Solved

On many front ends, I wish to enforce my scripts using a readonly connection to a sqlite3 file mirrored from a master server. Is there's a way to say DBI to do this ? For the moment, I'm doing th...
Correlative asked 18/12, 2015 at 13:48

2

Solved

I'm trying to connect with an SSL client key using DBI and DBD::Pg. use strict; use warnings 'all'; use DBI; my $dsn = "dbi:Pg:db=mydb;sslmode=require;host=localhost;" ."sslcert=C:\\path with\\s...
Basketwork asked 16/12, 2015 at 17:3

5

Solved

Could some tell me if there is a function which works the same as PHP's mysql_real_escape_string() for Perl from the DBI module?
Laurice asked 5/2, 2010 at 13:59

3

Solved

i am pulling urls from my database with a perl script where i employ fetchrow_array to pull URL from the database which worked fine until i encountered a very long URL georgelog24.blog.iskreni.net/...
Highkeyed asked 7/9, 2012 at 9:30

7

Solved

I have this query select * from table where ID in (1,2,3,5...) How is it possible to build this query with the DBI using placeholders ? for example : my @list = (1, 2, 3, 4, 5); my $sql = "selec...
Bellaude asked 22/10, 2011 at 18:19

1

I'm getting: "Use of uninitialized value in join or string at ./test_script.pl line 69, <fh> line 91." The code creating this warning is here: # Write results of SQL execution to output f...
Resiniferous asked 6/11, 2014 at 17:27

9

Solved

Our website uses Perl to provide a simple mechanism for our HR people to post vacancies to our website. It was developed by a third party, but they have been long since kicked into touch, and sadly...
Sleep asked 14/11, 2008 at 13:49

2

Solved

What's the best way of capturing any DBI errors in Perl? For example if an insert fails because there were illegal characters in the values being inserted, how can I not have the script fail, but c...
Hulbert asked 27/1, 2011 at 23:2

3

Solved

How can I fetch the last row that was inserted using DBI (DBD::mysql)? Code sample: my $sth = $dbh->prepare('INSERT INTO a ( x, y, z ) VALUES ( ?, ?, ? )'); $sth->execute( $x, $y, $z ); H...
Jell asked 15/12, 2009 at 11:45

3

Solved

I have the weirdest problem and my extremely basic knowledge of SQL must be terribly wrong, but I cannot make sense of the behaviour illustrated below. I have this file test.csv id,field A,0 B,1 ...
Tiros asked 6/5, 2014 at 7:41

2

Solved

At the moment, I am running multiple statements on MYSQL as below; my $sth1 = $dbh->prepare("ALTER TABLE whatever...."); my $sth2 = $dbh->prepare("UPDATE whatever...."); my $sth3 = $db...
Protege asked 28/3, 2014 at 10:0

2

Solved

Suppose I am querying a table with something like the following: $dbh->selectrow_hashref('SELECT id, name FROM foos WHERE name = "bar"'); Naturally, id would be an integer, but the resulting ...
Anaesthetize asked 27/3, 2014 at 19:14

3

Solved

I can successfully create a connection to a Postgres db using the following: my $settings = { host => 'myhost', db => 'mydb', user => 'myuser', passwd => 'mypasswd' }; my $connec...
Impressionable asked 16/5, 2013 at 4:28

2

I'm having a hard time getting manual transactions to work as documented in DBD::Pg, or I'm simply misunderstanding said documentation. My understanding is that if I want to manually manage transa...
Animalism asked 13/6, 2013 at 3:51

2

Solved

I am trying to fetch data like (Select 1 from table) which returns data with one row and one column. I dont want to use $sth->fetchrow_array method to retreive the data in to array. Is there an...
Ectype asked 4/8, 2013 at 15:38

6

Solved

I'm creating a set of SQL INSERT statements for a database that doesn't exist yet, and I'm saving them to file. How can I use Perl's powerful DBI module to create those INSERT statements without a...
Ostracize asked 12/7, 2011 at 19:43

1

Solved

I have a Perl program that we have run successfully every day for almost the past 2 years, but which crashes today with the error message: FATAL ERR: Can't do PRAGMA cache_size = 1000000: attemp...
Mud asked 22/7, 2013 at 17:25

© 2022 - 2024 — McMap. All rights reserved.