limitations of mySQL i.e. number of rows
Hi everyone I have a requirement to store in the region of 3 million entries per month (30 ish days) of data in a mySQL database totalling a maximum of 2 months (6 Million entries). The database will be 'probably' reside on a Sun V240. I have a similar size database running on an old Sun E450 and it runs like a dog (with three legs). I'll need to access the data and plot the output almost real time, or as close to it as possible. I may have to go down the route of buying another database like DB2, Informix or Oracle but I have no idea of the costs involved or whether I will get improved performance form these compared to mySQL. Anyone have experience of large datasets within mySQL. Thanks Regards Andy This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us.
RE: limitations of mySQL i.e. number of rows
Thanks for the info Dan. I'll check the resources you mentioned. Regards Andy From: Dan Buettner [mailto:[EMAIL PROTECTED] Sent: Tue 8/22/2006 1:38 PM To: Andy Ford Cc: mysql@lists.mysql.com Subject: Re: limitations of mySQL i.e. number of rows Andy, performance will generally depend on several factors: - size of each record - amount of RAM - speed of disks, for when RAM isn't enough - concurrent inserts/writes (using InnoDB or MyISAM tables?) At one level, 6 million records is no problem, and really not even very many. If every record is several MB in size though then it becomes another story. One system I designed has collected some 15 million records, and performance is still good, though records are fairly small (a few hundred bytes). Real-time reporting on old data in a Web browser is no longer feasible though, so I started generating summary data for live reporting (see below). I would suggest taking some time to architect it well, using archival tables for old data, possibly with the MERGE engine. If you need to plot data in close to real time with a large recordset, a good approach may be to automatically generate summary data into a side table periodically (every 3 minutes, every 30 minutes, whatever) off the last x minutes. If your summary process can run off a smallish live data table and key off an indexed field, it will hopefully run quickly each time. Then you plot off that summary table while the live processes go about their business, largely unaffected by your reporting. Read up on MySQL performance - there's a good section (optimization) in the online manual, and also I recommend Jeremy Zawodny's book High Performance MySQL from O'Reilly as a good source of information. Within reason, a well-architected database on modest hardware can often perform better than a poorly-architected one on a superfancy box. As an aside, I ran Sybase on both E420R's (very similar to the 450) and V240's at my last job, and the V240 ran circles around the 420. The V240's are nice little boxes (though I had no real complaints about the 420's, for what they were - cheap, reliable data storage). Loading the thing up on RAM should help. Best, Dan On 8/22/06, Andy Ford [EMAIL PROTECTED] wrote: Hi everyone I have a requirement to store in the region of 3 million entries per month (30 ish days) of data in a mySQL database totalling a maximum of 2 months (6 Million entries). The database will be 'probably' reside on a Sun V240. I have a similar size database running on an old Sun E450 and it runs like a dog (with three legs). I'll need to access the data and plot the output almost real time, or as close to it as possible. I may have to go down the route of buying another database like DB2, Informix or Oracle but I have no idea of the costs involved or whether I will get improved performance form these compared to mySQL. Anyone have experience of large datasets within mySQL. Thanks Regards Andy This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us.
remote monitoring of mySQL
What would be the best approach to remote monitoring of numerous mySQL databases remotely i.e. number of threads. number of open tables etc etc Can I do it with DBD::Perl Thanks Andy -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ Managed Services (in:control) Developer, Telindus, RG27 9HY DDI: +44 1256 709200, GSM: +44 7810 636652 This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
new insallation of mysql not starting
I have just upgraded a mySQL installation on a Soalri 2.8 box for the source. It compiled and installed without error. The startup script redirect STDOUT STDERR into /dev/null so this is what I did ... /usr/bin/mysqld_safe --datadir=/data/mysql-data/ --pid-file=/data/mysql-data/mysql.pid Starting mysqld daemon with databases from /data/mysql-data/ STOPPING server from pid file /data/mysql-data/romulus.pid 050429 11:19:13 mysqld ended Anyone have any ideas what the code 050429 means? And where are the log files? Thanks Andy This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us.
RE: new insallation of mysql not starting
Whoops - that wasn't an error code (thanks Prasanna!) Here is the log file.. 050429 11:32:08 mysqld started InnoDB: The first specified data file ./ibdata1 did not exist: InnoDB: a new database to be created! 050429 11:32:09 InnoDB: Setting file ./ibdata1 size to 10 MB InnoDB: Database physically writes the file full: wait... 050429 11:32:10 InnoDB: Log file ./ib_logfile0 did not exist: new to be created InnoDB: Setting log file ./ib_logfile0 size to 5 MB InnoDB: Database physically writes the file full: wait... 050429 11:32:10 InnoDB: Log file ./ib_logfile1 did not exist: new to be created InnoDB: Setting log file ./ib_logfile1 size to 5 MB InnoDB: Database physically writes the file full: wait... InnoDB: Doublewrite buffer not found: creating new InnoDB: Doublewrite buffer created InnoDB: Creating foreign key constraint system tables InnoDB: Foreign key constraint system tables created 050429 11:32:12 InnoDB: Started; log sequence number 0 0 050429 11:32:13 [ERROR] Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't exist 050429 11:32:13 mysqld ended Thanks Andy -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: Friday, April 29, 2005 12:26 PM To: Mysql (E-mail) Subject:new insallation of mysql not starting I have just upgraded a mySQL installation on a Soalri 2.8 box for the source. It compiled and installed without error. The startup script redirect STDOUT STDERR into /dev/null so this is what I did ... /usr/bin/mysqld_safe --datadir=/data/mysql-data/ --pid-file=/data/mysql-data/mysql.pid Starting mysqld daemon with databases from /data/mysql-data/ STOPPING server from pid file /data/mysql-data/romulus.pid 050429 11:19:13 mysqld ended Anyone have any ideas what the code 050429 means? And where are the log files? Thanks Andy This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
How to move a database to a new directory
I have run out of disk space in the directory where I have a mySQL database. How do I go about moving it and reconfiguring mySQL to see the new location. Thanks Andy This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us.
RE: graphs
Perl and GD would do the trick. Take a look at how RDDtools does it! Andy -Original Message- From: Daniel Kasak [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 13, 2005 11:08 PM To: prathima rao; mysql@lists.mysql.com Subject:Re: graphs prathima rao wrote: hello, can anyone suggest if there is any software available to create graphs using mysql as database regards prathima rao My favourite has always been JpGraph - http://www.aditus.nu/jpgraph/ - it's a PHP library. You can use it on a web server or on a stand-alone PHP installation. It's not MySQL-specific, but there are some tutorials around demonstrating some graphs based on data from MySQL. I'm sure there are Perl libraries that also do graphing, but I've never been bothered to research to much - they'd have to be good to surpass JpGraph. -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: compilation errors in c++ wrapper
Whoops - every c/c++ program must have a main function. That's what the cryptic message was... Andy On Wed, 2005-01-12 at 17:35 +, Andy Ford wrote: Hi everyone. I have been putting together a c++ wrapper for the mysql c libraries and have stumbled across the following error... g++ -L/usr/local/mysql/lib -I/usr/local/mysql/include -o connection connection.cpp -lmysqlclient -lnsl -lsocket -lz -lm Undefined first referenced symbol in file main /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crt1.o Result::Result[in-charge](st_mysql_res*)/var/tmp//cc13NSwj.o ld: fatal: Symbol referencing errors. No output written to connection collect2: ld returned 1 exit status The error mentions the Constructor Result::Result (for the class Result) which I don't have declared. Any ideas what it is telling me. It ultimately comes up with an ld referencing error pointing at /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crt1.o Any other ideas Thanks Andy -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
compilation errors in c++ wrapper
Hi everyone. I have been putting together a c++ wrapper for the mysql c libraries and have stumbled across the following error... g++ -L/usr/local/mysql/lib -I/usr/local/mysql/include -o connection connection.cpp -lmysqlclient -lnsl -lsocket -lz -lm Undefined first referenced symbol in file main /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crt1.o Result::Result[in-charge](st_mysql_res*)/var/tmp//cc13NSwj.o ld: fatal: Symbol referencing errors. No output written to connection collect2: ld returned 1 exit status The error mentions the Constructor Result::Result (for the class Result) which I don't have declared. Any ideas what it is telling me. It ultimately comes up with an ld referencing error pointing at /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/crt1.o Any other ideas Thanks Andy -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
mySQL C++ API (which libraries)
Hi fellow developers ... I'm about to move my Perl code to C++ for security. Which mySQL libraries are the best ones to use? There are so may available I thought I'd consult the community in the know! Thanks Andy -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
compilation errors in mySQL C app
Hi everyone I am trying to compile a simple C program to connect to a mySQL database (on localhost) and run a simple query. I am getting the following errors... gcc test.c -L/usr/local/mysql/lib -lmysqlclient -o test ld: warning: file /usr/local/mysql/lib/libmysqlclient.a(libmysql.o): wrong ELF class: ELFCLASS64 Undefined first referenced symbol in file mysql_query /var/tmp//ccpHcO9u.o mysql_init /var/tmp//ccpHcO9u.o mysql_close /var/tmp//ccpHcO9u.o mysql_free_result /var/tmp//ccpHcO9u.o mysql_num_rows /var/tmp//ccpHcO9u.o mysql_error /var/tmp//ccpHcO9u.o mysql_store_result /var/tmp//ccpHcO9u.o mysql_real_connect /var/tmp//ccpHcO9u.o mysql_fetch_row /var/tmp//ccpHcO9u.o ld: fatal: Symbol referencing errors. No output written to test2 collect2: ld returned 1 exit status Any ideas how I can fix these? Thanks Andy -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: compilation errors in mySQL C app
Hi David Yes it is something like you say... file /usr/local/bin/gcc /usr/local/bin/gcc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped file /usr/local/bin/g++ /usr/local/bin/gcc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped isainfo -kv 64-bit sparcv9 kernel modules I got rid of the ELF issue with the -m64 option but still get the following errors... gcc -m64 test.c -L/usr/local/mysql/lib -lmysqlclient -o test Undefined first referenced symbol in file getpeername /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) floor /usr/local/mysql/lib/libmysqlclient.a(password.o) socket /usr/local/mysql/lib/libmysqlclient.a(client.o) gethostbyname_r /usr/local/mysql/lib/libmysqlclient.a(client.o) setsockopt /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) getservbyname /usr/local/mysql/lib/libmysqlclient.a(libmysql.o) connect /usr/local/mysql/lib/libmysqlclient.a(client.o) shutdown /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) inet_ntoa /usr/local/mysql/lib/libmysqlclient.a(my_net.o) inet_addr /usr/local/mysql/lib/libmysqlclient.a(client.o) ld: fatal: Symbol referencing errors. No output written to test2 collect2: ld returned 1 exit status Getting there slowly Thanks Andy On Tue, 2005-01-11 at 21:42 +1100, Logan, David (SST - Adelaide) wrote: Hi Andy, Are you using a 64bit option to compile your program (I can't remember the option on gcc -m64 I think)? Looks like a 64bit mysql library trying to talk to a 32 bit program. I'm no expert but I had similar problems when I put a 64bit mysql on one of my Solaris boxen and tried to talk with a 32 bit perl implementation. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, 11 January 2005 8:59 PM To: mysql@lists.mysql.com Subject: compilation errors in mySQL C app Hi everyone I am trying to compile a simple C program to connect to a mySQL database (on localhost) and run a simple query. I am getting the following errors... gcc test.c -L/usr/local/mysql/lib -lmysqlclient -o test ld: warning: file /usr/local/mysql/lib/libmysqlclient.a(libmysql.o): wrong ELF class: ELFCLASS64 Undefined first referenced symbol in file mysql_query /var/tmp//ccpHcO9u.o mysql_init /var/tmp//ccpHcO9u.o mysql_close /var/tmp//ccpHcO9u.o mysql_free_result /var/tmp//ccpHcO9u.o mysql_num_rows /var/tmp//ccpHcO9u.o mysql_error /var/tmp//ccpHcO9u.o mysql_store_result /var/tmp//ccpHcO9u.o mysql_real_connect /var/tmp//ccpHcO9u.o mysql_fetch_row /var/tmp//ccpHcO9u.o ld: fatal: Symbol referencing errors. No output written to test2 collect2: ld returned 1 exit status Any ideas how I can fix these? Thanks Andy -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: compilation errors in mySQL C app
Got it ... Thanks David gcc -m64 test.c -L/usr/local/mysql/lib -lmysqlclient -lsocket -lnsl -lm -o test .. seemed to work I get a 'Bus Error (core dumped)' when I run it - but that's a problem with the code!! Thanks Andy On Tue, 2005-01-11 at 22:23 +1100, Logan, David (SST - Adelaide) wrote: Hi Andy, I resolved the problem by reinstalling a 32bit version of mysql and the DBI worked fine after that. Looks like you are missing a library or 2, try nsl and socket. I think they have all the routines that you need to link against. You may also need an include or 2. All the routines have man pages that reference the libraries and includes required. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, 11 January 2005 9:37 PM To: Logan, David (SST - Adelaide) Cc: mysql@lists.mysql.com Subject: RE: compilation errors in mySQL C app Hi David Yes it is something like you say... file /usr/local/bin/gcc /usr/local/bin/gcc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped file /usr/local/bin/g++ /usr/local/bin/gcc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped isainfo -kv 64-bit sparcv9 kernel modules I got rid of the ELF issue with the -m64 option but still get the following errors... gcc -m64 test.c -L/usr/local/mysql/lib -lmysqlclient -o test Undefined first referenced symbol in file getpeername /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) floor /usr/local/mysql/lib/libmysqlclient.a(password.o) socket /usr/local/mysql/lib/libmysqlclient.a(client.o) gethostbyname_r /usr/local/mysql/lib/libmysqlclient.a(client.o) setsockopt /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) getservbyname /usr/local/mysql/lib/libmysqlclient.a(libmysql.o) connect /usr/local/mysql/lib/libmysqlclient.a(client.o) shutdown /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) inet_ntoa /usr/local/mysql/lib/libmysqlclient.a(my_net.o) inet_addr /usr/local/mysql/lib/libmysqlclient.a(client.o) ld: fatal: Symbol referencing errors. No output written to test2 collect2: ld returned 1 exit status Getting there slowly Thanks Andy On Tue, 2005-01-11 at 21:42 +1100, Logan, David (SST - Adelaide) wrote: Hi Andy, Are you using a 64bit option to compile your program (I can't remember the option on gcc -m64 I think)? Looks like a 64bit mysql library trying to talk to a 32 bit program. I'm no expert but I had similar problems when I put a 64bit mysql on one of my Solaris boxen and tried to talk with a 32 bit perl implementation. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, 11 January 2005 8:59 PM To: mysql@lists.mysql.com Subject: compilation errors in mySQL C app Hi everyone I am trying to compile a simple C program to connect to a mySQL database (on localhost) and run a simple query. I am getting the following errors... gcc test.c -L/usr/local/mysql/lib -lmysqlclient -o test ld: warning: file /usr/local/mysql/lib/libmysqlclient.a(libmysql.o): wrong ELF class: ELFCLASS64 Undefined first referenced symbol in file mysql_query /var/tmp//ccpHcO9u.o mysql_init /var/tmp//ccpHcO9u.o mysql_close /var/tmp//ccpHcO9u.o mysql_free_result /var/tmp//ccpHcO9u.o mysql_num_rows /var/tmp//ccpHcO9u.o mysql_error /var/tmp//ccpHcO9u.o mysql_store_result /var/tmp//ccpHcO9u.o mysql_real_connect /var/tmp//ccpHcO9u.o mysql_fetch_row /var/tmp//ccpHcO9u.o ld: fatal: Symbol referencing errors. No output written to test2 collect2: ld returned 1 exit status Any ideas how I can fix these? Thanks Andy -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail
c program Bus Error (core dumped)
Hi everyone. I have been trying to write a simple c program to access a local mySQL database (with the help of David Logan). With the following code I am getting the error ... Bus Error (core dumped) ... when I run my compiled program 'test'. [code] int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; int state; mysql_init(mysql); connection = mysql_real_connect(mysql, localhost, username, password, mydb, 0, NULL, 0); /* check for a connection error */ if( connection == NULL ) { printf(mysql_error(mysql)); return 1; } else { printf(Everything Cool with the connection\n); } state = mysql_query(connection, SELECT * from mytable); if( state ) { printf(mysql_error(connection)); return 1; } else { printf(Everything Cool with the query\n); } mysql_close(connection); printf(Done.\n); } [/code] The actual output is ... Everything Cool with the connection Everything Cool with the query Bus Error (core dumped) The 'Bus Error' I have Googled for but can't find a resolution. Any ideas? Thanks again.. Andy On Tue, 2005-01-11 at 12:05 +, Andy Ford wrote: Got it ... Thanks David gcc -m64 test.c -L/usr/local/mysql/lib -lmysqlclient -lsocket -lnsl -lm -o test .. seemed to work I get a 'Bus Error (core dumped)' when I run it - but that's a problem with the code!! Thanks Andy On Tue, 2005-01-11 at 22:23 +1100, Logan, David (SST - Adelaide) wrote: Hi Andy, I resolved the problem by reinstalling a 32bit version of mysql and the DBI worked fine after that. Looks like you are missing a library or 2, try nsl and socket. I think they have all the routines that you need to link against. You may also need an include or 2. All the routines have man pages that reference the libraries and includes required. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, 11 January 2005 9:37 PM To: Logan, David (SST - Adelaide) Cc: mysql@lists.mysql.com Subject: RE: compilation errors in mySQL C app Hi David Yes it is something like you say... file /usr/local/bin/gcc /usr/local/bin/gcc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped file /usr/local/bin/g++ /usr/local/bin/gcc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped isainfo -kv 64-bit sparcv9 kernel modules I got rid of the ELF issue with the -m64 option but still get the following errors... gcc -m64 test.c -L/usr/local/mysql/lib -lmysqlclient -o test Undefined first referenced symbol in file getpeername /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) floor /usr/local/mysql/lib/libmysqlclient.a(password.o) socket /usr/local/mysql/lib/libmysqlclient.a(client.o) gethostbyname_r /usr/local/mysql/lib/libmysqlclient.a(client.o) setsockopt /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) getservbyname /usr/local/mysql/lib/libmysqlclient.a(libmysql.o) connect /usr/local/mysql/lib/libmysqlclient.a(client.o) shutdown /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) inet_ntoa /usr/local/mysql/lib/libmysqlclient.a(my_net.o) inet_addr /usr/local/mysql/lib/libmysqlclient.a(client.o) ld: fatal: Symbol referencing errors. No output written to test2 collect2: ld returned 1 exit status Getting there slowly Thanks Andy On Tue, 2005-01-11 at 21:42 +1100, Logan, David (SST - Adelaide) wrote: Hi Andy, Are you using a 64bit option to compile your program (I can't remember the option on gcc -m64 I think)? Looks like a 64bit mysql library trying to talk to a 32 bit program. I'm no expert but I had similar problems when I put a 64bit mysql on one of my Solaris boxen and tried to talk with a 32 bit perl implementation. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, 11 January 2005 8:59 PM To: mysql@lists.mysql.com Subject: compilation errors in mySQL C app Hi everyone I am trying to compile a simple C program to connect to a mySQL database (on localhost) and run a simple query. I am getting the following errors... gcc test.c -L/usr/local/mysql/lib -lmysqlclient -o test ld: warning: file /usr/local/mysql/lib/libmysqlclient.a(libmysql.o): wrong ELF
Re: c program Bus Error (core dumped)
I can send the truss output of anyone can decipher it!! Regards Andy On Tue, 2005-01-11 at 13:05 +, Andy Ford wrote: Hi everyone. I have been trying to write a simple c program to access a local mySQL database (with the help of David Logan). With the following code I am getting the error ... Bus Error (core dumped) ... when I run my compiled program 'test'. [code] int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; int state; mysql_init(mysql); connection = mysql_real_connect(mysql, localhost, username, password, mydb, 0, NULL, 0); /* check for a connection error */ if( connection == NULL ) { printf(mysql_error(mysql)); return 1; } else { printf(Everything Cool with the connection\n); } state = mysql_query(connection, SELECT * from mytable); if( state ) { printf(mysql_error(connection)); return 1; } else { printf(Everything Cool with the query\n); } mysql_close(connection); printf(Done.\n); } [/code] The actual output is ... Everything Cool with the connection Everything Cool with the query Bus Error (core dumped) The 'Bus Error' I have Googled for but can't find a resolution. Any ideas? Thanks again.. Andy On Tue, 2005-01-11 at 12:05 +, Andy Ford wrote: Got it ... Thanks David gcc -m64 test.c -L/usr/local/mysql/lib -lmysqlclient -lsocket -lnsl -lm -o test .. seemed to work I get a 'Bus Error (core dumped)' when I run it - but that's a problem with the code!! Thanks Andy On Tue, 2005-01-11 at 22:23 +1100, Logan, David (SST - Adelaide) wrote: Hi Andy, I resolved the problem by reinstalling a 32bit version of mysql and the DBI worked fine after that. Looks like you are missing a library or 2, try nsl and socket. I think they have all the routines that you need to link against. You may also need an include or 2. All the routines have man pages that reference the libraries and includes required. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, 11 January 2005 9:37 PM To: Logan, David (SST - Adelaide) Cc: mysql@lists.mysql.com Subject: RE: compilation errors in mySQL C app Hi David Yes it is something like you say... file /usr/local/bin/gcc /usr/local/bin/gcc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped file /usr/local/bin/g++ /usr/local/bin/gcc: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped isainfo -kv 64-bit sparcv9 kernel modules I got rid of the ELF issue with the -m64 option but still get the following errors... gcc -m64 test.c -L/usr/local/mysql/lib -lmysqlclient -o test Undefined first referenced symbol in file getpeername /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) floor /usr/local/mysql/lib/libmysqlclient.a(password.o) socket /usr/local/mysql/lib/libmysqlclient.a(client.o) gethostbyname_r /usr/local/mysql/lib/libmysqlclient.a(client.o) setsockopt /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) getservbyname /usr/local/mysql/lib/libmysqlclient.a(libmysql.o) connect /usr/local/mysql/lib/libmysqlclient.a(client.o) shutdown /usr/local/mysql/lib/libmysqlclient.a(viosocket.o) inet_ntoa /usr/local/mysql/lib/libmysqlclient.a(my_net.o) inet_addr /usr/local/mysql/lib/libmysqlclient.a(client.o) ld: fatal: Symbol referencing errors. No output written to test2 collect2: ld returned 1 exit status Getting there slowly Thanks Andy On Tue, 2005-01-11 at 21:42 +1100, Logan, David (SST - Adelaide) wrote: Hi Andy, Are you using a 64bit option to compile your program (I can't remember the option on gcc -m64 I think)? Looks like a 64bit mysql library trying to talk to a 32 bit program. I'm no expert but I had similar problems when I put a 64bit mysql on one of my Solaris boxen and tried to talk with a 32 bit perl implementation. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: Andy Ford [mailto:[EMAIL PROTECTED] Sent: Tuesday, 11 January 2005 8:59 PM To: mysql@lists.mysql.com Subject: compilation errors in mySQL C app Hi everyone I am trying
Re: ALTER TABLE....with CHANGE syntax
Which version are you running. Quite often when you see a 'check the version you are running' message indicates a syntax error in your mySQL statement.. Andy On Tue, 2005-01-11 at 05:13 -0800, Karam Chand wrote: Hello, Can somebody tell me from which version of MySQL is - ALTER TABLECHANGE... syntax supported. Regards, Karam __ Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more. http://info.mail.yahoo.com/mail_250 -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: c program Bus Error (core dumped)
Thanks Jose ... but I still get the Bus Error message with the following code... int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; int state; int PORTNUM = 3306; mysql_init(mysql); connection = mysql_real_connect(mysql, localhost, root, 0sg0sb4Ig, oui, PORTNUM, NULL, 0); if( connection == NULL ) { printf(%s\n,mysql_error(mysql)); return 1; } else { printf(%s\n,Everything Cool with the connection); } state = mysql_query(connection, SELECT sysName from inv_device); result = mysql_store_result(connection); if (result) { printf( Return set: columns=%d, rows=%d \n, mysql_field_count(connection), mysql_num_rows(result)); mysql_free_result(result); } else { printf(%s\n, mysql_error(connection)); return 1; } mysql_close(connection); printf(%s\n,Done.); } Regards Andy On Tue, 2005-01-11 at 14:57 +0100, Jose Miguel Pérez wrote: Hi Andy, state = mysql_query(connection, SELECT * from mytable); *** ^^ if( state ) { printf(mysql_error(connection)); return 1; } else { printf(Everything Cool with the query\n); } // New code, retrieve resultset. result = mysql_store_result(connection); if (result) { printf( Return set: columns=%d, rows=%d \n, mysql_field_count(connection), mysql_num_rows(result)); mysql_free_result(__result); } else { printf(%s\n, mysql_error(connection)); return 1; } // New code - mysql_close(connection); printf(Done.\n); After doing a SELECT statement you should issue a mysql_store_result / mysql_use_result operation to flush the resultset returned (even an empty resultset). In fact, you should flush the resultset stream with every SQL statement that returns data like SELECT, SHOW, DESCRIBE, and the like. See the manual page on mysql_store_result for more information. Once in there, you can follow the directions about section 21.2.3.20 mysql_field_count() about using mysql_field_count to check in you need to flush the resultset. Do not forget to call mysql_free_result to free the memory allocated for the returned resultset. Hope this helps, maybe mysql_close(...) got confused by pending data from the server. One note though, you should NEVER use 'printf(whatever);' use 'printf(%s, whatever);' instead. If it happends to be some % inside whatever you will get coredumps. For instance, see what happends when in your program, mysql_error(connection) returns Please use %d to display integers. (Not a real MySQL error, obviously!! :-) Cheers, Jose Miguel. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: c program Bus Error (core dumped)
I can get something working however. int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; char *serverInfo=; int state; int PORTNUM = 3306; unsigned long int version; mysql_init(mysql); connection = mysql_real_connect(mysql, localhost, username, password, mydb, PORTNUM, NULL, 0); /* check for a connection error */ if( connection == NULL ) { /* print the error message */ printf(%s\n,mysql_error(mysql)); return 1; } else { printf(%s\n,Everything Cool with the connection); } printf(version = %ul\n, mysql_get_server_version(mysql)); mysql_close(connection); printf(%s\n,Done.); } ... prints out ... Everything Cool with the connection version = 40107l Done. ... but that is as far as I can go until I can fix the Bus Error Regards Andy On Tue, 2005-01-11 at 14:19 +, Andy Ford wrote: Thanks Jose ... but I still get the Bus Error message with the following code... int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; int state; int PORTNUM = 3306; mysql_init(mysql); connection = mysql_real_connect(mysql, localhost, root, 0sg0sb4Ig, oui, PORTNUM, NULL, 0); if( connection == NULL ) { printf(%s\n,mysql_error(mysql)); return 1; } else { printf(%s\n,Everything Cool with the connection); } state = mysql_query(connection, SELECT sysName from inv_device); result = mysql_store_result(connection); if (result) { printf( Return set: columns=%d, rows=%d \n, mysql_field_count(connection), mysql_num_rows(result)); mysql_free_result(result); } else { printf(%s\n, mysql_error(connection)); return 1; } mysql_close(connection); printf(%s\n,Done.); } Regards Andy On Tue, 2005-01-11 at 14:57 +0100, Jose Miguel Pérez wrote: Hi Andy, state = mysql_query(connection, SELECT * from mytable); *** ^^ if( state ) { printf(mysql_error(connection)); return 1; } else { printf(Everything Cool with the query\n); } // New code, retrieve resultset. result = mysql_store_result(connection); if (result) { printf( Return set: columns=%d, rows=%d \n, mysql_field_count(connection), mysql_num_rows(result)); mysql_free_result(__result); } else { printf(%s\n, mysql_error(connection)); return 1; } // New code - mysql_close(connection); printf(Done.\n); After doing a SELECT statement you should issue a mysql_store_result / mysql_use_result operation to flush the resultset returned (even an empty resultset). In fact, you should flush the resultset stream with every SQL statement that returns data like SELECT, SHOW, DESCRIBE, and the like. See the manual page on mysql_store_result for more information. Once in there, you can follow the directions about section 21.2.3.20 mysql_field_count() about using mysql_field_count to check in you need to flush the resultset. Do not forget to call mysql_free_result to free the memory allocated for the returned resultset. Hope this helps, maybe mysql_close(...) got confused by pending data from the server. One note though, you should NEVER use 'printf(whatever);' use 'printf(%s, whatever);' instead. If it happends to be some % inside whatever you will get coredumps. For instance, see what happends when in your program, mysql_error(connection) returns Please use %d to display integers. (Not a real MySQL error, obviously!! :-) Cheers, Jose Miguel. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: c program Bus Error (core dumped)
I have a slight variation on that for my Solaris 2.8 machine... g++ -m64 -o check check.cpp -L/usr/local/mysql/lib -L/usr/local/lib/sparcv9/ -lmysqlclient -lsocket -lnsl -lm // this part works fine When running 'check' I get ... check ld.so.1: ./check: fatal: libstdc++.so.5: open failed: No such file or directory Killed ... even though libstdc++.so.5 is symlinked to libstdc++.so.5.0.2 in /usr/local/lib/sparcv9 My apologies for keeping on bothering you!! Regards Andy On Tue, 2005-01-11 at 16:53 +0100, Jose Miguel Pérez wrote: Hi Andy! but I still get the Bus Error message with the following code... int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; int state; int PORTNUM = 3306; [...] Andy, I have copied and pasted your code into a fresh new check.cpp file and it worked for me (obviously changing the user and password data from the connection string). I am using Linux Red Hat 9.0 with 2.6.8 Kernel. This is what I used to compile: g++ -O3 -c -o check.o check.cpp g++ -o check ppp.o -lmysqlclient_r -lz It worked fine, maybe you should try to compile with debug options and give gdb a try. Cheers, Jose Miguel. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: c program Bus Error (core dumped)
After compiling with the options (as suggested by Jose Miguel Pérez) g++ -m64 -o check check.cpp -L/usr/local/mysql/lib -L/usr/local/lib/sparcv9 -L/usr/lib -lmysqlclient -lsocket -lnsl -lm ... and getting the subsequent error when running the compiled binary 'check'... ld.so.1: ./check: fatal: libstdc++.so.5: open failed: No such file or directory Killed ... I put /usr/local/lib/sparcv9 in my LD_LIBRARY_PATH and recompiled. I now get ... Everything Cool with the connection Bus Error (core dumped) Sound familiar!! Does anyone have any ideas why I might be seeing this? This is a 64bit kernel Solaris 2.8 Sunfire V120. I'm thinking it may be an architecture thing!! Thanks Andy On Tue, 2005-01-11 at 15:29 +, Andy Ford wrote: I can get something working however. int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; char *serverInfo=; int state; int PORTNUM = 3306; unsigned long int version; mysql_init(mysql); connection = mysql_real_connect(mysql, localhost, username, password, mydb, PORTNUM, NULL, 0); /* check for a connection error */ if( connection == NULL ) { /* print the error message */ printf(%s\n,mysql_error(mysql)); return 1; } else { printf(%s\n,Everything Cool with the connection); } printf(version = %ul\n, mysql_get_server_version(mysql)); mysql_close(connection); printf(%s\n,Done.); } ... prints out ... Everything Cool with the connection version = 40107l Done. ... but that is as far as I can go until I can fix the Bus Error Regards Andy On Tue, 2005-01-11 at 14:19 +, Andy Ford wrote: Thanks Jose ... but I still get the Bus Error message with the following code... int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; int state; int PORTNUM = 3306; mysql_init(mysql); connection = mysql_real_connect(mysql, localhost, root, 0sg0sb4Ig, oui, PORTNUM, NULL, 0); if( connection == NULL ) { printf(%s\n,mysql_error(mysql)); return 1; } else { printf(%s\n,Everything Cool with the connection); } state = mysql_query(connection, SELECT sysName from inv_device); result = mysql_store_result(connection); if (result) { printf( Return set: columns=%d, rows=%d \n, mysql_field_count(connection), mysql_num_rows(result)); mysql_free_result(result); } else { printf(%s\n, mysql_error(connection)); return 1; } mysql_close(connection); printf(%s\n,Done.); } Regards Andy On Tue, 2005-01-11 at 14:57 +0100, Jose Miguel Pérez wrote: Hi Andy, state = mysql_query(connection, SELECT * from mytable); *** ^^ if( state ) { printf(mysql_error(connection)); return 1; } else { printf(Everything Cool with the query\n); } // New code, retrieve resultset. result = mysql_store_result(connection); if (result) { printf( Return set: columns=%d, rows=%d \n, mysql_field_count(connection), mysql_num_rows(result)); mysql_free_result(__result); } else { printf(%s\n, mysql_error(connection)); return 1; } // New code - mysql_close(connection); printf(Done.\n); After doing a SELECT statement you should issue a mysql_store_result / mysql_use_result operation to flush the resultset returned (even an empty resultset). In fact, you should flush the resultset stream with every SQL statement that returns data like SELECT, SHOW, DESCRIBE, and the like. See the manual page on mysql_store_result for more information. Once in there, you can follow the directions about section 21.2.3.20 mysql_field_count() about using mysql_field_count to check in you need to flush the resultset. Do not forget to call mysql_free_result to free the memory allocated for the returned resultset. Hope this helps, maybe mysql_close(...) got confused by pending data from the server. One note though, you should NEVER use 'printf(whatever);' use 'printf(%s, whatever);' instead. If it happends to be some % inside whatever you will get coredumps. For instance, see what happends when in your program, mysql_error(connection) returns Please use %d to display integers. (Not a real MySQL error, obviously!! :-) Cheers, Jose Miguel. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only
SOLVED (at last) Re: c program Bus Error (core dumped)
It was mentioned by the two people cc'd in this mail that the mixture of a 64bit mysqld and libraries with a 32-bit gcc/g++ was not a good idea. How right they were!! I have just installed the latest 4.1.8 32-bit Solaris 2.8 binary and it all works wonderfully. Thanks for all of your help Andy On Tue, 2005-01-11 at 16:10 +, Andy Ford wrote: I have a slight variation on that for my Solaris 2.8 machine... g++ -m64 -o check check.cpp -L/usr/local/mysql/lib -L/usr/local/lib/sparcv9/ -lmysqlclient -lsocket -lnsl -lm // this part works fine When running 'check' I get ... check ld.so.1: ./check: fatal: libstdc++.so.5: open failed: No such file or directory Killed ... even though libstdc++.so.5 is symlinked to libstdc++.so.5.0.2 in /usr/local/lib/sparcv9 My apologies for keeping on bothering you!! Regards Andy On Tue, 2005-01-11 at 16:53 +0100, Jose Miguel Pérez wrote: Hi Andy! but I still get the Bus Error message with the following code... int main(char **args) { MYSQL_RES *result; MYSQL_ROW row; MYSQL *connection, mysql; int state; int PORTNUM = 3306; [...] Andy, I have copied and pasted your code into a fresh new check.cpp file and it worked for me (obviously changing the user and password data from the connection string). I am using Linux Red Hat 9.0 with 2.6.8 Kernel. This is what I used to compile: g++ -O3 -c -o check.o check.cpp g++ -o check ppp.o -lmysqlclient_r -lz It worked fine, maybe you should try to compile with debug options and give gdb a try. Cheers, Jose Miguel. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us. -- perl -e print qq^bIG VeRN ! ^^qq^#'#Yv#=D+ ^ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Removing Entries From a MySQL Table
Or simply, Delete from table_name; Andy -Original Message- From: Sommerfield, Thomas P [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED]; MySQL Mailing List [EMAIL PROTECTED] Sent: Tue Jul 20 22:16:14 2004 Subject: RE: Removing Entries From a MySQL Table Hello; DELETE FROM table_name WHERE 1 ; This command will remove all rows from the table. For more information, see: http://dev.mysql.com/doc/mysql/en/DELETE.html Make sure you have a backup if you think you may need the data in the future. -Tom -Original Message- From: Michael Mason [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 20, 2004 2:47 PM To: 'MySQL Mailing List' Subject: Removing Entries From a MySQL Table I've been looking through the manual and searching the web for the command and syntax used to do the above. I basically just want to clear a table I use for logon entries. Can anyone help with this please.? Michael Mason Business Support Services ArrasR People Tel: 01706 342310 Mobile: 07793 782287 Fax: 01706 642754 Member of the Recruitment Employment Confederation (00052055) The views expressed in this mail are entirely those of the sender, and do not necessarily represent the views or position of Arras Services Ltd. The information contained in this communication is confidential and may be legally privileged. It is intended solely for the use of the individual or entity to whom it is addressed and others authorised to receive it. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in relation to the contents of this information is strictly prohibited and may be unlawful. Neither the sender nor the represented institution is liable for the correct and complete transmission of the contents of this e-mail, or for its timely receipt. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] This e-mail is private and may be confidential and is for the intended recipient only. If misdirected, please notify us by telephone and confirm that it has been deleted from your system and any copies destroyed. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We use reasonable endeavours to virus scan all e-mails leaving the Company but no warranty is given that this e-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor e-mail communications through our network is reserved by us.
Re: Hash Index
A hash is a key value pair i.e. if you want a value for a unique key (in perl anyway) you can do this... %status = ( 1 = true, 0 = false ); If I have a variable that hold an integer such as $test = 1 I can do the following. if($status{$test} eq true) { do something } I have passed the variable $test as a key to the hash %status, and it has returned a value for that unique key. It's very similar in mySQL I come from a C background and now working extensively in Perl - this is a very powerful feature. Hope this helps Andy On Thu, 2004-05-06 at 23:01, Lou Olsten wrote: This one is more curiosity than a problem. I have read the docs about HASH indexes and how they are used, but I'm just wholly unfamiliar with WHAT a HASH index is. I'm only familiar with the term 'hash' as it relates to encryption. What exactly IS a hash index? Just curious, Lou -- perl -e 'print qq^;@) [###]^^qq^z\.MY{eLQ9^' in:control developer, Telindus, RG27 9HY DDI: +44 1256 709211, GSM: +44 7810 636652 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
table locking using perl DBI
I have a perl cgi script that needs to lock the tables. Unfortunately, as HTTP is a one shot protocol, once the cgi script completes execution, the tables are unlocked. I need it to stay locked until another cgi script unlocks them! Is there any other way of achieving this!? Thanks Andy -- perl -e 'print qq^;@) [###]^^qq^z\.MY{eLQ9^' in:control developer, Telindus, RG27 9HY DDI: +44 1256 709211, GSM: +44 7810 636652 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
update if insert fails
Hi Is there such a statement where, if the insert fails (due to a duplicate record) an update will happen Thanks Andy -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Replication between different database names
I have a central mysql server that is required to be a slave to many different master databases on my customer sites. Is it possible to replicate many masters to one slave where the masters have the same DB name?? i.e. do this . customer A central site DB = cust --- replicate to - DB = cust_A customer B central site DB = cust replicate to - DB = cust_B etc etc Thanks Andy -- perl -e 'print qq^;@) [###]^^qq^z\.MY{eLQ9^' in:control developer, Telindus, RG27 9HY DDI: +44 1256 709211, GSM: +44 7810 636652 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Replication between different database names
I've no idea!! My apologies for the blank response I am rather new to replication and still trying to discover what I actually need to do. I have managed to get two databases with the same name across two different servers replicating correctly. When I change the name on the slave however, replications seems to stop. Is the option --replicate-rewrite-db=from_name-to_name used as a mysqld startup option!? or can I use a command from within mysql or the my.cnf file to achieve the same thing!? Thanks for replying Andy On Fri, 2004-04-02 at 12:49, Jonas Lindén wrote: Hello, Is this what you are lookin for? --replicate-rewrite-db=from_name-to_name Regards /Jonas I have a central mysql server that is required to be a slave to many different master databases on my customer sites. Is it possible to replicate many masters to one slave where the masters have the same DB name?? i.e. do this . customer Acentral site DB = cust --- replicate to - DB = cust_A customer B central site DB = cust replicate to - DB = cust_B etc etc Thanks Andy -- perl -e 'print qq^;@) [###]^^qq^z\.MY{eLQ9^' in:control developer, Telindus, RG27 9HY DDI: +44 1256 709211, GSM: +44 7810 636652 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- perl -e 'print qq^;@) [###]^^qq^z\.MY{eLQ9^' in:control developer, Telindus, RG27 9HY DDI: +44 1256 709211, GSM: +44 7810 636652 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Replication between different database names
I guess what I'm trying to ask is . is it possible for a MySQL server to be a slave to many MySQL masters? And can all of this information go into one my.cnf file so on startup the masters will all start syncing their data to the one slave Thanks Andy On Fri, 2004-04-02 at 12:49, Jonas Lindén wrote: Hello, Is this what you are lookin for? --replicate-rewrite-db=from_name-to_name Regards /Jonas I have a central mysql server that is required to be a slave to many different master databases on my customer sites. Is it possible to replicate many masters to one slave where the masters have the same DB name?? i.e. do this . customer Acentral site DB = cust --- replicate to - DB = cust_A customer B central site DB = cust replicate to - DB = cust_B etc etc Thanks Andy -- perl -e 'print qq^;@) [###]^^qq^z\.MY{eLQ9^' in:control developer, Telindus, RG27 9HY DDI: +44 1256 709211, GSM: +44 7810 636652 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- perl -e 'print qq^;@) [###]^^qq^z\.MY{eLQ9^' in:control developer, Telindus, RG27 9HY DDI: +44 1256 709211, GSM: +44 7810 636652 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: How do I determine the row number or key when table has no key fields
I thought LIMIT limited you to N number of CONCURRENT record. ie. limit 10 or limit 20 I believe Ross would like to select select 1000 records and then do a sub select of records 1-20 and then 21-40 on this record set Or am I barking up the wrong tree? Andy On Fri, 2004-04-02 at 14:05, Andy Eastham wrote: Ross, You'll need to do an order by on both columns (so you'll need to index both columns in a compound index), then use the LIMIT keyword which is designed for exactly this job. Alternatively, unload the data using mysqldump, then edit the table definition to have an autoincrement column, then reload the data. Find more information in the manual at http://www.mysql.com/doc/en/index.html Andy -Original Message- From: Ross Honniball [mailto:[EMAIL PROTECTED] Sent: 02 April 2004 13:48 To: [EMAIL PROTECTED] Subject: How do I determine the row number or key when table has no key fields eg. say a table is created using: create table fred (f1 char(10), f2 int) Then it has neither keys nor an AUTO_INCREMENT field. Let's say 1000,000 records are then inserted into table fred. I then say 'select * from fred' and loop through results writing to a web page. I stop writing to the web page after say 20 records. The user hits 'next page'. I want to say 'select * from fred where ?field? ?value? Where ?field? and ?value? are what I want to know. Surely there is some kind of 'record number' or something available in mySQL for me to : 1. Retrieve and save 2. Query against I'm new to this mailing list. Apologies if I am asking this question of an inappropriate email address. Regards ... Ross . Ross Honniball JCU Bookshop Cairns Supervisor . James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia . Ph:07.4042.1157 Fx:07.4042.1158 Em:[EMAIL PROTECTED] . There are no problems. Only solutions. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- perl -e 'print qq^;@) [###]^^qq^z\.MY{eLQ9^' in:control developer, Telindus, RG27 9HY DDI: +44 1256 709211, GSM: +44 7810 636652 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]