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 +0000, 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 +0000, 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+ ^"
> 
-- 
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]

Reply via email to