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://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