Replies: 4 comments 4 replies
-
Hello @dertin , thanks for giving In terms of practicalities you may want to check out the documentation of
Yes, it is recommended to work with only one enivronment for the entire process regardless. If ODBC connections are used throughout the lifetime of the service I would recommend putting the enivronment into a
For MSSQL and its driver I am fairly certain the answer is yes. The Microsoft driver in general is the most feature complete one I have witnessed in my test suites. Since Ultimatly getting connection pooling to work is not harder then to call an unsafe function ( Hope this helps. Best, Markus |
Beta Was this translation helpful? Give feedback.
-
1- While exploring my options to better control connection pooling for ODBC, I came across 2- Why do I only see the description attribute ? // Q: How can I see complete driver settings?
// I do not see "... Pooling=Yes; CPTimeout=180; PoolMaxSize=15;"
for driver_info in env.drivers().unwrap() {
println!("{:#?}", driver_info);
// Output:
// DriverInfo {
// description: "ODBC Driver 18 for SQL Server",
// attributes: {
// "Description": "Microsoft ODBC Driver 18 for SQL Server Pool",
// },
// } ...
} dertin@dertin-desktop-ubuntu:~$ odbcinst -j
unixODBC 2.3.12pre
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /home/dertin/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
dertin@dertin-desktop-ubuntu:~$ cat /usr/local/etc/odbcinst.ini
[ODBC Driver 18 for SQL Server]
Description=Microsoft ODBC Driver 18 for SQL Server
Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.2.so.2.1
UsageCount=1
Pooling=Yes
CPTimeout=180
PoolMaxSize=15 |
Beta Was this translation helpful? Give feedback.
-
I have a warning related to the ODBC connection string:
All of these attributes must be valid in the connection string. Why does it give this warning? let connection_string = "
Driver={ODBC_Driver_18_for_SQL_Server_Pool};\
Server=0.0.0.0;\
UID=SA;\
PWD=Pepe1234;TrustServerCertificate=Yes;Database=mydatabase;
"; And I think these messages are better for a debug logging level rather than warning
I understand this can get complex when the driver doesn't report the appropriate log level. odbc-api/odbc-api/src/handles/logging.rs Line 18 in 7aea286 |
Beta Was this translation helpful? Give feedback.
-
Hello @dertin ,
I do not know, ask Microsoft. Server 0.0.0.0 seems funny to me though. Sure you do not mean 127.0.0.1?
We get a severity, which is either error or everything else. I could consider logging everything else as info, but this would need some though. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I would like to better understand the necessary steps when starting my Http server and what needs to be passed to each request/thread to reuse connections and avoid the overhead of opening and closing connections, which could affect connection management efficiency (deadlock, lags)
I want to implement a connection pool where I can obtain a connection for each request, potentially executed in different threads. Does unixodbc handle this automatically?
Please note that the application may experience a high number of requests per second.
From my understanding, I need to establish a connection in each thread using the same connection string. If a previous connection is available, it will be reused instead of establishing a new connection. Is my understanding correct? Is there a way to obtain the connection identifier from Rust to monitor the number of active connections and identify new connections?
I have simplified the code in this link, without considering the presence of hyper.rs and other elements of the final implementation, but I believe it illustrates the concept:
https://gist.github.com/dertin/d5e6b031cb86fbe71c6d2272c764dedd
Edit: Look, I added some questions in the comments of the code.
I would greatly appreciate any assistance or advice you can provide. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions