I am having troubles connecting to oracle express db. When i am trying to connect to the database i get the following error:
>> conn = database('test_db','','zxcv','Vendor','Oracle',...
'DriverType','oci','Server','remotehost','PortNumber',
1234)
Error using database (line 309)
Java exception occurred:
java.lang.UnsatisfiedLinkError: no ocijdbc11 in
java.library.path

댓글 수: 10

Rodrigo
Rodrigo 2014년 7월 11일
Paul try this:
conn = database('XE','SYSTEM','password','oracle.jdbc.driver.OracleDriver',jdbc:oracle:thin:@LOCALHOST:1521:XE');
password is the password when you install Oracle XE
RML!
Paul
Paul 2014년 7월 11일
편집: Paul 2014년 7월 11일
thanks for the answer. when i enter this command with my password it gives me the following output
Undefined function or variable 'jdbc'.
Additionally when i check upon the variable "conn" it says:
Error de E/S: The Network Adapter could not establish the connection
When I try to establish the connection via the application i get the following error which would explain the jdbc error before mentioned.
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path
Rodrigo
Rodrigo 2014년 7월 11일
I think that is a sintaxis error...
conn = database('XE','SYSTEM','password','oracle.jdbc.driver.OracleDriver',jdbc:oracle:thin:@localhost:1521:XE);
note now without de ' character at the end of XE
Rodrigo
Rodrigo 2014년 7월 11일
편집: Rodrigo 2014년 7월 11일
do you check the connection with Oracle XE with other app? for example SQL Developer.
Paul
Paul 2014년 7월 11일
yeah i checked the connection with SQL developer and it worked just fine. I will try your other point you mentioned there.
conn = database('XE','SYSTEM','password','oracle.jdbc.driver.OracleDriver','jdbc:oracle:thin:@localhost:1521:XE');
it worked now with the "'" before the jdbc... and after the XE as well "'" as indicated above. The output tells me this
conn =
Instance: 'XE'
UserName: 'SYSTEM'
Driver: 'oracle.jdbc.driver.OracleDriver'
URL: 'jdbc:oracle:thin:@localhost:1521:XE'
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 oracle.jdbc.driver.T4CConnection]
TimeOut: 0
AutoCommit: 'on'
Type: 'Database Object'
does this mean i am connected to the database?
Rodrigo
Rodrigo 2014년 7월 11일
yes,
Creates an example table with sql developer populate and query it from Matlab.
Paul
Paul 2014년 7월 11일
exellent, thanks a bunch
Rodrigo
Rodrigo 2014년 7월 11일
편집: Rodrigo 2014년 7월 11일
you're welcome... So, i'm Rodrigo Muñoz!!! See you my friend!
Paul
Paul 2014년 7월 11일
nice!

댓글을 달려면 로그인하십시오.

 채택된 답변

Sruthi Ayloo
Sruthi Ayloo 2014년 7월 10일

0 개 추천

The usage of database function is as follows:
conn = database('databasename','username','password','oracle.jdbc.driver.OracleDriver',jdbc:oracle:thin:@IP_ADDRESS_OF_DATABASE_SERVER:1521:databasename');
In the Query Builder, the database 'Name' should be the same as the suffix after the port number in the database 'URL', that is, the 'databasename' must be same as the SID parameter at the end of the 'databaseurl'. In your code, the instance parameter should be “dbname”.

댓글 수: 1

Paul
Paul 2014년 7월 10일
First of all, thank you very much for the quick reply Sruthi, I do not know the database name neither the password and i never created one. I only know that i created a password for oracle express database during the installation.

댓글을 달려면 로그인하십시오.

추가 답변 (4개)

Sruthi Ayloo
Sruthi Ayloo 2014년 7월 9일

0 개 추천

The Oracle DLL that the Database drivers need could not be detected in MATLAB. Add the location of the Oracle DLLs path to the following file and restart MATLAB.
$MATLAB/toolbox/local/javalibrarypath.txt.
Paul
Paul 2014년 7월 9일

0 개 추천

i followed your procedure as well as the procedure of mathworks step 3 but the error persists and i dont know why, i even added the .dll file manually in matlab.
my javalibrarypath.txt contains these elements in my case:
C:\oraclexe\app\oracle\product\11.2.0\server\oci\lib C:\oraclexe\app\oracle\product\11.2.0\server\bin\ocijdbc11.dll
Paul
Paul 2014년 7월 10일

0 개 추천

I tried a different connection command now which gives me more details concerning the error. This is how i connect:
conn = database('','username','pwd',...
'Vendor','Oracle',...
'URL',['jdbc:oracle:thin:@(DESCRIPTION = ' ...
'(ADDRESS = (PROTOCOL = TCP)(HOST = sname)' ...
'(PORT = 123456)) (CONNECT_DATA = ' ...
'(SERVER = DEDICATED) (SERVICE_NAME = dbname) ) )']);
nothing shows up afterwards the command, but when i have a look at the variable "conn" it indicates the following
val =
Instance: ''
UserName: 'username'
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: 'Error de E/S: The Network Adapter could not establish the connection'
Handle: 0
TimeOut: 5
AutoCommit: 'off'
Type: 'Database Object'
Any suggestions?
Paul
Paul 2014년 7월 11일

0 개 추천

Question was answered by Rodrigo

카테고리

질문:

2014년 7월 8일

댓글:

2014년 7월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by