Thursday 3 May 2012

Matlab Database Connectivity Example code



Databases is collection of structured data .Database actions are data manipulate,data deletion and data insertion. This action we do on Matlab.This action makes use following operational syntax.

1.Create Connection String

Connection String used to connect the database.That syntax as follows

conn_str = database('database_name','username','password','driver','database_url');

Example :

>>conn_str = database('my_db','scott','tiger','oracle.jdbc.driver.OracleDriver','jdbc:oracle:oci7:');

Here we create the connection string on Oracle database.Like you connect different type of  databases.

2.Execute Query String on Database

exec function to execute the query strings on database.Syntax as follows

curs = exec(conn_str, 'sql_query');

Example :

>>curs = exec(conn_str, 'Select * from My_Table');
 above example retrieve the all data's from My_Table.Like you do execute all type of sql queries.

3.Fetch the cursor to a MATLAB variable 

Here we convert the cursor data into matlab variable. example code as below

>>my_data = fetch(curs);

Finally my_data contain all data's of My_Table.

Related Search :  Matlab Database Connectivity Example code, Database connection matlab, Access database connection on matlab, Matlab oracle database connection.

Kindly Bookmark and Share it:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...