elGringo Posted March 22, 2017 Share Posted March 22, 2017 Seems to be not uniGui trouble but not sure exactly Having UniGUI app, MySQL DataBase, FireDAC. When trying to insert Russian symbols on local pc- everything ok. same operation on VPS Asure, having "????????" in spite of normal text. Everything the Same, -UniGUI EXE file -MySQL Server -Database the only difference - my computer and vps computer Doing connection on client like ... oParams.Add('DataBase=someDataBase'); oParams.Add('Password=masterkey'); oParams.Add('User_Name=root'); oParams.Add('Port=3306'); oParams.Add('Server=localhost'); oParams.Add('CharacterSet=utf8'); // <<< ... MySQL is adjusted like character_set_client utf8 character_set_connection utf8 character_set_database utf8 character_set_filesystem binary character_set_results utf8 character_set_server utf8 character_set_system utf8 character_sets_dir C:\Program Files\MySQL\MySQL Server 5.5\share\charsets\ Can't understand that mess. On local server everyting Ok, on vps - "???????" in spite of normal text in Russian. Looking for advice. Thank you! Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 Have you checked your particular database and its tables character_set settings? Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 on VPS (see pics) and Local, my settings have idea to put db on some hosting on the internet and check... Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 if info is written on database import - everything is Ok, but if to write it on vps throgh unigui client - that mess. also if to write to database throgh workbench client - everything is ok - some problem in firedac on unigui - can't understand Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 Have you checked uniGUI->ServerModule->CharSet? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 Does this problem occur when MySQL server is on VPS or when uniGUI server is on VPS? Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 uniGUI->ServerModule->CharSet utf-8 by default I copied both MySQL Server and UniGUI Server to VPS. Now trying to check to connect from UniServer on local computer to database server located on VPS Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 Not copied MySQL, but installed on VPS with the same params Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 Also could be the reason in that on VPS is English Version of Windows Server 2012 and on my computer Russian Version of Win10? I suppose by myself that no, but... Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 What is your version of Delphi? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 Also could be the reason in that on VPS is English Version of Windows Server 2012 and on my computer Russian Version of Win10? I suppose by myself that no, but... As long as your DB is utf-8 it should have no effect. Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 Delphi Seattle As long as your DB is utf-8 it should have no effect. Also thought like that Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 ok, connected from local pc to remote database - successfully inserted record with russian symbols (see pic) what it means? db - ok! some trouble in the app? firedac? unigui? maybe to update uni files on vps? Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 found that I have different versions of runtime lib on VPS and compile version of UniGUI - may be that is the reason Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 Maybe your TFDConnection is not configured properly. Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 That is strange... Updated runtime and compiler to 1.0.0.1376_RC Started program, from local computer everything is Ok, From VPS still '????' about connection, I connect like this - on local pc everything fine. Copying exe to vps and meeting problem function TUniShopDBConnection.Connect: boolean; var oParams:TStrings; ErrorInfo:string; begin //Драйвер << Можно отдельно прописать, если он не в папке с EXE // FDPhysMySQLDriverLink1.VendorLib:='C:\MySQLDriver\libmysql.dll'; // либо положить его в c:\windows\SysWow64\ oParams:=TStringList.Create; try oParams.Add('DataBase=someDataBase'); oParams.Add('Password=*****'); oParams.Add('User_Name=someUser'); oParams.Add('Port=3306'); oParams.Add('Server=localhost'); oParams.Add('CharacterSet=utf8'); // oParams.Add('Pooled=true'); FDConnection.Params.Assign(oParams); FDConnection.DriverName:='MySQL'; // UniServerModule.FDManager.AddConnectionDef('MySQL_Pooled','MySQL',oParams); // FDConnection.ConnectionDefName := 'MySQL_Pooled'; //Пробуем подключиться try FDConnection.Connected:=true; if FDConnection.Connected then begin Result:=true; // showmessage('Connected'); end else Result:=false; except on E: EFDDBEngineException do case E.Kind of ekUserPwdInvalid: // user name or password are incorrect raise Exception.Create('DBConnection Error. User name or password are incorrect'+ #13#10+#13#10+E.ClassName+' поднята ошибка, с сообщением : '+E.Message); ekUserPwdExpired: raise Exception.Create('DBConnection Error. User password is expired' +#13#10+#13#10+E.ClassName+' поднята ошибка, с сообщением : '+E.Message); ekServerGone: raise Exception.Create('DBConnection Error. DBMS is not accessible due to some reason' +#13#10+#13#10+E.ClassName+' поднята ошибка, с сообщением : '+E.Message); else // other issues raise Exception.Create('DBConnection Error. UnknownMistake' +#13#10+#13#10+E.ClassName+' поднята ошибка, с сообщением : '+E.Message); end; on E : Exception do raise Exception.Create( E.ClassName+' поднята ошибка, с сообщением : '+#13#10+#13#10+E.Message ); end; finally FreeAndNil(oParams); end; end; Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 Solution found !!! Changed Locale and Region to Russia on VPS !!! I don't know how it works but it works. Everybody thank you ! I think topic could be useful for others in depoy questions. Go to ControlPanel -> Clock Language and Region and change Region and Locale! (see pic) Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 Could you change topic name to CharacterSet mess(Solved) Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 Solution found !!! Changed Locale and Region to Russia on VPS !!! I don't know how it works but it works. Everybody thank you ! I think topic could be useful for others in depoy questions. Go to ControlPanel -> Clock Language and Region and change Region and Locale! (see pic) Probably your MySQL server is using OS character settings. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 Your problem is that your FDConnection is not using utf8 as default characterset. There is something wrong with the way you create Pooled connections. It must be done in ServerModule. Please see below code. procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject); var oParams : TStringList; begin FDPhysMySQLDriverLink1.VendorLib := StartPath + 'files\libmysql.dll'; // Use pooled connections for FireDAC. See: http://docwiki.embarcadero.com/RADStudio/XE6/en/Multithreading_(FireDAC) oParams := TStringList.Create; try oParams.Add('Server=192.168.1.100'); oParams.Add('User_Name=uni_test_db'); oParams.Add('Password=*****'); oParams.Add('Database=unigui_test'); oParams.Add('Pooled=True'); oParams.Add('POOL_MaximumItems=100'); oParams.Add('CharacterSet=utf8'); FDManager1.AddConnectionDef('MySQL_Pooled', 'MySQL', oParams); finally oParams.Free; end; FDManager1.Active := True; end; In MainModule you will do like this: procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject); begin FDConnection1.Close; FDConnection1.ConnectionDefName := 'MySQL_Pooled'; FDConnection1.Open; end; Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 Yes, thank you! I still didn't use pooled connections for the moment. That is commented in my code - just tried it 2 days before but didn't get result. So pooled connections is better for UniApp? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 22, 2017 Administrators Share Posted March 22, 2017 Yes, thank you! I still didn't use pooled connections for the moment. That is commented in my code - just tried it 2 days before but didn't get result. So pooled connections is better for UniApp? It may improve performance. Quote Link to comment Share on other sites More sharing options...
elGringo Posted March 22, 2017 Author Share Posted March 22, 2017 Your problem is that your FDConnection is not using utf8 as default characterset. Ok, will try and use your approach - thank you very much, Farshad !!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.