Saving a Datasource programmatically
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear Community,
I am currently at the basic level of using MATLAB to solve data analytics problems. This day I have been trying to connect to an Oracle Database in order to access available data tables, load and analyse certain portions of these data tables. I succesfully established a connection to the database as shown below, the connection does exist and is open.
I however have not been able to save this created conection ("DS_Conn") as a Datasource, so I can easily call it up through the datasource option in the Database Explorer Menu. Herewith is my editor code:
% Connect to oracle Database
datasource = 'DDSA_DB'
driver = 'oracle.jdbc.driver.OracleDriver'
url = ['jdbc.roacle.tin:@(DESCRIPTION = '…
'(FAILOVER = ON)(LOAD_BALANCE = OFF)(ADDRESS_LIST ='…
'(ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XX.XX.XXX)(PORT = 1521)))'….
'CONNECT_DATA = SERVICE_NAME = DDSA)))'];
%
username = "XXXXXXX";
password = "xxxxxxxxxxx";
%
DS_Conn = database(datasource,username,password,dirver,url); % Connection established and is open [].
saveAsJDBCDataSource(DS_Conn); % Request fails with error message that "DS_Conn" is unknown.
%
Furthermore, a request to list all tables within the database accessible with my account only generates an error, despite existing database connection.
sql_select = sprintf(selectowner, table_name from all_tables); % error message
I most probably should be missing something, will very much appreciate your hints or any form of assistance.
P.S: Creating a connection using the "Database Explorer App" failed strangely enough, can't identify why.
Thanks
Desa
0 Commenti
Risposte (1)
Sulaymon Eshkabilov
il 4 Lug 2021
The last line in your posted code: saveAsJDBCDataSource() is not MATLAB's builtin fcn unless you have your own or 3rd party fcn file that has to be fixed.
Vedere anche
Categorie
Scopri di più su Database Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!