Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
Run queries on remote PostgreSQL from LibreOffice Calc

My goal is to run simple queries from LibreOffice Calc and get the results from a remote PostgreSQL database.

I tried to do something similar to this answer but I get an error.

Here is what I have:

Sub GetQuery
   Dim oParms(1) as new com.sun.star.beans.PropertyValue 
   Dim oStatement As Object
   Dim oResult As Object
   Dim oConnection As Object

   oParms(0).Name = "user" 
   oParms(0).Value = "serveruser" 
   oParms(1).Name = "password" 
   oParms(1).Value = "serverpwd" 
   oManager = CreateUnoService("com.sun.star.sdbc.DriverManager")
   sURL = "dbname=mydatabase hostaddr=X.X.X.X port=5432 user=postgresuser password=postgrespwd"
   oConnection = oManager.getConnectionWithInfo(sURL, oParms())

   oStatement = oConnection.createStatement()
   oResult = oStatement.executeQuery("select count(*) from mytable")

   MsgBox "Result: " & oResult
   oStatement.close()
End Sub

When I try to run this I get "Object variable not set" on line oStatement = oConnection.createStatement().

As you can see I have very limited experience on remote database connection.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda