DB = '***';
user = '***';
password = '***';
vendor = 'Oracle';
dbConnStr = ['jdbc:oracle:thin:@(DESCRIPTION=' ...
'(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=***)' ...
'(PORT=1521))(ADDRESS=(PROTOCOL=TCP)' ...
'(HOST=***)(PORT=1521)))'...
'(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCP)'...
'(INSTANCE_NAME=MULTITGP)))'];
jdbcDriverPath = fullfile('jdbc_driver','ojdbc6.jar');
if ~ismember(fullfile(matlabroot,'java','jar',jdbcDriverPath),...
javaclasspath('-static'))...
&& ~ismember(fullfile(pwd,jdbcDriverPath),...
javaclasspath('-dynamic'))
javaaddpath(jdbcDriverPath);
end
conn = database(DB,user,password,...
'Vendor',vendor,...
'URL',dbConnStr);
if isopen(conn)
msgbox('Connection OK');
close(conn);
else
msgbox('Connection FAIL')
end
1 Comment
Sharannya Ranjith (view profile)
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/399838-why-does-a-oracle-db-connection-can-not-be-established-with-matlab-2018#comment_567028
Sign in to comment.