Matlab Database gives Java exception

3 visualizaciones (últimos 30 días)
Benjamin
Benjamin el 21 de Oct. de 2015
Respondida: Benjamin el 29 de Oct. de 2015
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

Respuesta aceptada

Rahul Goel
Rahul Goel el 26 de Oct. de 2015
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.

Más respuestas (1)

Benjamin
Benjamin el 29 de Oct. de 2015
Thanks! Worked :)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by