Matlab Database gives Java exception
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!