matlab won't show text while cennecting to a database
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone,
i have a gui that can check the connection to a mysql database. While the connection is being checked, i want to display a text simply saying 'connection check in progress...'. This text is overwritten depending whether the connection is established or not. The problem is that the gui is like frozen when you click the check-button (the connection check is in progress) and then displays the result, but 'connection check in progress...' is not displayed. The funny thing is that when you enter the gui in debug mode and do the check step by step, the texts are displayed correctly. This is also true if i add a pause before i set the text.
My question is, why the text is not displayed correctly and how i can display it without a pause (i don't want to slow down the program).
Here is an extract from my code:
if portState == 0
set(handles.storedDB,'String','Retrieving Data...');
set(handles.text10,'String',[message,' Connection check in progress... ']);
conn=database(dbName,user,password,'com.mysql.jdbc.Driver',['jdbc:mysql://',dbServerIP,':',port,'/',dbName]);
connstate = isconnection(conn);
message = [message, conn.Message];
if connstate == 1
e = exec(conn,'select user(), database();');
e = fetch(e);
g = exec(conn,'show databases');
g = fetch(g);
set(handles.storedDB,'String',g.data); %update listbox
message = [message,' USER: "',e.Data{1,1},'" on database: "', e.Data{1,2},'"'];
Basically the set handles strings are ignored when running the check.
Thanks for your help!
0 Kommentare
Antworten (1)
David Sanchez
am 10 Dez. 2013
Add a very short pause right AFTER the set line:
...
...
set(handles.text10,'String',[message,' Connection check in progress... ']);
pause(0.001);
...
...
this doesn't slow down the application considerably, and your text will be displayed.
2 Kommentare
Siehe auch
Kategorien
Mehr zu Database Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!