Below is a patch that allows DBD::Oracle users to specify charset during connect as follows:
$dbh = DBI->connect("dbi:Oracle:$sid", $user, $pass, { ora_csid => 'AL32UTF8' }); The patch is the simplest thing that I could come up with to demonstrate the idea. I'm happy to make it robust if there is interest. Basically, I call OCIEnvNlsCreate a second time, after using the first envhp to convert the charset given as a string to Oracle's numeric identifier. Cheers, Stephen $ diff -uNr DBD-Oracle-1.19.orig DBD-Oracle-1.19 diff -uNr DBD-Oracle-1.19.orig/dbdimp.c DBD-Oracle-1.19/dbdimp.c --- DBD-Oracle-1.19.orig/dbdimp.c 2006-11-03 10:05:46.000000000 -0400 +++ DBD-Oracle-1.19/dbdimp.c 2007-03-29 08:34:54.486164400 -0400 @@ -502,6 +502,14 @@ return 0; } + svp = DBD_ATTRIB_GET_SVP(attr, "ora_csid", 8); + if (svp && SvOK(*svp)) { + charsetid = OCINlsCharSetNameToId(imp_dbh->envhp, SvPV_nolen(*svp)); + imp_dbh->envhp = NULL; + OCIEnvNlsCreate_log_stat( &imp_dbh->envhp, init_mode, 0, NULL, NULL, NULL, 0, 0, + charsetid, ncharsetid, status ); + } + /* update the hard-coded csid constants for unicode charsets */ utf8_csid = OCINlsCharSetNameToId(imp_dbh->envhp, (void*)"UTF8"); al32utf8_csid = OCINlsCharSetNameToId(imp_dbh->envhp, (void*)"AL32UTF8"); EOP