dbTalk Databases Forums  

DB creation with DTI

comp.databases.btrieve comp.databases.btrieve


Discuss DB creation with DTI in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alex Smersi
 
Posts: n/a

Default DB creation with DTI - 11-20-2003 , 04:44 AM






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(strD icPath),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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.