1

How can I connect to firebird database from powershell script (.ps1)?

Can someone provide me the code? I've tried with an SQL server and got no problem with that but I need to make a connection to firebird.

Your comments are heartily welcomed.

I've used InvokeQuery module

Code:

$password = ConvertTo-SecureString "****(mykey)" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("myuid", $password)
$db = "PDMconv_data.GDB"
$server = "89.105.195.151:D:\databases\PDMconv_data.GDB"
$query="select * from PGR010_GET_THE_ALGOPD;"
$result = Invoke-FirebirdQuery -Sql $query -Database $db -Server $server -Credential $mycreds -Verbose
$result | ft
Ian Kemp
  • 28,293
  • 19
  • 112
  • 138
Rajnikant
  • 11
  • 3
  • Related, possibly duplicate: https://stackoverflow.com/questions/18704610/powershell-connect-to-firebird – Mark Rotteveel Oct 22 '19 at 10:10
  • There isn't clear explanation in that post which is why i posted this issue – Rajnikant Oct 22 '19 at 10:23
  • Then show what you tried and explain what you're stuck on. – Mark Rotteveel Oct 22 '19 at 10:37
  • 1
    `Can someone provide me the code` SO isn't a code writing service, if you contribute your own code we'll happily attempt to help you but you have to have a go at it yourself. – Matthew Oct 22 '19 at 10:51
  • I've updated with code, thanks for your replies – Rajnikant Oct 22 '19 at 11:03
  • I know next to nothing about Firebird, but are you sure about the `$server = "89.105.195.151:D:\databases\PDMconv_data.GDB"`? Combining IP address and path to a file with colon looks strange. Colon is often used to specify a TCP port, but what do I know? – vonPryz Oct 22 '19 at 11:09
  • As i am also a beginner, i doubt that too, but i've also tried only specifying 89.105.195.151 – Rajnikant Oct 22 '19 at 11:22
  • @vonPryz It depends on what is used to connect. The URL format a lot of native Firebird tools use is `[/]:` because that is what is used by the fbclient.dll library. However non-native tools (eg for Java or C#) may use different formats. – Mark Rotteveel Oct 22 '19 at 11:52
  • What is this `Invoke-FirebirdQuery` you use? What exactly is wrong with this code? – Mark Rotteveel Oct 22 '19 at 11:54

0 Answers0