Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

DB creation with DTI



In our Delphi application we want to create programmatically a database
on a PSQL (2000 or V8) server; the server engine could run NT, NW, Linux
or WGE PSQL.
We would use DTI functions and ODBC functions.

The code is like the following:

//*** declaration of external function
function SQLConfigDataSource(
  hwndParent: HWND;
  fRequest: WORD;
  lpszDriver: LPCSTR;
  lpszAttributes: LPCSTR): BOOL; stdcall; external 'ODBCCP32.DLL';


//*** setting flags for DB name creation
dbFlags := 0;
dbFlags := dbFlags Or P_DBFLAG_RI;
dbFlags := dbFlags Or P_DBFLAG_CREATE_DDF;

//creating DB name on selected server
stat :=
PvCreateDatabase(hconn,PChar(strDBName),PChar(strDicPath),PChar(strDataPath),dbflags);


if stat = P_OK then
begin
  //*** DBName created
  //*** disconnect from server e trying to create DSN
  
  PvDisconnect(hconn);


  //*** call ODBC funtion
  status := SQLConfigDataSource(0,ODBC_ADD_SYS_DSN,'Pervasive ODBC
Engine Interface',
                                PChar
                                (
                                'DSN=' + StrDBName + #0 +
                                'DBQ=' + StrDBName + #0 +
                                'SERVER=' + StrServerName + #0 +
                                'UID=' + strUsername + #0 +
                                'PWD=' + strPassword + #0
                                )
                               );
end;

Is this the right way to reach our target?
The code above is multi-platform? 
Thanks in advance

Alex/


-- 
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.