Page 1 of 1
write app use Lazarus,unidac and run in win/ubuntu question
Posted: Sun 15 Apr 2012 02:36
by c123321
i want to use Lazarus write an server app and client app;
the app can run in win32/64 and ubuntu, but i don't know more ubuntu
so have many question, i want you help;
first: read doc konw you test in Ubuntu x64, Lazarus 0.9.30.2 and FPC 2.4.4;
the question you test ubuntu is which version? 10.04,11.10 x64? lazarus
and fpc version is the same which can be found and install by ubuntu software center
by: sudo apt-get install lazarus? provide one lazarus example is so good,
second: lazarus can complied android app;so can i use unidac write client app and run in android
for example PC SERVER:postgresql db; android Client: unidac direct link PC and query data ?
how can i exec oracle storeproc with as dba?
Posted: Tue 17 Apr 2012 08:15
by c123321
unidac conn as dba,directmode=true;oracle10.2, unidac 4.1.5;
use unisql as this:
UniSQL1.SQL.Text:='exec dbms_system.set_ev('+SID+','+Serail+',10046,0,'');';
UniSQL1.Execute;
or unistoredproc all not effict bu no error:
//
// UniStoredProc1.Close;
// UniStoredProc1.StoredProcName:='DBMS_SYSTEM.SET_EV';
// UniStoredProc1.Params.ParamByName('si').Value:=StrToInt(SID);
// UniStoredProc1.Params.ParamByName('se').Value:=StrToInt(Serail);
// UniStoredProc1.Params.ParamByName('ev').Value:=10046;
// UniStoredProc1.Params.ParamByName('le').Value:=0;
// UniStoredProc1.Params.ParamByName('nm').Value:='';
// UniStoredProc1.Prepare;
// UniStoredProc1.ExecProc;
i want to trace oracle pl/sql , but no effict;
but the same sql in pl/sql's sql windows is ok, why?
[/quote]
Posted: Wed 18 Apr 2012 09:49
by AlexP
Hello,
We tested our products on Ubuntu 11.04 and 11.10 - Lazarus and FPC were installed from *.deb packages downloaded from official sites of developers with the help of the following command (being located in the folder with downloaded packages)
We didn't test our products on Android OS, the support of this platform will be implemented as soon as the Android compiler in Embarcadero RadStudio is released.
The following working sample demonstrates various ways of enabling oracle trace, try to execute it and check if trace can really be enabled.
Code: Select all
var
UniConnection: TUniConnection;
UniQuery: TUniQuery;
sid, serial: integer;
begin
UniConnection := TUniConnection.Create(nil);
UniConnection.ProviderName := 'Oracle';
UniConnection.SpecificOptions.Values['ConnectMode'] := 'cmSysDBA';
UniConnection.SpecificOptions.Values['Direct'] := 'true';
UniConnection.Server := 'host:port:sid';
UniConnection.Username := 'Login';
UniConnection.Password := 'password';
UniConnection.LoginPrompt := false;
UniConnection.Connect;
UniQuery := TUniQuery.Create(nil);
UniQuery.Connection := UniConnection;
UniQuery.SQL.Text := 'SELECT SID, SERIAL#' + #13 +
'FROM V$SESSION' + #13 +
'WHERE USERNAME = ''login''' + #13 +
'AND OSUSER = ''OS_User''' + #13 +
'AND MACHINE = ''Machine''' + #13 +
'AND PROGRAM = ''program.exe''';
UniQuery.Open;
sid := UniQuery.Fields[0].AsInteger;
serial := UniQuery.Fields[1].AsInteger;
UniQuery.close;
UniQuery.SQL.Clear;
UniQuery.SQL.Text := 'DECLARE' + #13 +
' ALevel binary_integer;' + #13 +
'BEGIN ' + #13 +
' DBMS_SYSTEM.Read_Ev(10046, ALevel);' + #13 +
' :state := '''';' + #13 +
' IF ALevel = 0 THEN' + #13 +
' :state := ''sql_trace is of'';' + #13 +
' ELSE' + #13 +
' :state := ''sql_trace is on'';' + #13 +
' END IF;' + #13 +
'END;';
UniQuery.ParamByName('state').DataType := ftString;
UniQuery.ParamByName('state').ParamType := ptOutput;
UniConnection.ExecSQL('BEGIN sys.dbms_system.set_ev(:sid, :serial, 10046, 12, ''''); END;',[sid,serial]); //Enable
UniQuery.ExecSQL;
ShowMessage(UniQuery.ParamByName('state').AsString);
UniConnection.ExecSQL('BEGIN sys.dbms_system.set_ev(:sid, :serial, 10046, 0, ''''); END;',[sid,serial]); //Diasable
UniQuery.ExecSQL;
ShowMessage(UniQuery.ParamByName('state').AsString);
UniConnection.ExecSQL('alter session set events ''10046 trace name context forever, level 12''',[]); //Enable
UniQuery.ExecSQL;
ShowMessage(UniQuery.ParamByName('state').AsString);
UniConnection.ExecSQL('alter session set events ''10046 trace name context off''',[]); //Diasable
UniQuery.ExecSQL;
ShowMessage(UniQuery.ParamByName('state').AsString);
end;
Posted: Thu 19 Apr 2012 09:18
by c123321
thanks, it it ok, can you save the time when direct mode support in linux? i wait it;
Posted: Thu 19 Apr 2012 09:34
by AlexP
Hello,
The new version with direct mode support for Lazarus will be released approximately in two months