Thursday, March 29, 2012

Automating installation of ODBC data source

Is there a script anyone has that will automate the addition of an
access database to the OBDC datasources in control panel.

ThanksHere's something that I did in Kixtart for our environment. It was last
November, so I don't recall all the details. Some key values I would expect to
vary, as I have six (6) scripts for all the data sources we have. I figured out
what to do by checking the registry, and creating a script that would duplicate
what I had done manually.

Also, since it was three (3) PCs ago, I don't recall what OS it was. Since I've
been here, I've had three (3) PCs. This one is XP, the previous was w2k and the
first? MAY have been NT. I mention this as I don't know if it'll require any
changes in the script.

Here it is (between the lines of '=========='):
==========
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;
; Kixtart script - create Data Source Entries for HTE applications ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;
; ;
; 11-10-03 tcs initial creation date. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;
;
; *** NOTE ***
;
; Path to 'cwbodbc.dll' must be modified as necessary. For example,
; as originally written, the path is:
;
; d:\IBM\Client Access\Shared\cwbodbc.dll
;
; which was correct for the machine upon which this script was developed.
;
;================================================= ====================
;
;Setup ODBC for HTE DB2 database [Begin]
;Create the necessary keys, values and expressions for current user.
$CR=chr(13)
$HteDSN='Finance'
$KeyBase='HKEY_CURRENT_USER\Software\ODBC\ODBC.INI '
$Key1='$KeyBase\ODBC Data Sources'
$Key2='$KeyBase\$HteDSN'
if existkey($Key2) ; key doesn't exist, so create it.
$result=addkey($Key2)
$result=writevalue($Key1,'$HteDSN','Client Access ODBC Driver
(32-bit)','REG_SZ')

$result=writevalue($Key2,'AllowDataCompression','0 ','REG_SZ')
$result=writevalue($Key2,'AllowUnsupportedChar','0 ','REG_SZ')
$result=writevalue($Key2,'AlwaysScrollable','0','R EG_SZ')
$result=writevalue($Key2,'BlockSizeKB','32','REG_S Z')
$result=writevalue($Key2,'CCSID','','REG_SZ')
$result=writevalue($Key2,'CommitMode','0','REG_SZ' )
$result=writevalue($Key2,'ConnectionType','0','REG _SZ')
$result=writevalue($Key2,'DateFormat','5','REG_SZ' )
$result=writevalue($Key2,'DateSeparator','1','REG_ SZ')
$result=writevalue($Key2,'Decimal','0','REG_SZ')
$result=writevalue($Key2,'DefaultLibraries','atlib , prlib, pilib, gmlib,
fmlib, mrlib, crlib, gflib, falib, wflib, lxlib, malib','REG_SZ')
$result=writevalue($Key2,'DefaultPkgLibrary','QGPL ','REG_SZ')
$result=writevalue($Key2,'Description','Client Access Express ODBC data
source','REG_SZ')
$result=writevalue($Key2,'Driver','d:\IBM\Client
Access\Shared\cwbodbc.dll','REG_SZ')
$result=writevalue($Key2,'ExtendedDynamic','0','RE G_SZ')
$result=writevalue($Key2,'ForceTranslation','0','R EG_SZ')
$result=writevalue($Key2,'LanguageID','ENU','REG_S Z')
$result=writevalue($Key2,'LazyClose','0','REG_SZ')
$result=writevalue($Key2,'LibraryView','0','REG_SZ ')
$result=writevalue($Key2,'ManagedDataSource','0',' REG_SZ')
$result=writevalue($Key2,'MaxFieldLength','32','RE G_SZ')
$result=writevalue($Key2,'Naming','0','REG_SZ')
$result=writevalue($Key2,'ODBCRemarks','0','REG_SZ ')
$result=writevalue($Key2,'PreFetch','0','REG_SZ')
$result=writevalue($Key2,'RecordBlocking','2','REG _SZ')
$result=writevalue($Key2,'SearchPattern','1','REG_ SZ')
$result=writevalue($Key2,'Signon','0','REG_SZ')
$result=writevalue($Key2,'SortSequence','0','REG_S Z')
$result=writevalue($Key2,'SortTable','','REG_SZ')
$result=writevalue($Key2,'SortWeight','0','REG_SZ' )
$result=writevalue($Key2,'SSL','2','REG_SZ')
$result=writevalue($Key2,'System','10.4.1.1','REG_ SZ')
$result=writevalue($Key2,'TimeFormat','0','REG_SZ' )
$result=writevalue($Key2,'TimeSeparator','0','REG_ SZ')
$result=writevalue($Key2,'TranslationDLL','','REG_ SZ')
$result=writevalue($Key2,'TranslationOption','','R EG_SZ')
$result=writevalue($Key2,'','','REG_SZ')
$result=writevalue($Key2,'','','REG_SZ')
$result=writevalue($Key2,'','','REG_SZ')
$result=writevalue($Key2,'','','REG_SZ')
endif
;Setup ODBC for HTE DB2 Server [End]
==========
I don't think that I fully finished, so I'd tread lightly, but hopefully this'll
get you started.

Tom

On Wed, 23 Jul 2003 10:49:53 +0000 (UTC), SkunkDave
<dave_casserly@.totalise.co.uk> wrote:

>Is there a script anyone has that will automate the addition of an
>access database to the OBDC datasources in control panel.
>Thanks

No comments:

Post a Comment