FirebirdSQL/問答篇/Firebird Embedded Server and VFP
出自VFP Wiki
在2005年1月27日 (四) 07:33所做的修訂版本
VFP與 FirebirdSQL 美好演出,透過ODBC是種美妙舞曲,若是需要了解API屈就於使用FirebirdSQL ,對於VFP迷來說是種折磨,也等於扼殺了FireBirdSQL 簡單與方便的美名.不是嗎?
如何使用Embedded server步驟如下:
- Embedded server安裝說明
- 確定FirebirdSQL ODBC Driver是否有安裝,沒有補上去.
- 建立ODBC的使用來源,供應用程式使用
- 測試資料庫是否能使用
&&原作者:dorin_vas@yahoo.com 提共此函數
&&建立ODBC使用來源
PROCEDURE setDSN
LPARAMETERS cDSN,cServerName,cDBName, cDLLPath, cRole
*cDSN entry in ODBC DSN
*cServerName server, name or IP
*cDBName database
*cDLLPath path to DLLs folder
*cRole user role
#DEFINE HKEY_CURRENT_USER -2147483647 #DEFINE SUB_KEY 'Software\ODBC\ODBC.INI\'
IF TYPE('cRole') <> 'C' cRole = 'appuser' ENDIF
oReg = NEWOBJECT('registry','registry.prg')
WITH oReg &&AS registry OF registry.prg .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN, 'Driver',cDLLPath+'OdbcJdbc.dll' ,.T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN, 'Dbname',cDBName, .T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN, 'Role','appuser', .T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN,'CharacterSet','NONE',.T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN, 'Client',cDLLPath + 'fbclient.dll' ,.T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN,'JdbcDriver','IscDbc',.T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN,'ReadOnly','N', .T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN, 'NoWait','Y', .T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN, 'Dialect','3', .T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN,'QuotedIdentifier','N',.T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN, 'User', 'SYSDBA',.T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN, 'Password','masterkey',.T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN,'SensitiveIdentifier','Y',.T.) .writeRegistryString(HKEY_CURRENT_USER, SUB_KEY + cDSN,'AutoQuotedIdentifier','N',.T.) ENDWITH ENDPROC && setDSN
檔案下載