daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Add-MyOdbc {
  2.  
  3. <#  Supply a value for Name, and this function adds a User DSN ODBC 64-bit connection for it
  4.  
  5. #>
  6.  
  7.  
  8.     [CmdletBinding()]
  9.     Param (
  10.         [parameter(Mandatory=$True)]
  11.         [string]$Name
  12.     )
  13.  
  14.    
  15.     $propertyValue = @"
  16.        System=0.0.0.0
  17.        DefaultLibraries=QGPL
  18.        DefaultPkgLibrary=QGPL
  19.        LanguageID=ENU
  20.        DefaultPackage=QGPL/DEFAULT(IBM),2,0,1,0,512
  21.        QueryStorageLimit=-1
  22.        CommitMode=2
  23.        Naming=0
  24.        DateFormat=5
  25.        DateSeparator=1
  26.        TimeFormat=0
  27.        TimeSeparator=0
  28.        TimestampFormat=0
  29.        Decimal=0
  30.        ExtendedDynamic=1
  31.        BlockSizeKB=8192
  32.        ForceTranslation=0
  33.        LazyClose=0
  34.        LibraryView=0
  35.        ODBCRemarks=0
  36.        ConnectionType=0
  37.        SortSequence=0
  38.        PreFetch=1
  39.        SortWeight=0
  40.        SSL=2
  41.        Signon=3
  42.        ExtendedType=0
  43.        SearchPattern=1
  44.        AllowDataCompression=1
  45.        AllowUnsupportedChar=0
  46.        BlockFetch=1
  47.        Concurrency=0
  48.        MaxFieldLength=15360
  49.        Trace=0
  50.        CCSID=0
  51.        TranslationOption=0
  52.        UnicodeSQL=0
  53.        TrueAutoCommit=0
  54.        DB2SQLStates=0
  55.        Graphic=0
  56.        AllowProcCalls=0
  57.        ExtendedColInfo=0
  58.        CatalogOptions=3
  59.        CursorSensitivity=0
  60.        XATransactionTimeout=0
  61.        XALockTimeout=0
  62.        XALooselyCoupledSupport=1
  63.        HexParserOpt=0
  64.        MaximumDecimalPrecision=31
  65.        MaximumDecimalScale=31
  66.        MinimumDivideScale=0
  67.        ConvertDateTimeToChar=0
  68.        ReportDataTypes=1
  69.        DelimitNames=0
  70.        QueryOptimizeGoal=0
  71.        DecFloatRoundMode=0
  72.        MapDecimalFloatDescribe=1
  73.        DecfloatErrorOption=0
  74.        QueryTimeout=1
  75.        ConcurrentAccessResolution=0
  76.        XMLCurrentImplicitParse=0
  77.        XMLDeclarationFormat=7
  78.        Debug=0
  79.        SQLConnectPromptMode=0
  80. "@
  81.  
  82.     $dsn_splat = @{
  83.         Name =  $Name
  84.         DriverName = "iSeries Access ODBC Driver"
  85.         DsnType = "User"
  86.         Platform = "64-bit"
  87.         SetPropertyValue = $propertyValue
  88.     }
  89.    
  90.    
  91.     Add-OdbcDsn @dsn_splat
  92.  
  93.     # This property stays at 256 for some reason unless changed as below
  94.     Set-ItemProperty -Path "HKCU:\Software\ODBC\ODBC.INI\$Name" -Name "BlockSizeKB" -Value 8192
  95. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top