In this video it shows the steps to configure the Oracle database in the matlab environment using the database explorer. The it shows how one run a query on the connected database through the database explorer or Matlab commands/ script.
In this video it initially shows the result of connecting to the database through the Windows command prompt using sqlplus command.
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Complete source code and other details:
connection = database("Oracle_Local", "CTXSYS", "CTXSYS");
Query = "select table_name from user_tables fetch first 10 rows only";
data = fetch(connection, Query)
close(conn);
Output:
>> Oracle_Database_Query
data =
10×1 table
TABLE_NAME
___________________________
{'DR$PARAMETER' }
{'DR$CLASS' }
{'DR$OBJECT' }
{'DR$OBJECT_ATTRIBUTE' }
{'DR$OBJECT_ATTRIBUTE_LOV'}
{'DR$PREFERENCE' }
{'DR$PREFERENCE_VALUE' }
{'DR$INDEX' }
{'DR$INDEX_PARTITION' }
{'DR$INDEX_VALUE' }
![](https://programmerworld.co/wp-content/uploads/2022/04/image-65-1024x544.png)
Steps to configure the database using the Explorer App:
![](https://programmerworld.co/wp-content/uploads/2022/04/image-66-1024x581.png)
![](https://programmerworld.co/wp-content/uploads/2022/04/image-67.png)
![](https://programmerworld.co/wp-content/uploads/2022/04/image-68.png)
![](https://programmerworld.co/wp-content/uploads/2022/04/image-69.png)
Configuration saved:
![](https://programmerworld.co/wp-content/uploads/2022/04/image-70.png)
To configure the above using command line, use below command:
conn = database('','CTXSYS','CTXSYS', ... 'Vendor','Oracle', ... 'driver', 'C:\Work\matlab\OracleDatabaseApp\ojdbc14.jar', ... 'URL',['jdbc:oracle:thin:@(DESCRIPTION = ' ... '(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)' ... '(PORT = 1521)) (CONNECT_DATA = ' ... '(SERVER = DEDICATED) (SERVICE_NAME = XE) ) )']);
Connection details and steps also available on:
https://mathworks.com/help/database/ug/oracle-jdbc-windows.html
![](https://programmerworld.co/wp-content/uploads/2022/04/image-71-1024x581.png)
![](https://programmerworld.co/wp-content/uploads/2022/04/image-72.png)
![](https://programmerworld.co/wp-content/uploads/2022/04/image-73.png)
Then choose “Manual” option to enter the query manually and “Preview Query”:
![](https://programmerworld.co/wp-content/uploads/2022/04/image-64-1024x581.png)
JAR File:
https://drive.google.com/drive/folders/1XRSIc-driOh0EkGnLlrJ4M6EZSPLfs6O?usp=sharing
Oracle Database installation steps are available in the below link: