Re: using libmysqld - can't connect to remote DB as client.
On that page, it says: You can't connect to the embedded server from an outside process with sockets or TCP/IP. ... not the other way around, which is what I'm trying to do. I'm trying to connect to another (remote) server from the same app as is using an embedded server. It doesn't say anything about the client-side TCP being disabled in the mysqld lib, just the server-side. This is still unclear to me since they specificially went out of their way to mention that the server-side TCP stuff was diabled, am I to just assume that the client-side stuff is also disabled? - Steve --- Paul DuBois [EMAIL PROTECTED] wrote: At 11:09 -0800 11/6/02, Steven Webb wrote: I'm using libmysqld so I can have an embedded mysql server in my application. It helps with performance because there is not socket communication and all I/O is done from the program directly to the files. Anyway, I have the need to also connect to a remote database in the same application. My code works fine with the local embedded mysql server, I can connect to the local server, create a database and manipulate the data, but when I try to connect to a remote database, it fails. The C function that I'm using is mysql_real_connect. The mysql_connect that you're talking about is just a wrapper function that I wrote. The mysql_real_connect() is down further in the code. Did you get my code? I sent it to the list, but the list bounced it because the list didn't allow attachments. Anyway, According to the docs for the mysqld library (http://www.mysql.com/documentation/mysql/bychapter/manual_Clients.html#libmysqld) There is nothing that says that the mysql_real_connect should work any differently than the one in the normal library. Nothing there, perhaps. But the general description of the embedded server points out that it does no networking. You cannot use an embedded app to connect to remote servers, nor can external clients connect to the embedded server. (This is one reason the manual says embedded servers can't be used in replication.) So, I'm thinking that either the documentation is incorrect (mysql_real_connect *DOESN'T* include any socket-level capability in the mysqld lib like it does in the normal library) or I'm just doing something wrong when I try to connect to a remote database with mysql_real_connect. The man page for mysql_real_connect is here: http://www.mysql.com/documentation/mysql/bychapter/manual_Clients.html#mysql_real_connect - Steve - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: using libmysqld - can't connect to remote DB as client.
I'm using libmysqld so I can have an embedded mysql server in my application. It helps with performance because there is not socket communication and all I/O is done from the program directly to the files. Anyway, I have the need to also connect to a remote database in the same application. My code works fine with the local embedded mysql server, I can connect to the local server, create a database and manipulate the data, but when I try to connect to a remote database, it fails. The C function that I'm using is mysql_real_connect. The mysql_connect that you're talking about is just a wrapper function that I wrote. The mysql_real_connect() is down further in the code. Did you get my code? I sent it to the list, but the list bounced it because the list didn't allow attachments. Anyway, According to the docs for the mysqld library (http://www.mysql.com/documentation/mysql/bychapter/manual_Clients.html#libmysqld) There is nothing that says that the mysql_real_connect should work any differently than the one in the normal library. So, I'm thinking that either the documentation is incorrect (mysql_real_connect *DOESN'T* include any socket-level capability in the mysqld lib like it does in the normal library) or I'm just doing something wrong when I try to connect to a remote database with mysql_real_connect. The man page for mysql_real_connect is here: http://www.mysql.com/documentation/mysql/bychapter/manual_Clients.html#mysql_real_connect - Steve --- Bernhard_Döbler [EMAIL PROTECTED] wrote: Have you looked thru the source to see if there are differences in the libmysql and libmysqld implementation of mysql_connect()? If mysql_connect does not work then you must see in the source why. Why do you link against libmysqld when you nee libmysql functionality? Bernhard - Original Message - From: Steven Webb [EMAIL PROTECTED] To: Mysql list [EMAIL PROTECTED] Sent: Tuesday, November 05, 2002 8:19 PM Subject: Re: using libmysqld - can't connect to remote DB as client. Still nobody has answered my question. Has anyone here even tried linking with libmysqld.a before? - Steve --- Steven Webb [EMAIL PROTECTED] wrote: Nobody answered my question, so I felt like I should ask again ... I'm using libmysqld to embed a mysql server in my C app. However, I'd also like to connect to other remote mysql databases as well, but the mysql_real_connect command doesn't seem to be working when trying to connect to a remote database in the same app as the libmysqld stuff. The connect works, but I think that it's connecting to my local database and not the remote one. Here's a little code: mysql_server_init(sizeof(server_args) / sizeof(char *), server_args, server_groups); // Here's the embedded database. This works. one = db_connect(NULL); db_do_query(one, CREATE DATABASE my_blah_database); mysql_close(one); one = db_connect(my_blah_database); db_do_query(one, create table blank (num int)); mysql_close(one); /* This must be called after all other mysql functions */ mysql_server_end(); // Here's the remote connection - it connects to the same local machine, not the remote machine. two = db_remote_connect (remote_machine,remote,remote,dbname); db_do_query(two, SHOW DATABASES); Has anyone tried this. I'm using the 4.0.4 beta source tree. __ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http
RE: using libmysqld - can't connect to remote DB as client.
From the mysql docs on the website (URL: http://www.mysql.com/documentation/mysql/bychapter/manual_Clients.html#mysql_real_connect) The proto is: MYSQL *mysql_real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned int client_flag); I'm calling it as: mysql_real_connect(db, host, user, passwd, dbname, 0, NULL, CLIENT_COMPRESS); That should work, yes? My code is almost the exact same as the libmysqld example source here (http://www.mysql.com/documentation/mysql/bychapter/manual_Clients.html#libmysqld_example) except after making the local connection, I try a remote connection afterwards. I can send code to anyone if they want, but the mailing list bounced my attachment when I tried to send the code to the list. - Steve - Steve --- Luc Foisy [EMAIL PROTECTED] wrote: not sure if this applies here, its from the c++ api docs (but why switch it around) Do you have the parameters sent in the right order? // The full format for the Connection constructor is // Connection(cchar *db, cchar *host=, //cchar *user=, cchar *passwd=) I really know nothing about the c, c++ api's, just trying to help -Original Message- From: Steven Webb [mailto:scumola;yahoo.com] Sent: Tuesday, November 05, 2002 3:58 PM To: Black, Kelly W [PCS]; Mysql list Subject: RE: using libmysqld - can't connect to remote DB as client. I am. See the original post: // Here's the remote connection - it connects to the same local machine, not the remote machine. two = db_remote_connect (remote_machine,remote,remote,dbname); db_do_query(two, SHOW DATABASES); --- Black, Kelly W [PCS] [EMAIL PROTECTED] wrote: So use the C syntx instead. :) -Original Message- From: Steven Webb [mailto:scumola;yahoo.com] Sent: Tuesday, November 05, 2002 12:21 PM To: Black, Kelly W [PCS]; Mysql list Subject: RE: using libmysqld - can't connect to remote DB as client. Ok, but I'm writing this in C, not perl. - Steve --- Black, Kelly W [PCS] [EMAIL PROTECTED] wrote: I think your problem might be here - you have db_connect(my_blah_database); Try using something like my $dbh = DBI-connect(DBI:mysql:$dbname:hostname, $dbuser, $dbpasswd) || die can't connect: $DBI::errstr\n; Also make sure you include the || die can't connect: $DBI::errstr\n; as in this way you can get some useful error output about the connect. Not certain but at least I am trying to help :) Oh and don't forget sql query! :) ~Kelly W. Black -Original Message- From: Steven Webb [mailto:scumola;yahoo.com] Sent: Tuesday, November 05, 2002 11:20 AM To: Mysql list Subject: Re: using libmysqld - can't connect to remote DB as client. Still nobody has answered my question. Has anyone here even tried linking with libmysqld.a before? - Steve --- Steven Webb [EMAIL PROTECTED] wrote: Nobody answered my question, so I felt like I should ask again ... I'm using libmysqld to embed a mysql server in my C app. However, I'd also like to connect to other remote mysql databases as well, but the mysql_real_connect command doesn't seem to be working when trying to connect to a remote database in the same app as the libmysqld stuff. The connect works, but I think that it's connecting to my local database and not the remote one. Here's a little code: mysql_server_init(sizeof(server_args) / sizeof(char *), server_args, server_groups); // Here's the embedded database. This works. one = db_connect(NULL); db_do_query(one, CREATE DATABASE my_blah_database); mysql_close(one); one = db_connect(my_blah_database); db_do_query(one, create table blank (num int)); mysql_close(one); /* This must be called after all other mysql functions */ mysql_server_end(); // Here's the remote connection - it connects to the same local machine, not the remote machine. two = db_remote_connect (remote_machine,remote,remote,dbname); db_do_query(two, SHOW DATABASES); - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs
Re: using libmysqld - can't connect to remote DB as client.
Still nobody has answered my question. Has anyone here even tried linking with libmysqld.a before? - Steve --- Steven Webb [EMAIL PROTECTED] wrote: Nobody answered my question, so I felt like I should ask again ... I'm using libmysqld to embed a mysql server in my C app. However, I'd also like to connect to other remote mysql databases as well, but the mysql_real_connect command doesn't seem to be working when trying to connect to a remote database in the same app as the libmysqld stuff. The connect works, but I think that it's connecting to my local database and not the remote one. Here's a little code: mysql_server_init(sizeof(server_args) / sizeof(char *), server_args, server_groups); // Here's the embedded database. This works. one = db_connect(NULL); db_do_query(one, CREATE DATABASE my_blah_database); mysql_close(one); one = db_connect(my_blah_database); db_do_query(one, create table blank (num int)); mysql_close(one); /* This must be called after all other mysql functions */ mysql_server_end(); // Here's the remote connection - it connects to the same local machine, not the remote machine. two = db_remote_connect (remote_machine,remote,remote,dbname); db_do_query(two, SHOW DATABASES); Has anyone tried this. I'm using the 4.0.4 beta source tree. __ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: using libmysqld - can't connect to remote DB as client.
Ok, but I'm writing this in C, not perl. - Steve --- Black, Kelly W [PCS] [EMAIL PROTECTED] wrote: I think your problem might be here - you have db_connect(my_blah_database); Try using something like my $dbh = DBI-connect(DBI:mysql:$dbname:hostname, $dbuser, $dbpasswd) || die can't connect: $DBI::errstr\n; Also make sure you include the || die can't connect: $DBI::errstr\n; as in this way you can get some useful error output about the connect. Not certain but at least I am trying to help :) Oh and don't forget sql query! :) ~Kelly W. Black -Original Message- From: Steven Webb [mailto:scumola;yahoo.com] Sent: Tuesday, November 05, 2002 11:20 AM To: Mysql list Subject: Re: using libmysqld - can't connect to remote DB as client. Still nobody has answered my question. Has anyone here even tried linking with libmysqld.a before? - Steve --- Steven Webb [EMAIL PROTECTED] wrote: Nobody answered my question, so I felt like I should ask again ... I'm using libmysqld to embed a mysql server in my C app. However, I'd also like to connect to other remote mysql databases as well, but the mysql_real_connect command doesn't seem to be working when trying to connect to a remote database in the same app as the libmysqld stuff. The connect works, but I think that it's connecting to my local database and not the remote one. Here's a little code: mysql_server_init(sizeof(server_args) / sizeof(char *), server_args, server_groups); // Here's the embedded database. This works. one = db_connect(NULL); db_do_query(one, CREATE DATABASE my_blah_database); mysql_close(one); one = db_connect(my_blah_database); db_do_query(one, create table blank (num int)); mysql_close(one); /* This must be called after all other mysql functions */ mysql_server_end(); // Here's the remote connection - it connects to the same local machine, not the remote machine. two = db_remote_connect (remote_machine,remote,remote,dbname); db_do_query(two, SHOW DATABASES); Has anyone tried this. I'm using the 4.0.4 beta source tree. __ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: using libmysqld - can't connect to remote DB as client.
I am. See the original post: // Here's the remote connection - it connects to the same local machine, not the remote machine. two = db_remote_connect (remote_machine,remote,remote,dbname); db_do_query(two, SHOW DATABASES); --- Black, Kelly W [PCS] [EMAIL PROTECTED] wrote: So use the C syntx instead. :) -Original Message- From: Steven Webb [mailto:scumola;yahoo.com] Sent: Tuesday, November 05, 2002 12:21 PM To: Black, Kelly W [PCS]; Mysql list Subject: RE: using libmysqld - can't connect to remote DB as client. Ok, but I'm writing this in C, not perl. - Steve --- Black, Kelly W [PCS] [EMAIL PROTECTED] wrote: I think your problem might be here - you have db_connect(my_blah_database); Try using something like my $dbh = DBI-connect(DBI:mysql:$dbname:hostname, $dbuser, $dbpasswd) || die can't connect: $DBI::errstr\n; Also make sure you include the || die can't connect: $DBI::errstr\n; as in this way you can get some useful error output about the connect. Not certain but at least I am trying to help :) Oh and don't forget sql query! :) ~Kelly W. Black -Original Message- From: Steven Webb [mailto:scumola;yahoo.com] Sent: Tuesday, November 05, 2002 11:20 AM To: Mysql list Subject: Re: using libmysqld - can't connect to remote DB as client. Still nobody has answered my question. Has anyone here even tried linking with libmysqld.a before? - Steve --- Steven Webb [EMAIL PROTECTED] wrote: Nobody answered my question, so I felt like I should ask again ... I'm using libmysqld to embed a mysql server in my C app. However, I'd also like to connect to other remote mysql databases as well, but the mysql_real_connect command doesn't seem to be working when trying to connect to a remote database in the same app as the libmysqld stuff. The connect works, but I think that it's connecting to my local database and not the remote one. Here's a little code: mysql_server_init(sizeof(server_args) / sizeof(char *), server_args, server_groups); // Here's the embedded database. This works. one = db_connect(NULL); db_do_query(one, CREATE DATABASE my_blah_database); mysql_close(one); one = db_connect(my_blah_database); db_do_query(one, create table blank (num int)); mysql_close(one); /* This must be called after all other mysql functions */ mysql_server_end(); // Here's the remote connection - it connects to the same local machine, not the remote machine. two = db_remote_connect (remote_machine,remote,remote,dbname); db_do_query(two, SHOW DATABASES); Has anyone tried this. I'm using the 4.0.4 beta source tree. __ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php __ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED
using libmysqld - can't connect to remote DB as client.
Nobody answered my question, so I felt like I should ask again ... I'm using libmysqld to embed a mysql server in my C app. However, I'd also like to connect to other remote mysql databases as well, but the mysql_real_connect command doesn't seem to be working when trying to connect to a remote database in the same app as the libmysqld stuff. The connect works, but I think that it's connecting to my local database and not the remote one. Here's a little code: mysql_server_init(sizeof(server_args) / sizeof(char *), server_args, server_groups); // Here's the embedded database. This works. one = db_connect(NULL); db_do_query(one, CREATE DATABASE my_blah_database); mysql_close(one); one = db_connect(my_blah_database); db_do_query(one, create table blank (num int)); mysql_close(one); /* This must be called after all other mysql functions */ mysql_server_end(); // Here's the remote connection - it connects to the same local machine, not the remote machine. two = db_remote_connect (remote_machine,remote,remote,dbname); db_do_query(two, SHOW DATABASES); Has anyone tried this. I'm using the 4.0.4 beta source tree. __ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
using libmysqld, can I still connect to a remote DB as a client in the same app?
I'm writing an application that maintains its own database using the mysqld lib. I can use mysql_real_connect to connect to the internal server fine, but I also want to be able to connect to an external (or remote) server as well. When using mysql_real_connect to try to connect to a remote server, I get database not found on server. I think that since it's returning faster than it does when just connecting using the main mysql client app, that it's probably checking the internel server although I'm specifying a host, user, password, ... when trying to connect to the remote machine. I'm using the 4.0.4 beta source. - Steve __ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Using the embedded mysql server - how do I create a database on the fly?
Hello. I'm just getting started with the embedded mysql server and I'm not trying to do anything fancy. I just want to initialize the server and call mysql_create_db and have the database get created and then start using it. I've modified the basic embedded server example as follows: mysql_server_init(sizeof(server_args) / sizeof(char *), server_args, server_groups); if(mysql_create_db(one, my_database)) { fprintf(stderr, Failed to create new database. Error: %s\n, mysql_error(one)); } one = db_connect(my_database); two = db_connect(NULL); db_do_query(one, SHOW TABLE STATUS); db_do_query(two, SHOW DATABASES); mysql_close(two); mysql_close(one); I get a test_mysqld.c:53: warning: implicit declaration of function `mysql_create_db' when compiling and then I get a Seg Fault when it is ran. What am I doing wrong? - Steve __ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php