Re[4]: DB2 and Function sequence error
Hello db2perl, Tuesday, June 19, 2001, 12:33:07 AM, you wrote: I specified file instead of dir. Now i changed it to dir and, heh, trace file appeared ;). Here is it [ Process: 1104, Thread: 1024 ] [ Date Time: 19/06/2001 10.54.23.08 ] [ Product: QDB2/NT 7.1.0.41 ] [ Level Identifier: 03010105 ] [ CLI Driver Version: 07.02. ] [ Informational Tokens: DB2 v7.1.0.41,n010426,WR21254 ] SQLAllocHandle( fHandleType=SQL_HANDLE_ENV, hInput=0:0, phOutput=01ae3fcc ) --- Time elapsed - 0 seconds SQLAllocHandle( phOutput=0:1 ) --- SQL_SUCCESS Time elapsed - +2.705000E-003 seconds SQLSetEnvAttr( hEnv=0:1, fAttribute=SQL_ATTR_ODBC_VERSION, vParam=3, cbParam=0 ) --- Time elapsed - +3.67E-004 seconds SQLSetEnvAttr( ) --- SQL_SUCCESS Time elapsed - +1.475000E-003 seconds SQLAllocHandle( fHandleType=SQL_HANDLE_DBC, hInput=0:1, phOutput=01a8ba78 ) --- Time elapsed - +4.22E-004 seconds SQLAllocHandle( phOutput=0:1 ) --- SQL_SUCCESS Time elapsed - +2.281700E-002 seconds SQLConnect( hDbc=0:1, szDSN=rent, cbDSN=-3, szUID=, cbUID=-3, szAuthStr=, cbAuthStr=-3 ) --- Time elapsed - +1.150700E-002 seconds ( DBMS NAME=DB2/NT, Version=07.02., Fixpack=0x23010105 ) ( Application Codepage=1251, Database Codepage=1251, Char Send/Recv Codepage=1251, Graphic Send/Recv Codepage=1251, iGraphic Codepage=1251 ) SQLConnect( ) --- SQL_SUCCESS Time elapsed - +1.830246E+000 seconds ( DSN=RENT ) ( UID= ) ( PWD=* ) SQLSetConnectAttr( hDbc=0:1, fOption=SQL_ATTR_AUTOCOMMIT, pvParam=0001, iStrLen=0 ) --- Time elapsed - +2.225000E-003 seconds SQLSetConnectAttr( ) --- SQL_SUCCESS Time elapsed - +8.693000E-003 seconds SQLAllocHandle( fHandleType=SQL_HANDLE_STMT, hInput=0:1, phOutput=01a4f284 ) --- Time elapsed - +9.60E-004 seconds SQLAllocHandle( phOutput=1:1 ) --- SQL_SUCCESS Time elapsed - +2.133600E-002 seconds SQLPrepare( hStmt=1:1, pszSqlStr=call sp_Get_Buildings(), cbSqlStr=-3 ) --- Time elapsed - +6.35E-003 seconds ( StmtOut=call sp_Get_Buildings() ) SQLPrepare( ) --- SQL_SUCCESS Time elapsed - +1.919000E-002 seconds SQLNumParams( hStmt=1:1, pcPar=0140fb0e ) --- Time elapsed - +3.30E-004 seconds SQLNumParams( pcPar=0 ) --- SQL_SUCCESS Time elapsed - +1.268000E-003 seconds SQLNumResultCols( hStmt=1:1, pcCol=0140faf2 ) --- Time elapsed - +1.681000E-003 seconds SQLNumResultCols( pcCol=0 ) --- SQL_SUCCESS Time elapsed - +1.289000E-003 seconds SQLExecute( hStmt=1:1 ) --- Time elapsed - +8.473000E-003 seconds ( return=0 ) SQLExecute( ) --- SQL_SUCCESS Time elapsed - +1.783976E+000 seconds SQLNumResultCols( hStmt=1:1, pcCol=0140fbf2 ) --- Time elapsed - +3.31E-004 seconds SQLNumResultCols( pcCol=5 ) --- SQL_SUCCESS Time elapsed - +1.184000E-003 seconds SQLDescribeCol( hStmt=1:1, iCol=1, pszColName=01c86760, cbColNameMax=128, pcbColName=01a74744, pfSQLType=01a7473c, pcbColDef=01a7474c, pibScale=01a74750, pfNullable=01a74752 ) --- Time elapsed - +2.94E-004 seconds SQLDescribeCol( pszColName=ID - X4944, pcbColName=2, pfSQLType=SQL_INTEGER, pcbColDef=10, pibScale=0, pfNullable=SQL_NO_NULLS ) --- SQL_SUCCESS Time elapsed - +6.074300E-002 seconds SQLColAttribute( hStmt=1:1, iCol=1, fDescType=SQL_DESC_DISPLAY_SIZE, rgbDesc=NULL, cbDescMax=0, pcbDesc=NULL, pfDesc=01a74748 ) --- Time elapsed - +3.12E-004 seconds SQLColAttribute( pfDesc=11 ) --- SQL_SUCCESS Time elapsed - +2.213000E-003 seconds SQLBindCol( hStmt=1:1, iCol=1, fCType=SQL_C_CHAR, rgbValue=01b2fc20, cbValueMax=12, pcbValue=01a74760 ) --- Time elapsed - +2.51E-004 seconds SQLBindCol( ) --- SQL_SUCCESS Time elapsed - +2.665000E-003 seconds SQLDescribeCol( hStmt=1:1, iCol=2, pszColName=01c86763, cbColNameMax=128, pcbColName=01a74770, pfSQLType=01a74768, pcbColDef=01a74778, pibScale=01a7477c, pfNullable=01a7477e ) --- Time elapsed - +2.63E-004 seconds SQLDescribeCol( pszColName=STREET_ID - X5354524545545F4944, pcbColName=9, pfSQLType=SQL_INTEGER, pcbColDef=10, pibScale=0, pfNullable=SQL_NO_NULLS ) --- SQL_SUCCESS Time elapsed - +4.233000E-003 seconds SQLColAttribute( hStmt=1:1, iCol=2, fDescType=SQL_DESC_DISPLAY_SIZE, rgbDesc=NULL, cbDescMax=0, pcbDesc=NULL, pfDesc=01a74774 ) --- Time elapsed - +2.57E-004 seconds SQLColAttribute( pfDesc=11 ) --- SQL_SUCCESS Time elapsed - +2.138000E-003 seconds SQLBindCol( hStmt=1:1, iCol=2, fCType=SQL_C_CHAR, rgbValue=01ab7600, cbValueMax=12, pcbValue=01a7478c ) --- Time elapsed - +2.52E-004 seconds SQLBindCol( ) --- SQL_SUCCESS Time elapsed - +1.684000E-003 seconds SQLDescribeCol( hStmt=1:1, iCol=3, pszColName=01c8676d, cbColNameMax=128, pcbColName=01a7479c, pfSQLType=01a74794, pcbColDef=01a747a4, pibScale=01a747a8, pfNullable=01a747aa ) --- Time elapsed - +2.45E-004 seconds SQLDescribeCol( pszColName=NAME -
Re: DBD::Sybase - (Not) Chopping Blanks
Hello, the first of my problems has been solved (just a little error when writing the data), the second one still occurs; here is an example what happens: The following SQL generates Output in Fixed-Format: select isnull(convert(char(4 ), gewinnspiel_nr ), space(4)) ,isnull(convert(char(8 ), gueltig_von , 112), space(8)) ,isnull(convert(char(8 ), gueltig_bis , 112), space(8)) ,isnull(convert(char(255), fragen ), space(255)) from gewinnspiel An additional Order-By-Clause deletes the Blanks after each column (Chop-Blanks is set off!): select isnull(convert(char(4 ), gewinnspiel_nr ), space(4)) ,isnull(convert(char(8 ), gueltig_von , 112), space(8)) ,isnull(convert(char(8 ), gueltig_bis , 112), space(8)) ,isnull(convert(char(255), fragen ), space(255)) from gewinnspiel order by gewinnspiel_nr Does anyone know what happens here or how it can be avoided ? Thanks in advance. Klaus Dittrich Hello all, I just startet using DBD::Sybase (after experimenting with DBD::Oracle and DBD::ODBC), and I found some effects I don't know how to handle. 1. Is it possible to avoid the additional Blank after each column I select (it does not appear always, but in most cases)? I know it can be avoided in isql, but how is it done in DBD:: Sybase (without losing the blanks I need for a fixed format output, i.e. ChopBlanks does not help) ? 2. In some obscure cases, all Blanks are chopped when I add an Order-By-Clause to an Select, though I explicitely cast the columns to a fixed length. Without Order-By the Blanks are not chopped and I get a Fixed-Length-Output. Can this behaviour be changed (or can someone explain it to me)? I'm using Perl 5.005_03 and DBD::Sybase 0.22. Thanks in advance. Klaus Dittrich Mannesmann Mobilfunk GmbH Duesseldorf, Germany [EMAIL PROTECTED] Der clevere Infobote - Shopping-Tipps bequem abonniert. Jetzt neu bei http://www.epost.de
Re: DBD::Sybase - (Not) Chopping Blanks
Hello, the first of my problems has been solved (just a little error when writing the data), the second one still occurs; here is an example what happens: The following SQL generates Output in Fixed-Format: select isnull(convert(char(4 ), gewinnspiel_nr ), space(4)) ,isnull(convert(char(8 ), gueltig_von , 112), space(8)) ,isnull(convert(char(8 ), gueltig_bis , 112), space(8)) ,isnull(convert(char(255), fragen ), space(255)) from gewinnspiel An additional Order-By-Clause deletes the Blanks after each column (Chop-Blanks is set off!): select isnull(convert(char(4 ), gewinnspiel_nr ), space(4)) ,isnull(convert(char(8 ), gueltig_von , 112), space(8)) ,isnull(convert(char(8 ), gueltig_bis , 112), space(8)) ,isnull(convert(char(255), fragen ), space(255)) from gewinnspiel order by gewinnspiel_nr Does anyone know what happens here or how it can be avoided ? Thanks in advance. Klaus Dittrich Hello all, I just startet using DBD::Sybase (after experimenting with DBD::Oracle and DBD::ODBC), and I found some effects I don't know how to handle. 1. Is it possible to avoid the additional Blank after each column I select (it does not appear always, but in most cases)? I know it can be avoided in isql, but how is it done in DBD:: Sybase (without losing the blanks I need for a fixed format output, i.e. ChopBlanks does not help) ? 2. In some obscure cases, all Blanks are chopped when I add an Order-By-Clause to an Select, though I explicitely cast the columns to a fixed length. Without Order-By the Blanks are not chopped and I get a Fixed-Length-Output. Can this behaviour be changed (or can someone explain it to me)? I'm using Perl 5.005_03 and DBD::Sybase 0.22. Thanks in advance. Klaus Dittrich Mannesmann Mobilfunk GmbH Duesseldorf, Germany [EMAIL PROTECTED] Der clevere Infobote - Shopping-Tipps bequem abonniert. Jetzt neu bei http://www.epost.de
DBD::Pg make error
hi after having some problems with 'perl Makefile' it ran succesfully with a warning Not (probably harmless): No library found for -lpq Writing Makefile for DBD::Pg then when i did make it gives me the following error make .. .. .. /usr/include/stdio.h:164: warning: `BUFSIZ' redifined Pg.h:34: Warning: this is the location of the previous definition * Error code 1 Stop in /usr/local/pgsql/DBD-Pg-1.00. regards imran -- insanity is just an overflow of imagination
Re: HELP, HELP, HELP
Date sent: Mon, 18 Jun 2001 20:46:37 -0500 From: Aguztyn Garcia-Cruz [EMAIL PROTECTED] Organization: Internet Cancun To: [EMAIL PROTECTED] Subject:HELP, HELP, HELP Aguztyn, What am I doing WRONG I do not know exactly, because I don't use DBD::Pg, but below you call the finish() method on the database handle $dbh, which is wrong for sure. In addition, I have written a tidied verison of your script, so error catching could be easier (see below) #!/usr/bin/perl -w # # Consilta.cgi # push(@INC,/var/www/cgi-bin/); require(cgi-lib.pl); $|=1; #use strict; use DBI; use CGI; sub avisa_y_salte { my $error = @_; print PrintHeader; print h1Error Inesperado/h1; print p$error/p; print HtmlBot; die $DBI::errstr; } my $version=V.20.01; my $registro=CENTERH5IConsulta Ciudadana $version 2001. A HREF=\mailto:aoriza\@cancun.gob.mx\;Hayuntamiento Benito Juarez./A/I/H5/CENTER; if (ReadParse) { my $query = new CGI; my $dat_nombre = $query-param('dat_nombre'); my $dat_apater = $query-param('dat_apater'); my $dat_amater = $query-param('dat_amater'); my $dat_calle = $query-param('dat_calle'); my $dat_sm = $query-param('dat_sm'); my $dat_mz = $query-param('dat_mz'); my $dat_lt = $query-param('dat_lt'); my $dat_edif = $query-param('dat_edif'); my $dat_nomint = $query-param('dat_nomint'); my $dat_nomext = $query-param('dat_nomext'); my $dat_colo = $query-param('dat_colo'); my $dat_cp = $query-param('dat_cp'); my $dat_mpio = $query-param('dat_mpio'); my $dat_ciudad = $query-param('dat_ciud'); my $dat_edo = $query-param('dat_edo'); my $dat_pais = $query-param('dat_pais'); my $dat_tel = $query-param('dat_tel'); my $dat_fax = $query-param('dat_fax'); my $dat_email = $query-param('dat_email'); my $dat_edad = $query-param('dat_edad'); my $dat_sexo = $query-param('dat_sexo'); #$dat_nombre = $in{'dat_nombre'}; #$dat_apater = $in{'dat_apater'}; #$dat_amater = $in{'dat_amater'}; #$dat_calle = $in{'dat_calle'}; #$dat_sm = $in{'dat_sm'}; #$dat_mz = $in{'dat_mz'}; #$dat_lt = $in{'dat_lt'}; #$dat_edif = $in{'dat_edif'}; #$dat_nomint = $in{'dat_nomint'}; #$dat_nomext = $in{'dat_nomext'}; #$dat_colo = $in{'dat_colo'}; #$dat_cp = $in{'dat_cp'}; #$dat_mpio = $in{'dat_mpio'}; #$dat_ciudad = $in{'dat_ciud'}; #$dat_edo = $in{'dat_edo'}; #$dat_pais = $in{'dat_pais'}; #$dat_tel = $in{'dat_tel'}; #$dat_fax = $in{'dat_fax'}; #$dat_email = $in{'dat_email'}; #$dat_edad = $in{'dat_edad'}; #$dat_sexo = $in{'dat_sexo'}; if ($dat_nombre eq '') { print PrintHeader; print html\n; print META HTTP-EQUIV=\Refresh\ CONTENT=\0;URL=http://agustin.cancun.com.mx/HABJ/f_servicio.htm\;\n; print /html\n; } # Parámetros para abrir la base de datos my $dbmain = 'habj'; my $dbuser = 'x'; my $dbpass = 'xx'; my $data_source = 'DBI:Pg:dbname=$dbmain'; my ($dbh, $sql, $cursor, $resultado); # Nos conectamos a la base de datos $dbh = DBI-connect(DBI:Pg:dbname=$dbmain,$dbuser,$dbpass) || avisa_y_salte(No puedo Abrir la Base de Datos); # Sentencia SQL para hacer la consulta. $sql = qq|INSERT INTO general (nombre, apaterno, amaterno, calle, sm, mz, lte, edif, noint, noext, col, cp, mpio, city, edo, pais, phone, fax, email, edad, sex) VALUES ('$dat_nombre', '$dat_apater', '$dat_amater', '$dat_calle', '$dat_sm', '$dat_mz', '$dat_lt', '$dat_edif', '$dat_nomint', '$dat_nomext', '$dat_colo', '$dat_cp', '$dat_mpio', '$dat_ciudad', '$dat_edo', '$dat_pais', '$dat_tel', '$dat_fax', '$dat_email', '$dat_edad')|; # Hacemos la consulta, en $resultado vienen todos los datos que nos interesan $cursor = $dbh-prepare($sql) || avisa_y_salte(No puedo Preparar el Comando para Grabar); $resultado = $cursor-execute || avisa_y_salte(No puedo executar el Comando Para Grabar); $dbh-finish; $dbh-disconnect; print PrintHeader; print html\n; print META HTTP-EQUIV=\Refresh\ CONTENT=\0;URL=http://agustin.cancun.com.mx/HABJ/f_servicio.htm\;\n; print /html\n; } else { print PrintHeader; print html\n; print META HTTP-EQUIV=\Refresh\ CONTENT=\0;URL=http://agustin.cancun.com.mx/HABJ/f_servicio.htm\;\n; print /html\n; print HtmlBot; } ERROR on error_log Use of uninitialized value in subroutine entry at /usr/lib/perl5/site_perl/5.6.0/i386-linux/DBD/Pg.pm line 94. Use of uninitialized value in subroutine entry at /usr/lib/perl5/site_perl/5.6.0/i386-linux/DBD/Pg.pm line 94. DBD::Pg::st execute failed: ERROR: general: Permission denied. at /var/www/html/HABJ/consulta.cgi line 100. ERROR: general: Permission denied. at /var/www/html/HABJ/consulta.cgi line 22. Database handle
Problem While Installing DBI module
WE are having a problem in the installation of DBI module DBI-1.18 ON : detail of platform sun solaris 2.8 version. the error that is coming is that the module is unable to search perl.o pl. let us know weather the perl.o is part of default installation or weather we have to download it separately the details are as under : THIS IS HOW THE LISTING FOR THE INSTALLATION WAS IN THE README : perl Makefile.PL make make test make install I MADE THE MAKEFILE : $ perl Makefile.PL *** Note: The optional PlRPC-modules (RPC::PlServer etc) are not installed. If you want to use the DBD::Proxy driver and DBI::ProxyServer modules, then you'll need to install the RPC::PlServer, RPC::PlClient, Storable and Net::Daemon modules. The CPAN Bundle::DBI may help you. You can install them any time after installing the DBI. You do *not* need these modules for typical DBI usage. Optional modules are available from any CPAN mirror, in particular http://www.perl.com/CPAN/modules/by-module http://www.perl.org/CPAN/modules/by-module ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module Checking if your kit is complete... Looks good Writing Makefile for DBI Remember to actually *read* the README file! Use 'make' to build the software (dmake or nmake on Windows). Then 'make test' to execute self tests. Then 'make install' to install the DBI and then delete this working directory before unpacking and building any DBD::* drivers. THEN THE MAKE COMMAND RESULTED IN AN ERROR: $ /usr/ccs/bin/make cc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC -I /usr /perl5/5.00503/sun4-solaris/CORE -DDBI_NO_THREADS Perl.c /usr/ucb/cc: language optional software package not installed *** Error code 1 make: Fatal error: Command failed for target `Perl.o'
Re: HELP, HELP, HELP
From: Bodo Eing [EMAIL PROTECTED] To: [EMAIL PROTECTED], Aguztyn Garcia-Cruz [EMAIL PROTECTED] Date sent: Tue, 19 Jun 2001 12:31:42 +0200 Subject:Re: HELP, HELP, HELP Priority: normal Aguztyn, What am I doing WRONG I do not know exactly, because I don't use DBD::Pg, but below you call the finish() method on the database handle $dbh, which is wrong for sure. In addition, I have written a tidied verison of your script, so error catching could be easier (see below) found a typo in this version, sorry ...snip... perl_code #!/usr/bin/perl use warnings; use strict; use vars; use DBI; use CGI; # the next line will redirect (most) errors from the server's log to the browser use CGI::Carp qw(fatalsToBrowser); |$ = 1; ^^ this should read $| = 1; of course. ... snip ... Bodo [EMAIL PROTECTED] Dr. med. Bodo Eing Institut fuer Medizinische Mikrobiologie Klinische Virologie v.-Stauffenbergstr. 36 48151 Muenster Germany Phone: ++49 251 7793 111 Fax: ++49 251 7793-104
Re: Problem While Installing DBI module
The problem is exactly what it says: language optional software package not installed . You appear to be using a pre-built perl binary that was created using /usr/ucb/cc which you have not installed in this host. You need to either install the optional C compiler or install gcc and build perl yourself. I generally prefer the second option because then I _know_ everything needed on the Perl side is present when I build modules. -- Mac :}) ** I normally forward private database questions to the DBI mail lists. ** Give a hobbit a fish and he'll eat fish for a day. Give a hobbit a ring and he'll eat fish for an age. - Original Message - From: Monika Sharma [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 20, 2001 04:13 Subject: Problem While Installing DBI module WE are having a problem in the installation of DBI module DBI-1.18 ON : detail of platform sun solaris 2.8 version. the error that is coming is that the module is unable to search perl.o pl. let us know weather the perl.o is part of default installation or weather we have to download it separately the details are as under : THIS IS HOW THE LISTING FOR THE INSTALLATION WAS IN THE README : perl Makefile.PL make make test make install I MADE THE MAKEFILE : $ perl Makefile.PL *** Note: The optional PlRPC-modules (RPC::PlServer etc) are not installed. If you want to use the DBD::Proxy driver and DBI::ProxyServer modules, then you'll need to install the RPC::PlServer, RPC::PlClient, Storable and Net::Daemon modules. The CPAN Bundle::DBI may help you. You can install them any time after installing the DBI. You do *not* need these modules for typical DBI usage. Optional modules are available from any CPAN mirror, in particular http://www.perl.com/CPAN/modules/by-module http://www.perl.org/CPAN/modules/by-module ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module Checking if your kit is complete... Looks good Writing Makefile for DBI Remember to actually *read* the README file! Use 'make' to build the software (dmake or nmake on Windows). Then 'make test' to execute self tests. Then 'make install' to install the DBI and then delete this working directory before unpacking and building any DBD::* drivers. THEN THE MAKE COMMAND RESULTED IN AN ERROR: $ /usr/ccs/bin/make cc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC -I /usr /perl5/5.00503/sun4-solaris/CORE -DDBI_NO_THREADS Perl.c /usr/ucb/cc: language optional software package not installed *** Error code 1 make: Fatal error: Command failed for target `Perl.o'
Re: make failure on HP-UX 11
Hello. Someone asked me about installing oracle module on hp-ux. They said always failed in install. So I let they know how to compile in my experience. But it was same thing. I tried to fix makefile file and write a documentation about this problems. but anything coudn't help them. I know this problem caused by oracle but hope you don't look on this. Thank you for your modules, Tim. Best Regards. - Original Message - From: Tim Bunce [EMAIL PROTECTED] To: Llewellyn Jim [EMAIL PROTECTED] Cc: 'PD Miller' [EMAIL PROTECTED]; 'Tim Bunce' [EMAIL PROTECTED]; [EMAIL PROTECTED]; 'Baxter, Lincoln' [EMAIL PROTECTED] Sent: Friday, June 01, 2001 1:09 AM Subject: Re: make failure on HP-UX 11 On Thu, May 31, 2001 at 03:49:33PM +0100, Llewellyn Jim wrote: I was able to figure out more about what was going on there by running it through the preprocessor only, and examining the output. Thanks. I didn't have the energy to try to explain how to do that and was kind'a hoping someone would do it for me :) This is the line in question in the original: DBIc_THR_USER(imp) = DBIc_THR_USER_NONE; and this is what it becomes after preprocessing: (( imp )-com. std.thr_user ) = ( 4294967295u l ) ; I assume the intent was for that to be an unsigned long constant. What's the space doing between them though? OK, U32_MAX is being turned into that mess. Perl's handy.h turns U32_MAX into UINT32_MAX. I go and search for that, and find this in perl.h: #ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */ #define UV_MAX UINT32_MAX #else #define UV_MAX 4294967295U #endif Obviously Larry Wall knows something about UINT32_MAX being broken in HP-UX with gcc :-) It seems that the Perl makefile sets -DUINT32_MAX_BROKEN in the Perl cppflags. Therefore, may I suggest changing the definition of DBIc_THR_USER_NONE to something like this: #ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */ # define DBIc_THR_USER_NONE(U32_MAX) #else # define DBIc_THR_USER_NONE4294967295U #endif With that, DBI compiles perfectly (well, except for some unused variable warnings from gcc).. Actually I've already changed it to #define DBIc_THR_USER_NONE (0x) :) Tim.
Re: install_driver(Oracle) error when CGI pgm called by Webserver
Hi, The problem was solved. All I had to do is to set the LD_RUN_PATH variable in the Makefile to {my oracle_home}/lib and then continue with make, test and install of DBD. But after this problem, I ran into another :-) ...I got the following error: Software error: Couldnt connect to database: Error while trying to retrieve text for error ORA-12571 (DBD ERROR: OCISessionBegin) at /export/home/ajay/apache/cgi-bin/order.cgi line 33. The only error I got during make test was - t/general...DBD::Oracle::db do failed: ORA-00900: invalid SQL statement (DBD ERROR: OCIStmtExecute) at t/general.t line 68. Do I need to change any of the NLS parameters? Help required Thanks in advance, Ajay Ajay Madan wrote: Carl, I set the LD and restarted my webserver(in the same shell). I then called this cgi from the webserver and it threw up the same error message that it couldnt find libclntsh.so.1.0 file. Well, there is another doubt(may be a vague one, still just thinking aloud!). After testing and installing DBD and DBI, is it necessary to build PERL again? I am really not able to figure out why I am still getting this error? Thanks, Ajay Carl Hansen wrote: try adding the Oracle library directories to the envirnmental variable LD_LIBRARY_PATH ( on Solaris ) and make sure the shell that starts the webserver has it. an example LD_LIBRARY_PATH: LD_LIBRARY_PATH=/export/home/adabas/lib:/usr/openwin/lib:/usr/5lib:/usr/lib:/opt/sfw/lib:/usr/local/lib:/usr/local/mysql/lib:/usr/ucblib On Mon, Jun 11, 2001 at 07:05:40AM +0200, Hamilton, Andrew Mr RAYTHEON 5 SIG CMD wrote: This isn't possible on solaris. There isn't an ld.so.conf. I recall having the same problem a couple of years ago but can't for the life of me remember how I solved it. Ajay, I'm still trying to come up with a solution for you. Drew -Original Message- From: Ronald J Kimball [mailto:[EMAIL PROTECTED]] Sent: Friday, June 08, 2001 3:38 PM To: Ajay Madan Cc: Michael A. Chase; Booth, Tim; DBI Mailing List Subject: Re: install_driver(Oracle) error when CGI pgm called by Webserver On Fri, Jun 08, 2001 at 05:33:22PM +0530, Ajay Madan wrote: Hi Michael Drew, I tried putting within the BEGIN block without any success, as Michael has indicated. Actually, I am not clear what you exactly mean when you say use a shell wrapper. How can another script be called before the cgi, since the cgi itself is mentioned in the HTML Form code. Thanks in advance for the help, The solution I prefer is to add the path to /etc/ld.so.conf and then run ldconfig. This makes the Oracle libraries available to all processes. Ronald -- Carl Hansen Pictopia.com, Inc. [EMAIL PROTECTED] 510 658 6587 x 117
Re: Problem While Installing DBI module
Then unless you can get pre-built copies of DBI and the necessary DBD modules from the same source you got Perl from, you won't be able to use DBI. __Someone__ has to use a C compiler to build DBI and most of the DBD modules. I am not your private consultant. Please reply to the dbi-users list. -- Mac :}) ** I normally forward private database questions to the DBI mail lists. ** Give a hobbit a fish and he'll eat fish for a day. Give a hobbit a ring and he'll eat fish for an age. - Original Message - From: Monika Sharma [EMAIL PROTECTED] To: Michael A. Chase [EMAIL PROTECTED] Sent: Wednesday, June 20, 2001 04:36 Subject: Re: Problem While Installing DBI module thanks, but we don't wan't to install the additional (optional) packages. neither do we want to change the default perl binary (our PL will not agree to it), could you please suggest any DBI module, that will work with the default installation. - Original Message - From: Michael A. Chase [EMAIL PROTECTED] To: Monika Sharma [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 19, 2001 4:21 PM Subject: Re: Problem While Installing DBI module The problem is exactly what it says: language optional software package not installed . You appear to be using a pre-built perl binary that was created using /usr/ucb/cc which you have not installed in this host. You need to either install the optional C compiler or install gcc and build perl yourself. I generally prefer the second option because then I _know_ everything needed on the Perl side is present when I build modules. -- Mac :}) ** I normally forward private database questions to the DBI mail lists. ** Give a hobbit a fish and he'll eat fish for a day. Give a hobbit a ring and he'll eat fish for an age. - Original Message - From: Monika Sharma [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 20, 2001 04:13 Subject: Problem While Installing DBI module WE are having a problem in the installation of DBI module DBI-1.18 ON : detail of platform sun solaris 2.8 version. the error that is coming is that the module is unable to search perl.o pl. let us know weather the perl.o is part of default installation or weather we have to download it separately the details are as under : THIS IS HOW THE LISTING FOR THE INSTALLATION WAS IN THE README : perl Makefile.PL make make test make install I MADE THE MAKEFILE : $ perl Makefile.PL *** Note: The optional PlRPC-modules (RPC::PlServer etc) are not installed. If you want to use the DBD::Proxy driver and DBI::ProxyServer modules, then you'll need to install the RPC::PlServer, RPC::PlClient, Storable and Net::Daemon modules. The CPAN Bundle::DBI may help you. You can install them any time after installing the DBI. You do *not* need these modules for typical DBI usage. Optional modules are available from any CPAN mirror, in particular http://www.perl.com/CPAN/modules/by-module http://www.perl.org/CPAN/modules/by-module ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module Checking if your kit is complete... Looks good Writing Makefile for DBI Remember to actually *read* the README file! Use 'make' to build the software (dmake or nmake on Windows). Then 'make test' to execute self tests. Then 'make install' to install the DBI and then delete this working directory before unpacking and building any DBD::* drivers. THEN THE MAKE COMMAND RESULTED IN AN ERROR: $ /usr/ccs/bin/make cc -c -xO3 -xdepend -DVERSION=\1.18\ -DXS_VERSION=\1.18\ -KPIC -I /usr /perl5/5.00503/sun4-solaris/CORE -DDBI_NO_THREADS Perl.c /usr/ucb/cc: language optional software package not installed *** Error code 1 make: Fatal error: Command failed for target `Perl.o'
Re: install_driver(Oracle) error when CGI pgm called by Webserver
You probably need to set ORACLE_HOME in the environment of the process that runs the webserver. -- Mac :}) ** I normally forward private database questions to the DBI mail lists. ** Give a hobbit a fish and he'll eat fish for a day. Give a hobbit a ring and he'll eat fish for an age. - Original Message - From: Ajay Madan [EMAIL PROTECTED] To: DBI Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: Carl Hansen [EMAIL PROTECTED] Sent: Tuesday, June 19, 2001 05:38 Subject: Re: install_driver(Oracle) error when CGI pgm called by Webserver The problem was solved. All I had to do is to set the LD_RUN_PATH variable in the Makefile to {my oracle_home}/lib and then continue with make, test and install of DBD. But after this problem, I ran into another :-) ...I got the following error: Software error: Couldnt connect to database: Error while trying to retrieve text for error ORA-12571 (DBD ERROR: OCISessionBegin) at /export/home/ajay/apache/cgi-bin/order.cgi line 33. The only error I got during make test was - t/general...DBD::Oracle::db do failed: ORA-00900: invalid SQL statement (DBD ERROR: OCIStmtExecute) at t/general.t line 68. Do I need to change any of the NLS parameters? Help required I set the LD and restarted my webserver(in the same shell). I then called this cgi from the webserver and it threw up the same error message that it couldnt find libclntsh.so.1.0 file. Well, there is another doubt(may be a vague one, still just thinking aloud!). After testing and installing DBD and DBI, is it necessary to build PERL again? I am really not able to figure out why I am still getting this error? Carl Hansen wrote: try adding the Oracle library directories to the envirnmental variable LD_LIBRARY_PATH ( on Solaris ) and make sure the shell that starts the webserver has it. an example LD_LIBRARY_PATH: LD_LIBRARY_PATH=/export/home/adabas/lib:/usr/openwin/lib:/usr/5lib:/usr/lib: /opt/sfw/lib:/usr/local/lib:/usr/local/mysql/lib:/usr/ucblib On Mon, Jun 11, 2001 at 07:05:40AM +0200, Hamilton, Andrew Mr RAYTHEON 5 SIG CMD wrote: This isn't possible on solaris. There isn't an ld.so.conf. I recall having the same problem a couple of years ago but can't for the life of me remember how I solved it. Ajay, I'm still trying to come up with a solution for you. Drew -Original Message- From: Ronald J Kimball [mailto:[EMAIL PROTECTED]] Sent: Friday, June 08, 2001 3:38 PM To: Ajay Madan Cc: Michael A. Chase; Booth, Tim; DBI Mailing List Subject: Re: install_driver(Oracle) error when CGI pgm called by Webserver On Fri, Jun 08, 2001 at 05:33:22PM +0530, Ajay Madan wrote: Hi Michael Drew, I tried putting within the BEGIN block without any success, as Michael has indicated. Actually, I am not clear what you exactly mean when you say use a shell wrapper. How can another script be called before the cgi, since the cgi itself is mentioned in the HTML Form code. Thanks in advance for the help, The solution I prefer is to add the path to /etc/ld.so.conf and then run ldconfig. This makes the Oracle libraries available to all processes. Ronald -- Carl Hansen Pictopia.com, Inc. [EMAIL PROTECTED] 510 658 6587 x 117
Re: DBD-ADO and NULLs
I realized after posting that my error message and sample code are inconsistent - the procedure is indeed called Step_Two and I AM passing in the correct number of parameters. However, when I pass in NULL (undef in Perl) for at least one of the parameters, the error message below results. What am I doing wrong? - Original Message - From: Garrison G. Lutz To: [EMAIL PROTECTED] Sent: Monday, June 18, 2001 11:56 AM Subject: DBD-ADO and NULLs Hello all, I am using DBD-ADO (latest version) and DBI 1.14. I am trying to call an MS-SQL Server stored procedure using placeholders this way: if (condition) { $hash{'param'} = 'text'; } else { $hash{'param'} = undef; } @placeholders = ($hash{'param'}); $sth = $dbh-prepare('{call proc(?)}'); $sth-execute(@placeholders); This error is returned: DBD::ADO::st execute failed: Can't execute statement '{call Step_Two(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}': Lasterror: -2146824580: OLE exception from ADODB.Command: Parameter object is improperly defined. Inconsistent or incomplete information was provided. Win32::OLE(0.1501) error 0x800a0e7c in METHOD/PROPERTYGET Execute The procedure updates a table and needs to update it with NULL values if the condition in the first line of code is not met. What am I doing wrong? Thanks!
DBD CSV Distinct clause not working
The distinct clause in an SQL query does not work in some cases. For example if I had a table/file Test with one column say name name sanjiv 400-522 400-523 blah the query 'select distinct name from Test' returns only sanjiv 400-522 blah For some reason it treats 400-522 and 400-523 as the same. Would appreciate any suggestions/workarounds. Thanks, Sanjiv __ Do You Yahoo!? Spot the hottest trends in music, movies, and more. http://buzz.yahoo.com/
Oracle and nulls
Hi, I am trying to insert a record into an oracle database, and i need to insert leave some of the fields null, but other time's I may need to insert data into those fields within the same script. Does anyone have any ideas how I might achieve the null business? thanks very much Edd Dawson -- Edd Dawson Senior Analyst Programmer University of Derby +44 0(1332) 591239 [EMAIL PROTECTED] --
RE: Oracle and nulls
DBD::Oracle inserts null if the value of the bind parameter is undef. Therefore if you have a scalar which is undef it will insert as null, other time when it has a value it will insert the actual value. You must use placeholders though. See docs. Ilya -Original Message- From: Edd Dawson To: [EMAIL PROTECTED] Sent: 06/19/2001 9:32 AM Subject: Oracle and nulls Hi, I am trying to insert a record into an oracle database, and i need to insert leave some of the fields null, but other time's I may need to insert data into those fields within the same script. Does anyone have any ideas how I might achieve the null business? thanks very much Edd Dawson -- Edd Dawson Senior Analyst Programmer University of Derby +44 0(1332) 591239 [EMAIL PROTECTED] --
Re: DBD CSV Distinct clause not working
Sanjiv Jivan wrote: The distinct clause in an SQL query does not work in some cases. ... For some reason it treats 400-522 and 400-523 as the same. Are you running with warnings (-w)? If not, you should be. If so, you will probably see something like this warning: Argument 400-522 isn't numeric in numeric comparison (=) at C:/usr/local/site/lib/SQL/Statement.pm line 289, GEN1 line 5. This is a problem in SQL::Statement's definition of numbers. The following patch fixes it. Make these changes at line 283 of SQL::Statement: ### JZ MOD # } elsif ($c =~ /^\s*[+-]?\s*\.?\s*\d/ #$d =~ /^\s*[+-]?\s*\.?\s*\d/ ) { } elsif ($c =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ $d =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { ### -- Jeff
DBD install
Hi, I'm trying to install DBD 1.00 PC1 on my system and I'm stuck, any help would be appreciated. OS: Sun Solaris 5.6 sparc Perl: v5.6.1 built for sun4-solaris I've installed Informix server 7.3.1 + sql 7.30 + esql 5.10 + DBI 5.1 I've tried to set variables to demo table stores7 as well When I run as root # perl Makefile I get: __ Perl: perl5.006001 sun4-solaris dl_dlopen.xs System: sunos 5.6 generic_105181-11 sun4m sparc sunw,sparcstation-5 Compiler: cc -O -I/usr/local/include -I/opt/gnu/include -D_LARGEFILE_SOURCE -D_F ILE_OFFSET_BITS=64 Using INFORMIX-ESQL Version 5.10.UD1 from /database/informix You need to use a customized ESQL/C compiler script which recognizes the INFORMIXC environment variable. I'll create a local version and ensure that we use it. You may run into problems creating a shared object version of DBD::Informix. If so, try creating a statically linked version instead. Read the Notes/static.build file. Assert macro will be disabled! Testing whether your Informix test environment will work... ESQLTEST Program Running: @(#)$Id: esqltest.ec version /main/20 2000-02-08 16:57:02 $ $DBI_DBNAME set to 'testdb'. $DBD_INFORMIX_DATABASE set to 'testdb@test_rmt'. $DBD_INFORMIX_DATABASE2 unset - defaulting to 'testdb@test_rmt'. $DBD_INFORMIX_USERNAME is set to 'informix'. $DBD_INFORMIX_USERNAME2 is unset - defaulting to 'informix'. $DBD_INFORMIX_PASSWORD is set. $DBD_INFORMIX_PASSWORD2 is unset - defaulting to $DBD_INFORMIX_PASSWORD. Testing connection to testdb@test_rmt DBD_INFORMIX_USERNAME DBD_INFORMIX_PASSWORD are ignored. DATABASE testdb@test_rmt SQL: -409: Sqlexec was not found or was not executable by the current user. Testing connection to testdb@test_rmt DATABASE testdb@test_rmt SQL: -409: Sqlexec was not found or was not executable by the current user. *** Your Informix environment is not usable *** You must fix it before building or testing DBD::Informix ___ Thanks, Marcelo
Re: DBD CSV Distinct clause not working
Mitch Helle-Morrissey wrote: Maybe you are having some problems with string vs. numeric operations. Yes. That's the problem. I'm haven't ever used DBD::CSV, but maybe there is a quote() operator that you can use, and send in the correct datatype? This module (and DBD::AnyData also) allows one to enter datatypes but then ignores them. The fix is the patch to SQL::Statement I sent in my previous note. -- Jeff
RE: works in sqlplus but not through script
Thanx for the tips. I will definitely incorporate them. Something else must have been gobbling up the database, 'cuz I finally got the query to run. The bad news was that it took about 22 minutes, so now I get to figure out why. Thanx, everybody, for the help. ltg -Original Message- From: Tony Foiani [mailto:[EMAIL PROTECTED]] Sent: Monday, June 18, 2001 4:01 PM To: Laurie Gennari Cc: Dbi-Users (E-mail) Subject: Re: works in sqlplus but not through script Laurie == Laurie Gennari [EMAIL PROTECTED] writes: Laurie I'm sure I must be missing something obvious (it's been one of Laurie those weeks), but I can't for the life of me figure out why Laurie this doesn't work. It just hangs and never finishes. Any help Laurie would be much appreciated. As someone else already pointed out, an indication of what is going wrong would help us a lot. In particular, do any of your die conditions trigger? And, if so, what is the error? Offhand: Laurie #!/usr/local/bin/perl Consider adding -w to the invocation line above, and use strict. perldoc strict for more info. Laurie use DBI; Laurie $ENV{ORACLE_HOME} = '/opt/oracle/product/8.1.6'; Laurie $ENV{ORACLE_SID} = 'dev1'; Laurie $dbh = DBI-connect(DBI:Oracle:tamarac_dev1,sys,password, { LauriePrintError = 1} ) Laurie|| die Can't connect , $dbh-errstr(); This looks distinctly odd. I'd have to consult the precedence tables, but a more idiomatic way of writing this might be: $dbh = DBI-connect(...) or die Can't connect: . $dbh-errstr(); Note that this uses the ultra-low-precedence or operator, as well as using concatenation (instead of a comma, which confuses me a little. 'die' does accept a LIST, but I'd probably elect to use parens in that case) Anyway, if you're just going to die anyway, you might as well just set RaiseError in the connect and be done with it. (Admittedly, this is probably just a small snippit of your code, but ...) Even in a larger program, using RaiseError is handy; wrap the important bits inside an eval { ... }, and then either commit or rollback depending on whether you got to the end gracefully or not. Laurie $sql = SELECT vs.username, vs.serial#, vl.id1, vst.sql_text Laurie FROM v\$session vs, v\$lock vl, v\$sqltext vst Laurie WHERE vs.lockwait = vl.kaddr Laurie AND vst.address = vs.sql_address Laurie AND vst.hash_value = vs.sql_hash_value; Consider using single quotes when you don't have anything you're interpolating. For one this long, you should probably also use a here-doc (both of these are described in perldoc perlop). So, it might evolve into: $sql = 'SQL'; SELECT vs.username, vs.serial#, vl.id1, vst.sql_text FROM v$session vs, v$lock vl, v$sqltext vst WHERE vs.lockwait = vl.kaddr AND vst.address = vs.sql_address AND vst.hash_value = vs.sql_hash_value SQL This is purely a taste issue. perldoc perlstyle Laurie $sth = $dbh-prepare($sql) Laurie|| die Can't prepare statement , $sth-errstr(); Same comments about precedence apply here. Either use or, or parenthesize the assignment. Laurie $sth-execute() Laurie|| die Can't execute statement , $sth-errstr(); Laurie $sth-bind_columns(undef, \$username, \$serial, \$id1, \$sqltext); Laurie while ($sth-fetch) { Laurie print username: [$username]\n serial: [$serial]\n id1: [$id1]\n sqltext: Laurie [$sqltext]\n\n; Laurie } Laurie $dbh-disconnect; HTH, t.
Re: DBI Connect Failure
On Tue, Jun 19, 2001 at 07:09:40PM +0200, Christine Kluka wrote: Now the error that I get is: xxx.cgi did not produce a valid header (name without value:got line variable $i is not imported at xxx.cgi line 65.) I need to declare the subroutine row in which the error is found to do a fetchrow later in the script, and I can't see an error in the subroutine itself. Help! You've got use strict, but you forgot to declare the variable $i: sub row { $r = shift(@_); @r = @_; $nfields = $r-nfields; for ($i=0; $i$nfields; $i++) { $fname = $r-fname($i); $r{$fname} = $r[$i]; } return %r; } Ronald
mixed binding?
has anyone succeeded in submitting a query where placeholders would be mixed with data? like in INSERT INTO table_name ( foo, bar, john, doe) VALUES (?, 'blah', ?, ?) Thanks
Re: mixed binding?
Yes you can submit placeholders mixed with data ... - Original Message - From: Ilya Dyakov [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 19, 2001 1:24 PM Subject: mixed binding? has anyone succeeded in submitting a query where placeholders would be mixed with data? like in INSERT INTO table_name ( foo, bar, john, doe) VALUES (?, 'blah', ?, ?) Thanks
RE: mixed binding?
Yes, that looks good, but what's not working. You need to tell us the error and/or unexpected results before we can help you. But mixing placeholders with data is totally fine. Ilya -Original Message- From: Ilya Dyakov To: [EMAIL PROTECTED] Sent: 06/19/2001 2:24 PM Subject: mixed binding? has anyone succeeded in submitting a query where placeholders would be mixed with data? like in INSERT INTO table_name ( foo, bar, john, doe) VALUES (?, 'blah', ?, ?) Thanks
ACK!! Has anybody solved the SEGMENTATION FAULT problem yet????????
Hi, I'm running the following: Oracle 8.1.7 for solaris7/intel Oracle 8.1.7 client for solaris7/intel DBI versions 1.15 1.18 DBD::Oracle versions 1.0.6 1.0.7 PERL 5.6.1 5.005_003 Seems a simple database connection attempt without executing any sql scripts ends up with a segmentation fault (core dump, if using root). When executing a simple simple sql select to any table, same thing happens after you get all the data. After perusing through the mailing list archives, seems i'm not alone in finding this NASTY NASTY error. Oracle support tells me that they have nothing to do with this error. I love to pay thousands of bucks for Oracle support to tell me this... Anyhow, thanks for any responses. VERY FRUSTRATED WITH ORACLE, SO WHY NOT USE MYSQL :)
Calling OCIPasswordChange using Perl
Has anyone figured out how to call OCIPasswordChange from Perl (with or without DBI)? The reason I'm asking that Oracle is saying that OCIPasswordChange function should be used instead of 'alter user..' to accomplish password changes. I'm hoping someone has figured out how to do this using Perl. I saw the following archive item where Tim Bunce talks about a possible approach to incorporate this functionality into DBI but I don't know if anyone ever implemented this or came up with an alternate solution. http://www.perl.jann.com/dbi-users/29/msg00157.html TIA, Gerardo
Re: ACK!! Has anybody solved the SEGMENTATION FAULT problem yet????????
Tai wrote: Hi, I'm running the following: Oracle 8.1.7 for solaris7/intel Oracle 8.1.7 client for solaris7/intel DBI versions 1.15 1.18 DBD::Oracle versions 1.0.6 1.0.7 PERL 5.6.1 5.005_003 Add Oracle 8.1.6 client, solaris 2.6, perl 5.004_04, DBI 1.18, DBD::Oracle 1.06 to the mix. VERY FRUSTRATED WITH ORACLE, SO WHY NOT USE MYSQL :) 'cause we've paid too damn much money for it and have too damn much data already in to just chuck it. Sigh. -- Matthew O. Persico http://www.acecape.com/dsl AceDSL:The best ADSL in Verizon area
Connecting to MySQL
Hi, I'm trying to connect MySQL using the following code: #!/usr/bin/perl -w use CGI qw(:standard); use DBI(); print header; print start_html(mysql); print h1(Lista de Medicamentos/Cosméticos); $dbh = DBI-connect(DBI:mysql:fol,fol,passfrr27); $sth = $dbh-prepare(SELECT CODE,DESCRIPTION FROM PRODUCT LIMIT 0, 30); $sth-execute or die Error: .$sth-errstr(); print p(=); print p(Number of records: $sth-rows); while(($cod,$desc) = $sth-fetchrow_array) { print $cod - $desc\n; } $dbh-disconnect; print end_html; PLEASE!! What am I doing wrong??? TIA, Juan.
RE: Connecting to MySQL
Juan, I don't see location or port # in your connection string. Here is an example of connecting to MySQL using default MySQL settings for port, and with the MySQL daemon (service) running on the local machine. You don't have to format it the same way, but you have to get all the elements into your connection string: use DBI; my $database_name = 'intra_data'; my $location = 'localhost'; my $port_num = '3306'; # This is default for mysql # define the location of the sql server. my $database = DBI:mysql:$database_name:$location:$port_num; my $db_user = sa; my $db_password = pass; # connect to the sql server. my $dbh = DBI-connect($database,$db_user,$db_password); The $location and $port_num on the line defining $database are what you seem to be missing. Hope this helps, Steve Howard -Original Message- From: Juan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 8:10 PM To: [EMAIL PROTECTED] Subject: Connecting to MySQL Hi, I'm trying to connect MySQL using the following code: #!/usr/bin/perl -w use CGI qw(:standard); use DBI(); print header; print start_html(mysql); print h1(Lista de Medicamentos/Cosméticos); $dbh = DBI-connect(DBI:mysql:fol,fol,passfrr27); $sth = $dbh-prepare(SELECT CODE,DESCRIPTION FROM PRODUCT LIMIT 0, 30); $sth-execute or die Error: .$sth-errstr(); print p(=); print p(Number of records: $sth-rows); while(($cod,$desc) = $sth-fetchrow_array) { print $cod - $desc\n; } $dbh-disconnect; print end_html; PLEASE!! What am I doing wrong??? TIA, Juan.
RE: Connecting to MySQL
Port number isn't required unless you are running your mysqld client on other port than default. what is happening when you execute the script? have you tried connect(...) || die Cannot connectect to the database $DBI::errstr\n; ? Anton -Original Message- From: Steve Howard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 6:28 PM To: Juan; [EMAIL PROTECTED] Subject: RE: Connecting to MySQL Juan, I don't see location or port # in your connection string. Here is an example of connecting to MySQL using default MySQL settings for port, and with the MySQL daemon (service) running on the local machine. You don't have to format it the same way, but you have to get all the elements into your connection string: use DBI; my $database_name = 'intra_data'; my $location = 'localhost'; my $port_num = '3306'; # This is default for mysql # define the location of the sql server. my $database = DBI:mysql:$database_name:$location:$port_num; my $db_user = sa; my $db_password = pass; # connect to the sql server. my $dbh = DBI-connect($database,$db_user,$db_password); The $location and $port_num on the line defining $database are what you seem to be missing. Hope this helps, Steve Howard -Original Message- From: Juan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 8:10 PM To: [EMAIL PROTECTED] Subject: Connecting to MySQL Hi, I'm trying to connect MySQL using the following code: #!/usr/bin/perl -w use CGI qw(:standard); use DBI(); print header; print start_html(mysql); print h1(Lista de Medicamentos/Cosméticos); $dbh = DBI-connect(DBI:mysql:fol,fol,passfrr27); $sth = $dbh-prepare(SELECT CODE,DESCRIPTION FROM PRODUCT LIMIT 0, 30); $sth-execute or die Error: .$sth-errstr(); print p(=); print p(Number of records: $sth-rows); while(($cod,$desc) = $sth-fetchrow_array) { print $cod - $desc\n; } $dbh-disconnect; print end_html; PLEASE!! What am I doing wrong??? TIA, Juan.
RE: Connecting to MySQL
Hi Anton, At 18:32 19/06/01 -0700, Kokarski, Anton wrote: Port number isn't required unless you are running your mysqld client on other port than default. what is happening when you execute the script? Just shows the title. have you tried connect(...) || die Cannot connectect to the database $DBI::errstr\n; ? I tried see the result: http://www.farmaceutico-online.com.br/cgi-local/mysqlt.cgi Is it possible that the server don't have DBI instaled? Thank you very much. Juan
Re: Connecting to MySQL
At 10:09 PM -0300 6/19/01, Juan wrote: Hi, I'm trying to connect MySQL using the following code: #!/usr/bin/perl -w use CGI qw(:standard); use DBI(); print header; print start_html(mysql); print h1(Lista de Medicamentos/Cosméticos); $dbh = DBI-connect(DBI:mysql:fol,fol,passfrr27); $sth = $dbh-prepare(SELECT CODE,DESCRIPTION FROM PRODUCT LIMIT 0, 30); $sth-execute or die Error: .$sth-errstr(); print p(=); print p(Number of records: $sth-rows); while(($cod,$desc) = $sth-fetchrow_array) { print $cod - $desc\n; } $dbh-disconnect; print end_html; PLEASE!! What am I doing wrong??? Is this a request, or a quiz? You don't perform any error-checking on your connect() call, for one thing, so you don't know if (or why) it fails. That's your first step: $dbh = DBI-connect ( ) or die Connect failed: $DBI::errstr\n; TIA, Juan. -- Paul DuBois, [EMAIL PROTECTED]
Re: Connecting to MySQL
Hi Paul, Is this a request, or a quiz? You don't perform any error-checking on your connect() call, for one thing, so you don't know if (or why) it fails. That's your first step: $dbh = DBI-connect ( ) or die Connect failed: $DBI::errstr\n; I added after send the first post, and I just get the title returned. Thanks. Juan.
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
Hi, I get the error when I try to connect.. :o(( What's wrong? TIA, Juan.
RE: Connecting to MySQL
Just a thought, if the defaults are not working and: 1. you've verified you are trying to connect to the right server, 2. you have network connectivity to the right server from the server where the scripts are running, 3. you have proper name resolution (since your script is trying to connect by name and not by IP address), 4. you have DBI, and DBD::MySQL all installed correctly, 5. you have checked to make sure your MySQL daemon is running, 6. have you run a netstat -a on the machine where the mysql daemon is running to be sure it is listening on the default port? There's not much more than that that can go wrong. If all of that is checked, and you are trying to connect on the port where MySQL is listening, you might be to the point of re-installing DBI, or DBD::MySQL...but check to be sure all those parts are in place before resorting to a re-install. Anyone know of anything I missed? Steve Howard -Original Message- From: Juan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 8:10 PM To: [EMAIL PROTECTED] Subject: Connecting to MySQL Hi, I'm trying to connect MySQL using the following code: #!/usr/bin/perl -w use CGI qw(:standard); use DBI(); print header; print start_html(mysql); print h1(Lista de Medicamentos/Cosméticos); $dbh = DBI-connect(DBI:mysql:fol,fol,passfrr27); $sth = $dbh-prepare(SELECT CODE,DESCRIPTION FROM PRODUCT LIMIT 0, 30); $sth-execute or die Error: .$sth-errstr(); print p(=); print p(Number of records: $sth-rows); while(($cod,$desc) = $sth-fetchrow_array) { print $cod - $desc\n; } $dbh-disconnect; print end_html; PLEASE!! What am I doing wrong??? TIA, Juan.