Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

How to set 'max_len' for DBI 'bind_param'

by JamesK3 (Initiate)
on Dec 13, 2017 at 16:01 UTC ( [id://1205438]=perlquestion: print w/replies, xml ) Need Help??

JamesK3 has asked for the wisdom of the Perl Monks concerning the following question:

Great and wise Perl monks,

I'm a Perl novice still endeavoring through my journey to your great and vaunted status.

How the heck do I set a 'max_len' parameter when using DBI and 'bind_param'?

I'm encountering an issue where one of the parameters that I'm attempting to bind can be over thousands of characters long and exceeding the default maxlen and flowing into the next parameter. Below is what I'm seeing in my DBI 'trace.txt':
bd_bind_ph(1): bind :p52 <== ''James K3Home AddressCity, State 28301Ja +mes.K3@address.comPhone: (111)111-1111OBJECTIVEPursuing a position th +at would allow me to utilize my computer skills while allowing me to +contribute to a dynamic business environment.SKILLSLinux administrati +on (CentOS/Ubuntu)Writing and maintaining Bash scripts Writing and ma +intaining Perl scriptsWriting and maintaining Standard Operating Proc +eduresVMWare ESXiEMC Unisphere Management (VNXe) Server RackingProfic +ient in Windows and Linux systems administrationPhone/Network cabling +EXPERIENCE As a Systems Administrator with the CompanyImWith I am res +ponsible for maintining a wide array of infrastructure, ensuring that + system security and maintenance is maintained without negatively imp +acting production workflows. In my current role my team and I manage + 270 servers, working with ESXi 5.5, Oracle Enterprise Linux (5.8 . 6 +.6), as well as Server 2000 . 2012r2. While with CompanyImWith I hav +e taken the lead on implementing monitorin...' (type 0 (DEFAULT (varc +har))) dbd_rebind_ph_char() (1): bind :p52 <== ''Jame...' (size 3746/3752/0, +ptype 5(LONG), otype 8 ) dbd_rebind_ph_char() (2): bind :p52 <== ''Jame...' (size 3746/3752, ot +ype 8(LONG), indp 0, at_exec 1) bind :p52 as ftype 8 (LONG) dbd_rebind_ph(): bind :p52 <== ''Jame...' (in, not-utf8, csid 1->0->1, + ftype 8 (LONG), csform 0(0)->0(0), maxlen 3752, maxdata_size 0) dbd_bind_ph(1): bind :p53 <== ' ensuring proper adherence to the dicta +tes of the NISPOM while assisting the customer in maintaining mission + readiness and accomplishment. In my role as the AFSO I assiste
TIA!
James

Replies are listed 'Best First'.
Re: How to set 'max_len' for DBI 'bind_param'
by nysus (Parson) on Dec 13, 2017 at 19:10 UTC
Re: How to set 'max_len' for DBI 'bind_param'
by poj (Abbot) on Dec 14, 2017 at 13:51 UTC

    Assuming this is Oracle, run this code and post the results so we can see the versions of perl you have. Are your INSERTING data into a LONG datatype ?

    #!/usr/bin/perl use strict; use DBI; use DBD::Oracle; print "perl $^O $^V DBI $DBI::VERSION DBD::Oracle $DBD::Oracle::VERSION\n"; my $dbh = dbh(); my $ar = $dbh->selectall_arrayref('SELECT * FROM V$VERSION'); print "@$_\n" for @$ar; sub dbh { my $dsn = "dbi:Oracle:host=yourHOSTNAME;sid=yourSID;port=1521"; my $user = 'user'; my $password = 'password'; my $dbh = DBI->connect($dsn,$user,$password, { PrintError => 1, RaiseError => 1, AutoCommit => 1, }) or die "Canot create Databse Handle: $DBI::errstr()"; return $dbh; }
    poj
Re: How to set 'max_len' for DBI 'bind_param'
by nysus (Parson) on Dec 13, 2017 at 17:21 UTC
    Please surround your code with <code>your code here</code> tags.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

      Thanks, just corrected.
Re: How to set 'max_len' for DBI 'bind_param'
by Marshall (Canon) on Dec 14, 2017 at 00:47 UTC
    Hi,
    I googled "DBI bind LOB max length" and came up with this link:
    Handling LONG/LOB Data.
    This and related links appear to answer your question. However, I am not completely sure that this link isn't a copywrite infringement. If it is then I or the janitors will remove this link.

    Update: I removed the link - it now goes nowhere.

      copyright, rather than copy write. Yes, that domain is well known for this sort of thing.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1205438]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-16 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found