Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rqWaG-00CtRG-0f for pgsql-odbc@arkaria.postgresql.org; Sat, 30 Mar 2024 11:09:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rqWaE-007yeO-M6 for pgsql-odbc@arkaria.postgresql.org; Sat, 30 Mar 2024 11:09:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rqWaE-007yeG-9M for pgsql-odbc@lists.postgresql.org; Sat, 30 Mar 2024 11:09:10 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rqWa6-007dCK-DA for pgsql-odbc@postgresql.org; Sat, 30 Mar 2024 11:09:09 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a44ad785a44so306981966b.3 for ; Sat, 30 Mar 2024 04:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711796939; x=1712401739; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qVExGeFgRh6ew8nvN5oUH3pVkaq79LKkCt+QRkcU55U=; b=LlhNbFQcpRsKTDTqcoiASWZtZD5u+fAB7VY1U/w6K8bGIJE6DEFeCl1GTgj9/AmIBa 5LRNUskml7o2UfuoPSOW66F9fmOu1jtU+Bwcd5L6E31W6JhdMu+nC9UEvlLwecNnAiR2 7BI4IWH/6REHSwRVCrJfDIJJ7lOHBjTHgbGMb9AE2xWkXWkEUatesj08zmwsWvbNthTb KUBfINRqm2LIE8RwIATkyzEiyhq76k5aojsZYs7TdADaZNPwM198w6SOFT/wv47T1sgG wmfUU/+hd7hAG1JbYcperOYpj/yPIZcvxKLFuUlAnA1kIbrnmERcN5uBIjhvVvlxz2h2 2W4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711796939; x=1712401739; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qVExGeFgRh6ew8nvN5oUH3pVkaq79LKkCt+QRkcU55U=; b=Xmx3qSR9nZRsN8a9doVlLox4deaqR9Jh4ZaXAvM2yNv2ps5UN22SbhoSQx0XMHpzet ys3LqpCXyUNcOwtHwP8CF8oVdJypnWAxd1Lp7720JsF1SElr/iqCCp7twHxJygFJQmvH Dee6pl1nooP3A4QWOYm+GoiUYBTYU43sFgkFSYFDqco7RPZh26VhfAdhNn3+Q3Hs+OyL 6LZhniOod9iKgykonm9S1zExauFtmsP9u7camuSAMdFDTj7q6zAcjXTi2CU+Zy4MeI2X BlqdqQtakkShgMfwp2FZztq2Xivspvuu6oTo1inUfA0ZAHw5hq5nfqYrKZTCJ3n3t5G6 4oZg== X-Forwarded-Encrypted: i=1; AJvYcCUbtVfEZxCCKIXVlE4FAyz0QjlWtD2JTZwdy0g3y7d7pFN99xUMQsZgCo9KTlZroPb9nutftjrcvW/fWlBbshu8OuUMmPLDAL9z X-Gm-Message-State: AOJu0YwXRRYzisMAPYyRefhKC3UwJlbh2BH00cM3pEvCqjGW/Bb/KEed 7MT2TEe+rqQlnD63v7h9BYnGu8xeKTX3TT2quvb90jUNfKD2yACJr5EUDCwXvgYv9kCFMlX5LqW 0JQ6v1/w4GlbG1OoWTxB9vSyerVI= X-Google-Smtp-Source: AGHT+IG0vEUMvilWvt+MKNudaleJ8j1LxbI4lwcV7x7lDWWisstGX0t1xp1sHaNiCix5dHf4sAq4/qE+OL+0PtULlCY= X-Received: by 2002:a17:907:7e9a:b0:a47:4ae0:3bb9 with SMTP id qb26-20020a1709077e9a00b00a474ae03bb9mr3571831ejc.23.1711796938965; Sat, 30 Mar 2024 04:08:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Cramer Date: Sat, 30 Mar 2024 07:08:40 -0400 Message-ID: Subject: Re: How to create an ODBC datasource in CI To: Adrian Grucza Cc: Jon Raiford , PostgreSQL mailing lists Content-Type: multipart/alternative; boundary="000000000000798aad0614dec855" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000798aad0614dec855 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 30 Mar 2024 at 06:17, Adrian Grucza wrote= : > If your aim is to run the regression tests then winbuild/regress.ps1 does > everything for you: installs a dev version of the driver, creates a DSN f= or > it and runs the tests against a PostgreSQL server (which you could run in > Docker). > Well the problem is that it waits for input which we can't do on github actions > > But if you want to use the MSI installer, running that will install the > driver for you: > > Start-Process 'C:\\psqlodbc_x64.msi' '/quiet /passive' -PassThru | > Wait-Process; > > You then just need to create the DSN: > > Add-OdbcDsn -Name "MyPostgresDsn" -DsnType 'User' -Platform '64-bit' > -DriverName 'PostgreSQL Unicode(x64)' > > Set-OdbcDsn -Name "MyPostgresDsn" ` > -DsnType "User" ` > -SetPropertyValue @("Servername=3D${env:DB_HOST}" ` > ,'Port=3D5432' ` > ,"SSLMode=3D${env:SSL_MODE}" ` > ,'BoolsAsChar=3D0' ` > ,'FetchRefcursors=3D1' ` > ,'MaxVarcharSize=3D4094' ` > ) > > Thanks, Will try this Dave > > Adrian Grucza > Technical Lead > Office: +61390185800 > The contents of this email originated from Iress. For this purpose Iress > includes Iress Limited and/or any of its subsidiaries, holding companies > and trading entities. > If you have received this email in error please notify the sender > immediately and delete this email. > On Sat, 30 Mar 2024 at 6:53=E2=80=AFpm, Dave Cramer wrote: > >> >> >> *CAUTION: *This Email is from an EXTERNAL source. Ensure you trust this >> sender before clicking on any links or attachments. >> >> >> >> >> On Fri, 29 Mar 2024 at 18:49, Adrian Grucza >> wrote: >> >>> winbuild/regress.ps1 uses RegisterRegdsn.exe (built from >>> test/RegisterRegdsn.c) to install the driver and register a data source= . >>> You could use that, or you may find it easier to use the Wdac cmdlets >>> in >>> PowerShell, specifically Add-OdbcDsn and Set-OdbcDsn. >>> >>> >> Yes, I saw those, was going to try them. I think the challenge is >> registering the driver first though. >> >> Dave >> >>> >>> [image: iress.com] >>> Adrian Grucza >>> Technical Lead >>> Office: +61390185800 >>> adrian.grucza@iress.com >>> www.iress.com >>> Level 16 385 Bourke St >>> >>> Melbourne >>> >>> , Victoria, 3000 >>> The contents of this email originated from Iress. For this purpose Ires= s >>> includes Iress Limited and/or any of its subsidiaries, holding companie= s >>> and trading entities. If you have received this email in error please >>> notify the sender immediately and delete this email. >>> nosig >>> >> On Sat, 30 Mar 2024 at 2:12=E2=80=AFam, Dave Cramer wrote: >>> >>>> >>>> >>>> *CAUTION: *This Email is from an EXTERNAL source. Ensure you trust >>>> this sender before clicking on any links or attachments. >>>> >>>> >>>> >>>> >>>> On Fri, 29 Mar 2024 at 08:41, Jon Raiford wrote: >>>> >>>>> I=E2=80=99m not familiar with GitHub Actions, but I know you can crea= te data >>>>> sources from the command line. This is all stored in the registry, wh= ich >>>>> you can update using the reg command. >>>>> >>>>> >>>>> >>>>> >>>>> https://learn.microsoft.com/en-us/windows-server/administration/windo= ws-commands/reg >>>>> >>>>> >>>>> >>>>> >>>>> The easiest thing to do may be to create a data source manually and >>>>> export it into a .reg file. You can then either import the data sourc= e >>>>> using the reg file or just use it as a template to add the entries as= you >>>>> like. >>>>> >>>>> >>>>> Just run Regedit and locate the data source you would like to export. >>>>> >>>>> >>>>> >>>>> 64-bit System Data Sources: \\HKLM\SOFTWARE\ODBC\ >>>>> >>>>> >>>>> 32-bit System Data Sources: \\HKLM\SOFTWARE\WOW6432Node\ODBC\ >>>>> >>>>> >>>>> 64-bit User Data Sources: \\HKCU\SOFTWARE\ODBC\ >>>>> >>>>> 32-bit User Data Sources: \\HKCU\SOFTWARE\ODBC\ >>>>> >>>>> <- This is mixed in with the 64-bit entries and the driver referenced >>>>> determines if 32/64 >>>>> >>>>> >>>>> >>>>> Drivers are defined under the system keys under the section >>>>> ODBCINST.INI. Data sources are defined under the section ODBC.INI, bo= th as >>>>> a folder containing the details of the data source as well as an entr= y >>>>> under =E2=80=9CODBC.INI\ODBC Data Sources=E2=80=9D, which associates = the data source with >>>>> the driver to use with it. >>>>> >>>>> >>>>> >>>>> I think if you view these entries in Regedit you will see the >>>>> relationships between everything. It may help to create a data source= for >>>>> each type. >>>>> >>>>> >>>>> >>>>> The above describes how to create a static ODBC data source. >>>>> Alternatively you can use a file DSN or simply make a connection stri= ng >>>>> from your test case and avoid the data source completely. Although I >>>>> suppose you may want to do each in order to test each possibility. >>>>> >>>>> >>>>> >>>>> Let me know if you have any questions or need assistance. >>>>> >>>>> >>>>> >>>>> Jon >>>>> >>>> >>>> Hey Jon, >>>> >>>> Thanks, that will help immensely. >>>> >>>> It's been a while since I've done anything with Windows. >>>> >>>> Dave >>>> >>>>> >>>>> >>>>> >>>>> >>>>> *From: *Dave Cramer >>>>> *Date: *Friday, March 29, 2024 at 7:25=E2=80=AFAM >>>>> *To: *PostgreSQL mailing lists >>>>> *Subject: *How to create an ODBC datasource in CI >>>>> >>>>> Greetings, >>>>> >>>>> >>>>> >>>>> In order to test the driver using github actions we need to be able t= o >>>>> create a windows datasource. Usually this requires some kind of user >>>>> interaction. >>>>> >>>>> >>>>> >>>>> Has anyone done this on GH actions ? >>>>> >>>>> >>>>> >>>>> >>>>> Dave Cramer >>>>> >>>> --000000000000798aad0614dec855 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable



On Sat, 30 Mar 2024 at 06:17, Adrian Grucza <= adrian.grucza@iress.com> = wrote:
If your aim is to run the regression tests then winbuild/regr= ess.ps1 does everything for you: installs a dev version of the driver, crea= tes a DSN for it and runs the tests against a PostgreSQL server (which you = could run in Docker).
Well the problem is that= it waits for input which we can't do on github actions=C2=A0

But if you want to use the MSI installer, running tha= t will install the driver for you:

Start-Process 'C:\\psqlodbc_x64.msi' &= #39;/quiet /passive' -PassThru | Wait-Process;
<= br>
You then jus= t need to create the DSN:

Add-OdbcDsn -Name "MyPostgresDsn" -DsnType 'Us= er' -Platform '64-bit' -DriverName 'PostgreSQL Unicode(x64)= '

=
Set-OdbcDsn -Name "MyPostgresDsn" `<= /div>
=C2=A0-DsnType "User" `
=C2=A0-SetPropertyValue @("Servername=3D${env:DB_HOST}" `
=C2=A0,'Port=3D5432' `
= =C2=A0,"SSLMode=3D${env:SSL_MODE}" `
=C2= =A0,'BoolsAsChar=3D0' `
=C2=A0,'FetchRef= cursors=3D1' `
=C2=A0,'MaxVarcharSize=3D4094= ' `
=C2=A0)

Thanks,

Will try this
Dave=C2=A0

=
3D""
Adrian=C2=A0Grucza
Tec= hnical=C2=A0Lead
Office:=C2=A0+61390185800
=
The contents of thi= s email originated from Iress. For this purpose Iress includes Iress Limite= d and/or any of its subsidiaries, holding companies and trading entities.If you have received this email in error please notify the sender immedia= tely and delete this email.=C2=A0
On Sat, 30 Mar 2024 at= 6:53=E2=80=AFpm, Dave Cramer <davecramer@gmail.com> wrote:
<= div>

<= td>

CAUTION: This Email is from an EXTERNAL source. Ensu= re you trust this sender before clicking on any links or attachments.




On Fri, 29 Mar 2024 at 18:49, A= drian Grucza <adrian.grucza@iress.com> wrote:
winbuild/regress.ps1 uses = RegisterRegdsn.exe (built from test/RegisterRegdsn.c) to install the driver= and register a data source. You could use that, or you may find it easier = to use the Wdac cmdlets=C2=A0in PowerShell, specificall= y Add-OdbcDsn and Set-OdbcDsn.


Yes, I saw those, was going to try them. I thin= k the challenge is registering the driver first though.

Dave=C2=A0

3D"iress.com"
<= /td>
=
Adrian=C2=A0Grucza=C2=A0=C2=A0
Technical=C2=A0Lead
<= /td>
Office:= =C2=A0+61390185800<= /td>
<= tr style=3D"font-size:12px">
adrian.grucza@iress.com
www.iress.com
Level=C2=A016=C2=A038= 5=C2=A0Bourke=C2=A0St
=C2=A0Melbourne<= /a>,=C2=A0Victoria,=C2=A03000
The contents of this email originated from Iress. For this = purpose Iress includes Iress Limited and/or any of its subsidiaries, holdin= g companies and trading entities. If you have received this email in error = please notify the sender immediately and delete this email.=C2=A0
nosig
On Sat, 30 Mar 2024 at 2:12=E2=80=AFam, Dave Cramer <davecramer@gmail.com= > wrote:

<= td>

CAUTION: This Email is from an EXTERNAL source. Ensu= re you trust this sender before clicking on any links or attachments.




On Fri, 29 Mar 2024 at 08:41, J= on Raiford <rai= ford@labware.com> wrote:

I=E2=80=99m not famil= iar with GitHub Actions, but I know you can create data sources from the co= mmand line. This is all stored in the registry, which you can update using = the reg command.

=C2=A0<= /span>

https:= //learn.microsoft.com/en-us/windows-server/administration/windows-commands/= reg

=C2=A0<= /span>

The easiest thing to = do may be to create a data source manually and export it into a .reg file. = You can then either import the data source using the reg file or just use i= t as a template to add the entries as you like.


Just run Regedit and locate the data source you would like to export.

=C2=A0<= /span>

64-bit System Data So= urces: \\HKLM\SOFTWARE\ODBC\

32-bit System Data So= urces: \\HKLM\SOFTWARE\WOW6432Node\ODBC\

64-bit User Data Sour= ces: \\HKCU\SOFTWARE\ODBC\

32-bit User Data Sour= ces: \\HKCU\SOFTWARE\ODBC\=C2=A0=C2=A0=C2=A0=C2=A0 <- This is mixed in wi= th the 64-bit entries and the driver referenced determines if 32/64<= u>

=C2=A0<= /span>

Drivers are defined u= nder the system keys under the section ODBCINST.INI. Data sources are defin= ed under the section ODBC.INI, both as a folder containing the details of t= he data source as well as an entry under =E2=80=9CODBC.INI\ODBC Data Sources=E2=80=9D, which associates the d= ata source with the driver to use with it.

=C2=A0<= /span>

I think if you view t= hese entries in Regedit you will see the relationships between everything. = It may help to create a data source for each type.

=C2=A0<= /span>

The above describes h= ow to create a static ODBC data source. Alternatively you can use a file DS= N or simply make a connection string from your test case and avoid the data= source completely. Although I suppose you may want to do each in order to test each possibility.

=C2=A0<= /span>

Let me know if you ha= ve any questions or need assistance.

=C2=A0<= /span>

Jon

<= /div>

Hey Jon,

Thanks, that will help immensely.

It's been= a while since I've done anything with Windows.

Dave=C2=A0
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
<= div>

=C2=A0<= /span>

=C2=A0<= /span>

From: Dave Cramer <davecramer@gmail.com>
Date: Friday, March 29, 2024 at 7:25
=E2=80=AFAM
To: PostgreSQL mailing lists <pgsql-odbc@postgresql.org>
Subject: How to create an ODBC datasource in CI
=

Greetings,

=C2=A0

In order to test the driver using github actions we = need to be able to create a windows datasource. Usually this requires some = kind of user interaction.

=C2=A0

Has anyone=C2=A0done this on GH actions ?<= /u>

=C2=A0


Dave Cramer

--000000000000798aad0614dec855--