Matlab Database gives Java exception

조회 수: 3 (최근 30일)
Benjamin
Benjamin 2015년 10월 21일
답변: Benjamin 2015년 10월 29일
I have used the Matlab Database toolbox for a long time but today it suddenly fails. If I go go Apps>Database Explorer I get the error:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Could not initialize class com.mathworks.toolbox.database.databasePrefs
at com.mathworks.toolbox.database.gui.DatabaseToolstripTab.<init>(DatabaseToolstripTab.java:242)
...
If for example I write
setdbprefs('DataReturnFormat','structure');
I get the error
Error using javaObject
No class com.mathworks.toolbox.database.databasePrefs can be located on the Java class path
Error in setdbprefs (line 58)
DatabasePrefs = javaObject('com.mathworks.toolbox.database.databasePrefs');
If I write
database(server_name,'','','com.microsoft.sqlserver.jdbc.SQLServerDriver', ...
['jdbc:sqlserver://',server_name,':',num2str(port_nr),';database=',database_name,';integratedSecurity=true;']);
I get the error
Error using database (line 309)
Java exception occurred:
java.lang.NoClassDefFoundError: Could not initialize class com.mathworks.toolbox.database.databasePrefs
at com.mathworks.toolbox.database.databaseConnect.makeDatabaseConnection(databaseConnect.java:140)
I have reinstalled Matlab including the Database toolbox and I have reinstalled Java. I have also downloaded the jdbc driver again in case there was some damage to those files. Still it does not work. I do not know of any changes on my computer since yesterday where everything works.
Thanks for any inputs. Benjamin

채택된 답변

Rahul Goel
Rahul Goel 2015년 10월 26일
Hi Benjamin,
You can try the following steps to see if it resolves it:
1. Go to the preference directory by executing the following command in the MATLAB command prompt:
>>winopen(prefdir)
2. Look for the file named 'database', change the name of the file to something different ie: 'database_old'
3. Restart MATLAB and check that the file still have the same name ie: 'database_old'.
Hope this helps.

추가 답변 (1개)

Benjamin
Benjamin 2015년 10월 29일
Thanks! Worked :)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by