- Vendor
- Server
- PortNumber
- AuthType
- DriverType
Why do I receive an "The Network Adapter could not establish the connection” error message when connecting to Oracle 11g using JDBC 64-bit drivers in Database Toolbox R2017b?
8 views (last 30 days)
Show older comments
MathWorks Support Team
on 30 Nov 2017
Answered: MathWorks Support Team
on 30 Nov 2017
I am trying to connect to Oracle Database using the following settings-
conn_string=['jdbc:oracle:thin:@',...
'(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)',...
'(HOST = nj******n.***.***)(PORT = 1521)))',...
'(CONNECT_DATA =(SERVICE_NAME = PEWS)))'];
setdbprefs('DataReturnFormat','cellarray');
conn = database('','****','***','Vendor','Oracle', 'URL',conn_string);
The connection is unsuccessful and I get the following error message-
'IO Error: The Network Adapter could not establish the connection'
I am able to connect to same Oracle Database from a sample Java application.
But it will always error out while trying to connect from MATLAB.
How to fix this?
Accepted Answer
MathWorks Support Team
on 30 Nov 2017
This error means that at least one of the parameters to the 'database' in incorrect.
Make sure that you are using correct values and are following the right syntax.
In your case, you are using URL as a name-value pair, which is wrong.
For JDBC connection, the possible name-value pair options are-
I order to use the URL, use the following syntax-
conn = database(<https://www.mathworks.com/help/database/ug/database.html?searchHighlight=database&s_tid=doc_srchtitle#inputarg_datasource datasource>,<https://www.mathworks.com/help/database/ug/database.html?searchHighlight=database&s_tid=doc_srchtitle#inputarg_username username>,<https://www.mathworks.com/help/database/ug/database.html?searchHighlight=database&s_tid=doc_srchtitle#inputarg_password password>,<https://www.mathworks.com/help/database/ug/database.html?searchHighlight=database&s_tid=doc_srchtitle#inputarg_driver driver>,<https://www.mathworks.com/help/database/ug/database.html?searchHighlight=database&s_tid=doc_srchtitle#inputarg_url url>)
0 Comments
More Answers (0)
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!