The aim of this moculde is to add ability for database interaction to Scilab.
After connecting to a database, you can execute queries against it and perform
data exchange between Scilab environment and the database.
Supported database providers: PostgreSQL, Sqlite, MySQL, MSSQL, ODBC, Firebird.
To start work with db, connect to it using one of two versions of DbConnect:
Connection = DbConnect(provider, connectionString)
Connection = DbConnect(connectionStruct)
Possible values: “PSQL”, “SQLITE”, “MYSQL”, “DB2”, “OCI”,
“ODBC”, “SQLITE2”, “TDS”
The fields of the struct are:
The last database, to which connection was established becomes default. This
means, you do not have to provide a Connection object every time with further
queries to DB.
connexionStruct = struct();
connexionStruct.provider = "postgresql";
connexionStruct.database = "myDataBase";
connexionStruct.hostname = "127.0.0.1" ;
connexionStruct.use = "myUsername";
connexionStruct.password = "myPassword";
After connecting, you are able to execute queries and obtain a result handler,
which later can be used to aquire data using functions
resultHandle = DbQuery("SELECT * FROM data_table"); //default
connection is used
results = DbFetchReal(resulthandle); // results is a Scilab matrix
You will find a detailed description in SEP file or in help of the module.