Is this a good way to use system () for database scripts from C?

I was looking for a database connection from program C. But I thought that ODBC connections, login and all needed some libraries. I also have a minimal compiler like Tiny C Compiler which is very fast. I do not want to use ODBC logic, etc., which is needed to connect and query the database.

Therefore, I use a method that looks like this.

I am using bteq script (teradata) which will have login, query, logoff commands. (FYI bteq is a command line database utility. You can use it like mysql.exe on the command line by going to the exe path. You can replace bteq with mysql.exe, etc.). And I use

system("bteq <myscript.txt >out.txt");

myscript.txt will look like this.

.logon boxname/user,password;
select date;
.logoff;

script ( script ) out.txt.

out.txt X. fgetc, fscanf fgets. PHP

system("c:/server/php/php.exe sendmail.php");.

, mysql,.. .. C.

: - . , . , , . . , , , .. , system() , . ( ). , , - . - , , . .

: teradata bteq Tiny C Compiler

+5
3

: db , .

- , bteq: bteq script, ; script . , .

+1

, . , , .

+3

, setuid setgid, exec(). ( , , , , man 3 system.)

+1
source

All Articles