C Access

  • Follow


2 questions:

- How do I access MySql from within a C/C++ program (without invoking 
the unix shell, i.e. without calling "system" or "popen"?
- How do I tell MySql I want my database to be stored in a specific 
location on my file system?
0
Reply lalawawa 6/24/2010 1:40:58 AM

lalawawa wrote:
> 2 questions:
> 
> - How do I access MySql from within a C/C++ program (without invoking 
> the unix shell, i.e. without calling "system" or "popen"?

http://dev.mysql.com/doc/refman/5.5/en/dynindex-cfunction.html

> - How do I tell MySql I want my database to be stored in a specific 
> location on my file system?

http://dev.mysql.com/doc/refman/5.5/en/ha-drbd-install-mysql.html

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
Reply jstucklex (14363) 6/24/2010 3:25:29 AM


>- How do I access MySql from within a C/C++ program (without invoking 
>the unix shell, i.e. without calling "system" or "popen"?

Link with libmysqlclient and code calls using the C or C++ API into
your program.  See the section of the MySQL manual on the programming
APIs.

>- How do I tell MySql I want my database to be stored in a specific 
>location on my file system?

You don't really get fine-grained control over this.  You can set
datadir (in my.cnf) to set the location of the whole tree of
databases.  You can locate an individual (MyISAM) database elsewhere
by replacing a subdirectory of datadir with a symlink to a directory
placed where you want it to go.  (Careful about preserving ownerships
and permissions if you do such a copy, and do it when the server
isn't running.)

0
Reply gordonb 6/24/2010 3:26:51 AM

lalawawa <usenet@ccjj.info> wrote:
>
> - How do I access MySql from within a C/C++ program (without invoking
> the unix shell, i.e. without calling "system" or "popen"?

There is a bunch of "connectors" available to use MySQL from many
programming languages. The C API (also known as libmysqlclient) is
used very often. Connector/C is just a freestanding implementation of
the same. The C++ API is from MySQL^WSun^WOracle, and Connector/C++
is a community project.

http://dev.mysql.com/doc/refman/5.1/en/connectors-apis.html

> - How do I tell MySql I want my database to be stored in a specific
> location on my file system?

The datadir option has been named already. There are also options for
CREATE TABLE to put MyISAM files outside $datadir. And the shared
InnoDB tablespace can also be put outside the $datadir.

http://dev.mysql.com/doc/refman/5.1/en/server-options.html
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html


XL
0
Reply axel.schwenke (487) 6/24/2010 7:11:33 AM

3 Replies
211 Views

(page loaded in 0.101 seconds)

Similiar Articles:













7/8/2012 3:20:30 PM


Reply: