ArpeMSSQL — Troubleshooting
Common failures and their fixes, grouped by where they show up: connecting, authenticating, the licence gate, and querying/ingesting. For the option details referenced here, see Connection.
Connection
Connect hangs, then fails after ~30 s. The TCP connect budget
(login_timeout, default 30 s) elapsed. When a host resolves to several addresses
they share that budget, so this usually means every address is unreachable — a
firewall, a wrong port, or the server not listening. Verify with
nc -vz <host> 1433. Lower login_timeout to fail faster while diagnosing.
A machine name is much slower than localhost / an IP. The name resolved to
several addresses and a leading one (often a link-local fe80:: on Windows) is
dropping the SYN. The shared connect budget prevents a flat +30 s stall, but a
dead first address still costs time. Connect by IP, or fix DNS/hosts ordering.
Named instance won't connect ("could not determine port for instance …").
Server=host\INSTANCE needs the SQL Server Browser reachable on UDP 1434.
Either open UDP 1434 and start the Browser service, or pin the instance to a static
port in SQL Server Configuration Manager and connect with an explicit port
(Server=host\INSTANCE,54312), which skips the Browser lookup entirely. See
Named instances.
(localdb)\... fails. LocalDB is reached over a named pipe, not TCP — this
driver cannot connect to it. Use a full SQL Server (Express is fine).
Azure SQL "Redirect" connection resets. The Redirect gateway policy sends the client to a database node on ports 11000–11999; the driver follows the routing token automatically, but the reconnect needs outbound TCP to 11000–11999. Open that range, or ask your admin to set the server's connection policy to Proxy.
A statement fails with "the server sent a routing redirect (ENVCHANGE type N) outside the login response". The TDS protocol allows a routing redirect only in the login response, where the driver follows it. A server or proxy that sends one on an open connection breaks the protocol; the statement fails and the connection is not moved. Versions before v0.7.6 reported it as "ENVCHANGE ROUTING not supported".
Microsoft Fabric: "Failed to resolve hostname '…\…'". The Fabric gateway
redirects the login to a node name that carries an instance
(<node>.pbidedicated.windows.net\<INSTANCE>). Versions before v0.7.5 resolved
that whole string as a host name, so no Fabric connection could open. Upgrade to
v0.7.5 or later.
A query fails with "Connection reset by server (TLS)" after the connection sat
idle. The server or a gateway in between (for example an Azure gateway closing a
long-idle connection) dropped the connection. If a transaction was open, it
is lost: statements, ingest and commit() then fail with ADBC_STATUS_INVALID_STATE
until you call rollback(). A send that does not complete in time
fails with "Send timed out after N seconds" instead. Versions before v0.7.4
reported the dropped connection as "SSL write error 5".
TLS / certificates
Login fails with "Failed to receive Pre-Login response". The server has
Force Strict Encryption on (SQL Server 2022 and later, Azure SQL) and closes
the connection on the default TDS 7.4 handshake, which negotiates TLS inside the
cleartext PRELOGIN. The error message points to the fix: connect with
tds_version=8.0 (connection string Encrypt=Strict or TDS Version=8.0, URI
?tds_version=8.0). With strict encryption the certificate is always verified
and trust_server_cert=true is refused; for a private CA or a self-signed
certificate use tls_ca_file (and host_name_in_certificate if needed). See
Connection → Encryption / TLS.
Since ArpeMSSQL v0.7.5.
"unable to get local issuer certificate". The server certificate, or the
certificate of the Entra ID sign-in service, does not chain to a CA the driver
trusts. The driver trusts the operating system's CAs: on Windows, the machine's
trusted root store; on Linux, the distribution's CA bundle (RHEL, Debian /
Ubuntu and SUSE layouts). On Linux, setting SSL_CERT_FILE or SSL_CERT_DIR
replaces that bundle, so check that a value left over from older setups points
at a complete bundle. For a server signed by a private CA, trust that CA with
tls_ca_file (connection string ServerCertificate) instead of turning
verification off. See
Authentication → TLS.
tls_ca_file and the Windows trusted root store since ArpeMSSQL v0.7.0; the Linux
distribution's CA bundle (and the Windows store for Entra ID sign-in) since
ArpeMSSQL v0.7.3. Earlier versions needed SSL_CERT_FILE on RHEL 8 and Windows.
"certificate verify failed" / hostname mismatch. With encrypt=true the
server certificate and hostname are verified by default. For a server whose
certificate is not publicly trusted (a private CA, or the server's own
self-signed certificate), trust it with tls_ca_file; if the certificate names
a different host (an alias, a load balancer), set host_name_in_certificate
(connection string HostNameInCertificate). trust_server_cert=true turns
verification off: keep it for development servers, never production. For an
IP-literal host, the cert must carry a matching iPAddress SAN.
Azure SQL rejects an unencrypted connection. Azure requires TLS — set
encrypt=true (the default-safe path handles SNI + verification), or
tds_version=8.0 if the server enforces strict encryption.
Windows: driver DLL not found / fails to load. The released
arpemssql_adbc_driver-win-x64.dll is self-contained (TLS and the C runtime are built
in), so no OpenSSL or VC++ runtime DLLs are needed. Check that the client process
is 64-bit (the DLL is x64) and that the driver manager can find the driver —
see the install guide.
Authentication
Login failed for user '…'. SQL login credentials are wrong, or the login is
disabled / lacks access to the database. Confirm with sqlcmd/SSMS first.
Integrated auth on Linux: "needs MIT Kerberos, which was not found". The
driver loads MIT Kerberos at the first Kerberos login and this host has none:
install krb5-libs (RHEL, Rocky, Fedora) or libgssapi-krb5-2 (Debian,
Ubuntu). SQL logins do not need it.
Kerberos integrated authentication on Linux since ArpeMSSQL v0.7.5. Earlier Linux releases had no integrated authentication.
Integrated auth: "Cannot generate SSPI context" / GSSAPI or
InitializeSecurityContext: SSPI 0x… errors. The Kerberos SPN usually did not
match. The driver derives MSSQLSvc/host:<resolved-port> — for a named instance
the port is the resolved one. Ensure the SPN is registered for the SQL Server
service account, connect by FQDN, and check that you have a valid ticket
(klist). On Linux, point at the right credential cache or keytab with
adbc.arpemssql.krb5.ccache / adbc.arpemssql.krb5.keytab. Override the SPN
with adbc.arpemssql.krb5.spn if needed. Details in
Authentication.
Integrated auth on Windows: "negotiated NTLM, not Kerberos, and
adbc.arpemssql.require_kerberos is set". Kerberos was not possible (no domain,
no SPN registered, the server named by IP address or an alias, or a loopback
login), so Negotiate fell back to NTLM, which require_kerberos refuses. Connect
by the server's fully qualified name and register the SPN
MSSQLSvc/<fqdn>:<port> for the SQL Server service account, or set
adbc.arpemssql.krb5.spn to the registered SPN. See
Authentication → NTLM fallback.
adbc.arpemssql.require_kerberos since ArpeMSSQL v0.7.6.
Entra ID: "Federated auth cannot be combined with a password." Remove
username/password — federated (token) auth is exclusive and always uses full
TLS. Also ensure encrypt=true.
Entra ID: token acquired but "login failed". The identity (user, service
principal, or managed identity) must be a database user:
CREATE USER [<name>] FROM EXTERNAL PROVIDER. A valid token for a principal with
no database mapping still fails login.
auth_type=ActiveDirectory… rejected. Only ActiveDirectoryDefault (the
credential chain) is a valid auth_type. For the other Entra modes use the
dedicated options: access_token, tenant_id+client_id+client_secret, or
managed_identity. In a connection string or URI, the Authentication= keyword
also accepts ActiveDirectoryServicePrincipal and
ActiveDirectoryManagedIdentity (or ActiveDirectoryMSI), as does the URI's
fedauth parameter. For a service principal, User ID is the client id and
Password the secret; the tenant is not discovered from the server, so give it
as <client id>@<tenant> or with adbc.arpemssql.tenant_id. The interactive and user-password values
(ActiveDirectoryPassword, ActiveDirectoryInteractive,
ActiveDirectoryDeviceCodeFlow, ActiveDirectoryIntegrated,
ActiveDirectoryWorkloadIdentity) return NOT_IMPLEMENTED. See
Connection.
Authentication=ActiveDirectoryServicePrincipal / ActiveDirectoryManagedIdentity
and the URI fedauth parameter since ArpeMSSQL v0.7.5.
Licence
Connection fails with an ARROW_LIC_* error. No valid Arpeio licence was
found. Supply one via arpeio.adbc.license_file (a .lic path),
arpeio.adbc.license (the blob inline), the ARPEIO_ADBC_LICENCE[_FILE]
environment variable, or an arpeio_adbc.lic file next to the driver library. The
installer's --license flag places the file for you. Full detail — including how
to read the current licence state with arpeio.adbc.license.status — is in
Licensing.
Query & ingest
Ingested rows disappear after the connection closes. With the DB-API
default autocommit=False, an ingest joins your open transaction and is rolled
back unless you call commit(). Commit, or open the connection with
autocommit=True. See Bulk ingest an Arrow table.
Another connection can't read the table during an autocommit=False ingest.
The ingest is part of your transaction and takes a table lock (TABLOCK, the
default): readers wait until you commit() or rollback(). Set
arpemssql.bulk_tablock=false to take row locks instead (loses minimal logging).
adbc_ingest(mode="create") fails "already exists". The target table exists;
the driver returns ALREADY_EXISTS (SQL Server error 2714). Use append,
replace, or create_append.
Ingest fails "Invalid column type from bcp client" (error 4816). INSERT BULK
declares each column nullable or not, and SQL Server rejects a declaration that
differs from the target column. The driver declares what the target table has,
as the server describes it: this covers an unqualified name resolved through your
default schema or falling back to dbo, a synonym, a #temp table, and a column
name that differs in the case of a non-ASCII letter (état for ÉTAT). On a
server that cannot describe the target (no sys.dm_exec_describe_first_result_set),
the driver reads INFORMATION_SCHEMA.COLUMNS instead, which misses those cases:
there, declare the Arrow field to match the column
(pa.field("id", pa.int32(), nullable=False) for a NOT NULL column).
Before v0.7.6, every load of WKB into a geometry or geography column failed
with this error; upgrade to v0.7.6 or later.
Since ArpeMSSQL v0.7.4. Earlier versions found no target columns for a synonym, a default-schema fallback or a case-differing non-ASCII name, and the load failed with this error.
Ingest fails "OLE DB provider 'STREAM' for linked server '(null)' returned
invalid data for column '[!BulkInsert].x'". This is SQL Server's own wording
(error 7339) for a bulk-loaded value it cannot store; the driver uses no OLE DB.
The usual cause is a float NaN or infinity, which SQL Server cannot store in any
type; the driver rejects those before sending, naming the column and row
(Column 'x', row 3: value NaN: SQL Server cannot store NaN or infinity).
Replace them with NULL:
import pyarrow.compute as pc
col = pc.if_else(pc.is_finite(col), col, None)
Any other 7339 is reported as "SQL Server rejected a value in column 'x' as invalid for its type", followed by the server's text.
Ingest fails "String or binary data would be truncated … Truncated value: '…'".
SQL Server error 2628 for a value longer than its column; for an NVARCHAR
column the server shows the bulk-streamed value as garbage, and the error has no
row number. The driver checks values against the target column's declared length
before sending and names the column and row:
Column 's', row 1: value of 20 characters is longer than NVARCHAR(10).
NVARCHAR/NCHAR(n) count UTF-16 code units (an emoji takes two),
VARBINARY/BINARY(n) bytes, and VARCHAR/CHAR(n) bytes in the column's code
page. A VARCHAR column the server converts itself (a UTF-8 collation, or a
string_view source) is not checked: there the server's message stands, and it
is correct.
Since ArpeMSSQL v0.7.4.
A rejected value raises ProgrammingError, not OperationalError. On bulk
ingest and on statements with bound parameters, the SQL Server errors that reject
a value (245 conversion failed, 515 NULL into NOT NULL, 2628/8152 truncation,
8115 arithmetic overflow, 7339 invalid bulk data, 8023 invalid parameter value)
map to INVALID_ARGUMENT, like the driver's own value checks. The server does
not say which value caused it: on a bound statement it can also be a stored row
the statement converts. Other errors keep their status (a deadlock is still
retryable), and statements without parameters are unchanged.
executemany with a failing row: which rows were written? The same rows as
if each row ran on its own: the rows before the failing one are kept (committed
in autocommit, part of your transaction otherwise), the failing row raises, the
rows after it do not run. The driver sends bound rows in batches of up to 1000
per request and replays a failed batch row by row to find the failing row. One
visible difference: in autocommit, other sessions see the rows appear a batch at
a time. Statements that contain BEGIN TRAN, COMMIT, ROLLBACK or SAVE run
row by row. If the error rolls back your whole transaction (XACT_ABORT ON, a
deadlock), nothing is replayed: the transaction is lost, as it would have been
row by row.
The error names the failing row, numbered from 0 across all batches of a
parameter stream, and how many rows ran before it, so you can resume from it:
Bound statement failed at parameter row 1234 (1234 rows before it were executed): SQL Server error 2627 …. When a batch is not replayed (the
transaction was rolled back), it names the batch instead:
… failed in parameter rows 1000-1999 (1000 rows before them were executed).
Batched bound DML since ArpeMSSQL v0.7.0; the failing row number in the error since ArpeMSSQL v0.7.4.
A query fails with "SQL placeholder count mismatch". The number of bound
values differs from the markers in the SQL. The message says how many values
were bound and how many ? markers the SQL has (or the highest @pN it uses).
Mark parameters with ?, or, in SQL without any ?, with @p1 .. @pN; the two
cannot be mixed. Before v0.7.6 only ? was accepted, so queries from DuckDB's
adbc_scanner with a pushed-down filter failed this way. See
Examples → Prepared statements.
A query fails with "column N is sql_variant, which this driver cannot read".
Versions before v0.7.6 could not read sql_variant columns, which includes
SERVERPROPERTY(...) and some system views. Upgrade, or CAST the column to
nvarchar in the query. See Data types → sql_variant.
After a query fails on a column, the next statement fails with "The connection
to the server was lost while a transaction was open". Versions before v0.7.6
reset the connection when a query failed on a column the driver cannot read and
the rest of the result was still arriving: the transaction rolled back and
#temp tables were gone. Since v0.7.6 the driver cancels the request and only
that query fails.
Ingest fails "curves/FullGlobe are read-only on ingest". Versions before
v0.7.6 could not load CircularString, CompoundCurve, CurvePolygon or a
geography FULLGLOBE; upgrade. Since v0.7.6 a compound curve whose pieces do not
join, or a circular string with an even number of points, is refused as malformed
WKB.
A geospatial column reads as opaque bytes I can't parse. That is
geospatial=varbinary (raw CLR-UDT bytes). Use the default geoarrow (or wkb)
mode for interoperable output. See Geospatial types.
Getting the SQL Server error number. Errors raised by the server carry its
error number, state, severity and message as ADBC error details
(arpemssql.sqlserver.error_number, .state, .severity, .message); in Python
read them from the exception's details. Clients on the ADBC 1.0 error API get
the error number in vendor_code.
Cancelling a long query. Connection.Cancel / Statement.Cancel stop the
running query server-side; the interrupted call fails with ADBC_STATUS_CANCELLED
(a result stream ends with "Query cancelled") and the connection stays usable. If
the server stays silent for 5 s after the cancel, the call still fails as
cancelled and the connection is reset on next use, which loses an open
transaction.
Since ArpeMSSQL v0.6.8. Earlier versions returned NOT_IMPLEMENTED.
A query fails with "Query timed out: no reply from the server within
query_timeout". The server sent nothing for query_timeout seconds. The
timeout applies to each wait, not to the whole query, so a long result that keeps
streaming never times out. The driver cancels the query as Cancel does and the
call fails with ADBC_STATUS_TIMEOUT; the connection keeps its session, open
transaction and #temp tables. The default 0 waits as long as the server
needs: raise query_timeout or set it back to 0 for slow queries. See
Connection → Timeouts & performance.
Since ArpeMSSQL v0.7.0 (query_timeout applies to queries; before, every read
failed after 30 s of silence with "Recv timed out after 30 seconds"). Cancelling
on timeout, keeping the connection, since ArpeMSSQL v0.7.2.
See also
- Connection · Authentication · Licensing
- Compatibility — is your target actually supported?