Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





MySQL, Perl CGI


I'm developing a simple computer helpdesk system with MySQL as the
backend and Apache/CGI/Perl as the user interface. I've sucessfully
set up the part where a user enters an issue via HTML form and
"submits" it to the MySQL database. My question is: I have it set up
where the user posts the issue to the database, the database
auto_increments an issue_id number field. How do I return that
issue_id number back to Apache so that the user can see it (and use it
as a reference number)?




View Complete Forum Thread with Replies

Related Forum Messages:
Perl-DBD-MySQL
I have a binary distribution of MySQL 4.0.20 installed in
/usr/local/mysql.
Therefore, the only libmysqlclient file I have is libmysqlclient.a
(static library).
And also, Perl:DBI already installed.

I'm trying to install perl-DBD-MySQL-2.9004 from source.
What should I add to 'perl Makefile.PL' as arguments to make sure it
finds the
static library?

I've tried 'perl Makefile.PL
--libs=/usr/local/mysql/lib/libmysqlclient.a and gotten
this:

---------------------------------

[root@localhost DBD-mysql-2.9004]# perl Makefile.PL
--libs=/usr/local/mysql/lib/lib/mysqlclient.a
I will use the following settings for compiling and testing:

cflags (mysql_config) = -I/usr/include -mcpu=pentiumpro
libs (Users choice) =
/usr/local/mysql/lib/lib/mysqlclient.a
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testuser (default ) =

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Unrecognized argument in LIBS ignored:
'/usr/local/mysql/lib/lib/mysqlclient.a'
Using DBI 1.30 installed in
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/DBI
Writing Makefile for DBD::mysql
[root@localhost DBD-mysql-2.9004]#
---------------------------------
What should I do to get DBD-MySQL to install correctly?

View Replies !
Using Perl With Mysql
I have heard that if you want a view with mysql, perl is one iof the best applications to use. I want to make a user interface with perl that will prompt the user to enter values and then those values will be stored into the database. I'm just started to learn how to use perl, can anyone give me a little help with writing the code?

View Replies !
Perl DBD::mysql - Using Arrayref
I have an app where I would like to display a returned table with column
headings as specified in the inquiry (select), while preserving the
column sequence of columns as specified in the original inquiry -
without having access to the original inquiry.

If I use the fetchrow_hashref method, I can determine the column
headings, but I lose the sequence. If I use fetchrow_arrayref, I
preserve the sequence, but I lose the column headings. I suspect there
is an easy answer. Anybody have it?

View Replies !
Dealing With Mysql Through Perl
i'm working with a mySql database. i have accessed the database through perl.
now i want to know how i can store images in the databases through perl and how to retrieve it..
does anyone have an idea abt this?

View Replies !
Perl And Mysql Datetime
I am trying to have an update form for a datetime field. I've been looking all morning and haven't been able to find any examples of how to do it.
I have the date in the form formatted by perl like this: 08-14-2006 11:29:28 and when I do the update to mysql nothing happens. It does not work.
I need to make it so the user can put the time the student left.

View Replies !
Perl And Mysql 5, Can't Connect
I have installed perl 5.8.8 and mysql 5. My perl scripts don't work with mysql.
Do I need to do something more for perl and mysql 5 to work together?

View Replies !
Perl/mysql On Linux
i am not getting the output for the following code (given below) in apache server on linux.
but i do get ouput in perl interpreter please replay me .
vinaykumarms@rediffmail.com





#!/usr/bin/perl
print "ContentType: text/plain

";

use DBI;

# Connecting to the database
# Replace DATABASENAME with the name of the database,
# HOSTNAME with the hostname/ip address of the MySQL server.
$drh = DBI->install_driver("mysql");
$dsn = "DBI:mysql:database=vinay;host=localhost";
$dbh = DBI->connect($dsn,"","");

# Select the data and display to the browser

my $sth = $dbh->prepare("SELECT * FROM login");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}
";
}

$sth->finish();

# Disconnect from the database.

$dbh->disconnect();

View Replies !
Verifying Mysql Writes (perl)
What is a proper way of verifying that a mysql write was successfull,
and to retry if it wasnt?

In my perl script I add records through:

my $dbh=DBI->connect($dsn, $db_user_name, $db_password);
my $sth=$dbh->prepare("insert into TABLE (X, Y, Z) values ('1', '2',
'3')");
$sth->execute;
$sth->finish;

I have noticed that from time to time this fails, due to limitations
of my webhost. I thus want to do a check after the write, that it
actually happened, and if not redo.

View Replies !
Unable To Connect To Mysql Via Perl
I am attempting to connect to my mysql using a perl script, and keep getting an error message that tells me the I am missing a sub routine.

I have installed DBI and DBD::mysql but still can not use

my $dbh = open_dbi($db,$username,$password)

I am assuming that open_dbi is not installed, does anyone know of another, or better way to access mysql via perl.

View Replies !
Installing MySQL 5 Perl DBI Must Be Installed?
the steps to installing MySQL 5 on Red Hat Linux 9? When I follow the steps as outlined in the manual or Red Hat text I get an error that Perl DBI must be installed.

After attempting to download the Perl DBI; that failed because the server was not availabe. Eventually I was able to download some Perl stuff, but not the DBI. Here is the problem at its root. Where is the information to handle all of the error messages? Where is the source of knowledge to work around these problems?

View Replies !
MySql Coding In Perl Manual
Can anyone point me to a good online (or downloadable) manual on MySql coding in Perl?

View Replies !
Retreiving MySql Data With Perl (DBI)
I have been trying to retrive data out of MySql data file using DBI and Perl for a while with no luck. I get message "Can't locate loadable object for module DBI in @INC (@INC contains: C:/Program Files/Perl/lib C:/Program Files/Perl/site/lib .) at C:/Program Files/Perl/lib/DBI.pm line 258"

I have DBI.pm in above respected directories. I have no problem retreiving data out of flat files ie simple text file with delimiters. I use windows xp,Perl,Apache server and MySql server at home with no other problems.

View Replies !
MySQL/Perl Book Recommendation For A Beginner?
Here's the situation: I have a Perl-based forum that I wrote myself. It
currently supports user accounts, but these are stored in a flat text file
(as is everything else for that matter). I'm looking to convert this to a
MySQL database so that I can do more with that information, but with less
processing time (reading through that huge text file to find something isn't
very efficient).

In the future I hope to move the whole forum over to MySQL, but I thought a
good starter project would be just one aspect of it.

At this point I am looking for recommendations on good books for someone
moderately experienced with Perl, but who has NO experience with MySQL or
anything similar. Since I'd prefer to integrate this with my existing
script, I'd rather stick with Perl and not learn PHP at this time. So far it
seems like "MySQL and Perl for the Web" is a good - are there others? I
prefer reference-style texts with useful code examples, rather than
lesson-style books.

View Replies !
Calling MySql Select Procedures In Perl
I am trying to call a "select" stored procedure from perl. I am not quite sure how to do it. Here is the stored procedure:

CREATE PROCEDURE spTest() begin select x AS X from tblTest;

It works fine when called from within MySQL.

mysql> call spTest():
+------+
| X |
+------+
| 24 |
| 3 |
+------+

I have the following code in perl:

my $spt = $db->prepare("Call spTest()");
$spt->execute();
$spt->bind_columns($id);
while($spt->fetchrow_array()){
print "X = $id";
}

I get an error that says I need to use "select into". How do I call this procedure from perl?

View Replies !
Perl DBI / SQL
I need to know how to retrieve through Perl DBI a listing of possible ENUM
elements from a field for processing under a CGI script. If all I need for
this is some form of SELECT statement, please provide a code snippet of this
so I can do it.

I want to make my code so I'm not having to edit hard-coded Perl CGI scripts
if/when I add new elements to the ENUM field.

View Replies !
PHP Or Perl?
As part of my own learning mysql project I'm planning to build
databases for all my books and DVD's. Stephen Hawking is probably
a better typist than I am so I plan to use barcodes to get the info
,taking the information from various web sites.

People tell me that PHP is THE way to do database work with mysql.
The thing is, I'm familiar with Perl and it has all kinds of neat
string manipulation stuff and LWP.

Does PHP have comprable libraries (especially LWP) and how difficult
is it to move from Perl.

View Replies !
Fw: PHP Or Perl?
Do've an example on using Rebol to connect to mySQL via TCP/IP?
How do you do it? How do you execute SQL quieries? Return results etc ?
Do you use some kind of "middleware" that your communicating to from Rebol
via TCP/IP which gets the data for you?I'm actually a Delphi, Java, VB, Perl & Ruby developer (done alittle Rebol
before) but found it strange that your using TCP/IP to communicate with
mySQL



View Replies !
Select Via Perl
I am trying to read a file and see if the contents of it exists in the DB or not and am trying to do it via a Select.I try to do a select * into outfile /tmp/result.txt from table where field like "%$var%"; but it always goes through the first two lines of the input file and then says the file already exists. Is this because I read each line of a file in a for loop in perl and the mysql query tries to recreate the outfile each time? Is there any other way I can dump the results of the select to a file of some sort?

View Replies !
PHP Or Perl? (or Rebol Via TCP/IP)
Do've an example on using Rebol to connect to mySQL via TCP/IP?

How do you do it? How do you execute SQL quieries? Return results etc ?
Do you use some kind of "middleware" that your communicating to from Rebol
via TCP/IP which gets the data for you?

I'm actually a Delphi, Java, VB, Perl & Ruby developer (done alittle Rebol
before) but found it strange that your using TCP/IP to communicate with
mySQL.

View Replies !
Error In Perl
I receive the following error when I try to acces MySQL 4.1

Client does not support authentication protocol requested by server; consider upgrading MySQL client

I conntect with Perl in this way : $dbh = DBI->connect("DBI:mysql:dbname:localhost","dbuser","dbpass") or print"I can't connect" .DBI->errstr;;

View Replies !
Uninstall Perl (DBI)
i try to install Mysql Server V5 on a Redhat 5 Enterprise.

But the RPM needs Perl (DBI) so I install it following the install guide provide on this site. But it' seems to not be detected by the rpm package when installed.

View Replies !
Perl Dbi And Bitfields
In the past I encoded some bit fields into hex and stored them in a short string. I now want to be able to use sql to select records according to settings of various 'flags'. So I have changed the field to a bit field and have succeded in populating it.

I can display the vaules using bin(flags+0) as a string of 1 & 0s but when I try to get the value back into a perl variable from a select * it always comes back as 0?

View Replies !
Can't Get Perl To Connect
I am just trying to connect and it wont give real errors like PHP it just says internal server error.

#!/usr/bin/perl
use warnings;
use strict;
use DBI;

$dsn = 'dbi:mysql:dbname=Location_Test';
$user = 'lmayer';
$password = '*******';
$dbh = DBI->connect($dsn, $user, $password,
{ RaiseError => 1, AutoCommit => 0 })

I can't make this work at all. I know its configured correctly since all the other pages work. I connect fine at the command line so I know the username and password work.

View Replies !
Perl Script
Is it possible to have MySQL execute a Perl script? I need to run the script upon insertion of a row into a MySQL table.
I've seen myperl, but that appears to execute Perl syntax from within MySQL and won't meet our needs

View Replies !
How To Upload Images With Perl
I want to upload an image from a form, store it in the db, then retrieve it and display it on an HTML page. I am looking for a Perl code example to do the store and retrieve.

View Replies !
Getting Last Auto Increment ID (perl DBI)
i am inserting a new line into a table with an auto incremented unique ID. after that i want to add a row to another table that will cross reference with using the ID from the first.

what is a reliable method of performing this? selecting the highest ID is open to possible race errors so i'm not keen to do it that way. can it be done in one line?

View Replies !
Authentication Failing In Perl DBI Script
#! /usr/bin/perl

use DBI ;
use strict ;

use CGI ;
my ($cgi) = new CGI ;

my ($dsn)="DBI:mysql:dr:localhost";
my ($user_name) = "fubar" ;
my ($password) = "secret" ;
my ($dbh,$sth) ;
my (@ary) ;

$dbh = DBI->connect ($dsn, $user_name, $password, { RaiseError => 1 });

, and on MySQL, at the command prompt, I've typed this:

grant all on *.* to fubar identified by "secret" ;

View Replies !
Blob Update In Perl DBI Gives Syntax Error
I have a Perl app that stores pictures in a blob. Now I want to load a thumbnail version of the picture into another blob column, but the update fails with a syntax error. I'm able to insert the new record, with blobs, into a separate table, but can't update the original record. Is it not
possible to update blobs?

View Replies !
LOAD DATA LOCAL INFILE And Perl DBI/DBD
For the past several months we have been using LOAD DATA LOCAL INFILE to bulk load tables within
Perl modules.

Recently, someone thought it would be a good idea to upgrade the Solaris machines - I'm thinking it
wasn't that good an idea :-(

We are now running MySQL 4.0.18 and the DBI version is 1.35. Now, our scripts are failing with the
dreaded "The used command is not allowed with this MySQL version" message. Here's what I know at
the moment:

1. mysqld has local infile enabled.
2. mysql client can perform a LOAD DATA LOCAL INFILE
3. dbimon cannot perform a LOAD DATA LOCAL INFILE (same message as above).

So as I understand this, DBI is somehow not allowing the local option. I tried adding the
local_infile=1 option on the DSN, but that didn't help (if there was an error, it was silently
ignored).

Two questions:
1. How can I get the LOCAL option working?
2. How can I identify the source of the problem better so we don't waste more time in the future?

View Replies !
Insert Data Into Database Using Perl Script
how to insert data into my sql using perl script??

View Replies !
Question On Selecting From A Large Table In Perl
I have a large table with 4 million rows. I need to do an operation on each of the rows. I am using Perl.

When I use the following code on a small table, it works just fine but on the large table, it gets stuck on line 3. As soon as it executes line 3, my hard drive starts going and keeps on going with no end. It never reaches line 4. My diagnosis follows the code fragment below:

-------------------------------------code fragment begin
1 my $sql = 'select myColumn from myTable';
2 my $sth = $dbh->prepare($sql) || die ("dbh prepare failed ");
3 $sth->execute() || die ("execute sth failed");
4 my $colValue;
5 $sth->bind_columns($colValue);
6 while ($sth->fetch()) {
7 do something to $colValue;
8 }
-------------------------------------code fragment end

I think this is because mySQL is trying to load all 4 million rows into memory. Is there a way, perhaps a command line switch, to delay this so that it processes one row at a time. I have tried adding SQL_NO_CACHE to my SELECT statement but that did not make any difference at all.

On a related note, when I was trying to export the four million rows using mysql command line, I had a similar problem but I found the -q command line switch for mysql command line (From the manual: -q or --quick means "Don't cache result, print it row by row.")

I hope there is something similar for my Perl problem above too. Or am I doing something completely wrong in the way I am doing this? I am a newbie to mySQL.

View Replies !
How To Generate Html Output For Query Result With Perl
I can generate the html with the command like:

>mysql -ppassword -uusername -H -e "select distinct depID from tabledepart" databasename

but i need to know how to generate html output if i already connected with a database, and how to pass the html result to the perl program.

View Replies !
ERROR 2002 (HY000): Can't Connect To Local MySQL Server Through Socket '/var/lib/mysql/mysql.sock' (13)
I have a problem connecting to sql and can't find anything on the net to solve the problem.

I have some sql databases running on a server. when I'm root on the server and I want to login to sql I do "mysql -ustudent -p -Dwordnet30 and it works fine. when I'm logged in with the user account on the server, i get this error message:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

so with the same user name in mysql, i can log on when i'm root, but not when i'm the user. the grant table for the user looks like this: Code:

View Replies !
Can't Connect To Local MySQL Server Through Socket '/home/data/mysql/mysql.sock' (13)
I just installed mysql on linux. If I open a terminal, su to root,
then type "mysql", I am able to connect to the server and run my
queries.

If I exit out of su so that I am my own id (baisley) and type "mysql",
I get this error: Can't connect to local MySQL server through socket
'/home/data/mysql/mysql.sock' (13)

Any idea why? mysql.sock has full permissions (read/write/execute), so
it should be accessable by user baisley. If I am baisley and I run
"mysql -u mysql" (as mysql is the user that the RPM set up), it will
connect.

What I would like to be able to do is run this without having to be
user mysql all the time. How do I go about setting that up, or is it
better to run all my queries/make tables as 1 user?

View Replies !
ERROR [HY000][MySQL][MyODBC 5.00.11][MySQL] 2006 MySQL Server Has Gone Away
Hosting Package Environment:
ASP.NET ver 2
MySQL 5.0
FP Extensions 2003

Progression:
Developed Website Outline
Developed Database in Access2003
Migrated AccessDB to MySQL @ Hosting Service using Migration Tool.
Can connect using MySQL Admin tools and run queries fine and all data, relations etc. are there.

PROBLEM: (The heart of the matter)
Starting simple, created GridView Control using Microsoft Visual Web Developer 2005 Express, a few glitches here and there, used the MySQL Connector/ODBC v5.00.11 followed instructions. Can see database in Database Connections Window but when I try to connect the GridView Control to it I get:

"Database schema could not be retrieved for this connection. Please make sure the connection settings are correct and that the database is online.

ERROR [HY000][MySQL][MyODBC 5.00.11][MySQL] 2006 MySQL server has gone away"

Had thought that "Microsoft Visual Web Developer 2005 Express" might be messing with the ODBC driver so thought to download the .NET Connector. That's when it all went bad. The documentation does not say how to install or use the connector or where to put the files. It seems to assume that these bits of information are common knowledge and I suppose that if I had kept up with the technology it might be. But alas I didn't and it Isn't and It Don't work.

View Replies !
Could Not Load MySQL Driver! Compile Php --with-mysql Or Install The Mysql.so Module.
I am trying to install Media Wiki 1.5.2 on Windows XP and I have already installed apache_2.0.55-win32-x86-no_ssl ,mysql-5.0.15-win32 and php-5.1.1-Win32 .

When I am trying to install Media Wiki 1.5.2 I receive the following message :

Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension=mysql.so in your php.ini in C:Program FilesApache GroupApache2htdocsmediawikimediawiki-1.5.2install-utils.inc on line 17
Could not load MySQL driver! Please compile php --with-mysql or install the mysql.so module.

View Replies !
Can't Connect To Local MySQL Server Through Socket '/var/lib/mysql/mysql.sock' (11)
We run Bitrix CMS and upon installing the web statistics module, it will sometimes show this error:

Error! mysql_connect('-', '-', '-')
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11)

The max connections has been raised to a 1000... and SHOW GLOBAL STATUS says for the maxed used connections:

Max_used_connections 273

The server does not really max out...

View Replies !
How To Configure MySQL ODBC Driver To Connect To A Mysql Server On My Own Side Of The Router?
Using MS Access, I have attached to MySQL servers in other states
and other countries on the other side of my router. But when I use the
MySQL ODBC driver 3.51 to connect to a MySQL server on my own LAN,
the driver tells me it cannot make the connection. Here are the ODBC
driver connection parms:

Data Source Name: (free field - name my "my linux box" will do nicely)
Host/Server Name (or IP) - something like MSQLUserName@ServerName.net
has worked fine for me in the past. Now I'm trying 192.168.1.106
Database Name - whatever, mysqldb works fine, any valid db

User - root
Password - myrootpass

Port - 3306 has worked fine 4 me N the past. Dunno whether 2 use now
SQL Command On Connect - haven't ever put anything here

Perhaps there is some configuration in mysql user privilege for the
mysqluser "root" that would prevent him from logging from a remote PC
to the mysql server?

View Replies !
Warning: Mysql_query(): Can't Connect To Local MySQL Server Through Socket '/tmp/mysql.sock' (2)
I'm trying to connect to my MySQL database (sitehosted by GoDaddy) using PHP. I am having these errors and don't understand what they mean

Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/content/n/l/a/nladmin/html/v5.0_3/c_register.php on line 6
Warning: mysql_query(): A link to the server could not be established in /home/content/n/l/a/nladmin/html/v5.0_3/c_register.php on line 6

Notice: Query: SELECT * FROM types MySQL error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/content/n/l/a/nladmin/html/v5.0_3/c_register.php on line 6
here4
Warning: mysql_close(): no MySQL-Link resource supplied in /home/content/n/l/a/nladmin/html/v5.0_3/c_register.php on line 13

I've checked paths and connection settings and don't see any problems. My guess is now that the problem is coming from the opening and closing of the DB. my script, c_register.php uses a require_once('../mysql_connect.php') to open the connection to the database. But I also have a function definition in c_register.php that uses require_once('../mysql_connect.php') when called because it needs a connection to the DB. Here's a visual that might help:

View Replies !
MySQL Error Number 2003 :: Can't Connnect To MySQL Server On 'hostname'(10065)
I was running an older version of the query browser a while back to connect to an older version of mySQL (3.0) running on a linux box. The server hasn't changed, but the query browser has been upgraded to 1.1.10. I can't go back to the older version of the query browser because the machine that ran it got re-formatted so I downloaded the new version and installed it.

So ... I get the following error when I try to connect:

MySQL Error Number 2003
Can't connnect to MySQL server on 'hostname'(10065)

Interestingly, I wrote a simple PHP script to connect to the server and pull some data off of it:

View Replies !
Warning: Mysql() [function.mysql]: Access Denied For User 'apache'@'localhost' (using
my script is not connecting to my database, i get this error

Warning: mysql() [function.mysql]: Access denied for user 'apache'@'localhost' (using password: NO)

View Replies !
Download Of Mysql.sock File Unable To Connect To Mysql Server
Where can i get the download mysql.sock file?

I am unable to connect to local server because i dont have this file?

View Replies !
Table Rows Inserted By Embeddded MySQL Cannot Be Retrieved By MySQL Tcp Client
I have encountered a weird behavoir of embedded MySQL. Through a
simple program I made (in Delphi 6), I can insert rows to a table
through embedded MySQL and I can retrieve the rows from my program.

But using mysql.exe which points to the same table (through 127.0.0.1,
with the same basedir and datadir), I cannot see the rows I inserted
using my embedded program. Another way around, the rows inserted by
mysql.exe can be seen in my embedded program. But after a row is
inserted by mysql.exe, the rows inserted by the embedde program are
deleted (or cannot be queried).

Can anybody explain why is this? Is there a way to fix it?

View Replies !
DBD::mysql::st Execute Failed: Lost Connection To MySQL Server During Query
I am using perl to connect to a database and then pull the rows off of the table one by one to manipulate the data.

If I use a smaller table (~8 MB), I wait for around 20 seconds but then the table values are read just fine. However if I use a larger table (~30 MB), I wait for a while and then I get the message:

DBD::mysql::st execute failed: Lost connection to MySQL server during query

I have tried searching for the solution to this problem and haven't found anything that helps yet. I have changed the values of 'max_allowed_packet' and 'wait_timeout', with no effect.

Any ideas?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved