开发者

Can I Use mysql_real_connect to Connect to a Server Without Mentioning the Database Using MySQL/C?

I'm working on a CGI application written using C++ with the C MySQL adapter. I'm trying to ru开发者_运维百科n a query on two databases, so I want to connect to a MySQL server without choosing a default database. Is this possible? I'm using mysql_real_connect().


mysql_real_connect() can take a NULL parameter for the database paramter, and this selects the default. Just ensure that the user has no default database set.


I must be missing the point of your question. Seems to me if you want to use two databases, you only need two MYSQL*, one for each DB, calling mysql_real_connect( ) on each and then proceeding normally from there, referring to one or the other MYSQL* as appropriate. Could that work, or am I completely confused?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜