Skip to Content
Menu
This question has been flagged

Hello,

in odoo16e in Osoo sh, I want to get info from an external database, in odoo sh i have postgresql (14.12) and the database that i want to get info, has postgresql (9.6.19)

I'm trying using psycopg2, in my odoo local i can access successfully, but not in odoo sh, i get this error: connection to server at "xxx.xx.xxx.xxx", port xxxx failed: FATAL: unrecognized configuration parameter "jit" 


my odoo local has postgresql (16.3)


My code is: 

import psycopg2

from odoo import api, fields, models,


class ZkMachine(models.Model): 

​_name = 'zk.machine'

​ def try_connection(self):

​ db_params = {

​ 'dbname': self.database,

​ 'user': self.user_name,

​ 'password': self.password,

​ 'host': self.name,

​ 'port': self.port_no

​ }

​ dsn = f"dbname={db_params['dbname']} user={db_params['user']} password={db_params['password']} host={db_params['host']} port={db_params['port']}"

​ try:

​ conn = psycopg2.connect(dsn)

​ if conn:

​ msg = f'Te has conectado exitosamente a {self.database}'

​ conn.close()

​ except psycopg2.Error as e:

​ msg = f"No se ha podido establecer la conexión: {e}"

​ return self._message_user('danger', msg)

​ except Exception as ex:

​ msg = f"Error desconocido: {ex}"

​ return self._message_user('danger', msg)


Could someone help me to solve this??


Thx in advance

Avatar
Discard
Related Posts Replies Views Activity
1
Sep 21
3976
2
Apr 24
10179
4
Apr 25
3008
0
Feb 25
791
2
Jan 25
6863