#đź”’ Struggle to connect Python to HFSQL database using ODBC driver
7 messages · Page 1 of 1 (latest)
@astral kayak
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
is that the whole code?
if so send it as text
if its too big paste
also if thats the whole code i dont see why not re raise the error
Here is the whole code :
import pyodbc
provider = "PCSOFT.HFSQL" # nom exact du provider OLEDB
server = "localhost" # ou l'adresse de ton serveur HFSQL
database = "Mako_TEST"
user = "TEST"
password = "Test"
conn_str = (
f"Provider={provider};"
f"Data Source={server};"
f"Initial Catalog={database};"
f"User ID={user};"
f"Password={password};"
)
try:
conn = pyodbc.connect(conn_str, autocommit=True)
print("✅ Connexion réussie via OLEDB")
except pyodbc.Error as e:
print("❌ Échec de la connexion")
print(e)
Here is the result in the terminal:
PS C:\Users\neogr> & C:/Users/neogr/AppData/Local/Programs/Python/Python313/python.exe e:/Mako/Test4.py
❌ Échec de la connexion
('IM002', '[IM002] [Microsoft][Gestionnaire de pilotes ODBC] Source de données introuvable et nom de pilote non spécifié (0) (SQLDriverConnect)')
PS C:\Users\neogr>
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.