Skip to content

Database Proxy: Microsoft SQL Server

The 12Port Database Proxy brokers native database connections. Users connect their usual SQL Server client (SSMS, DBeaver, sqlcmd, a JDBC, ODBC or .NET application) to the 12Port Database Proxy instead of to the database. 12Port authenticates the user, checks their access to the database asset, and logs in to SQL Server with the asset's own account. The user never sees or handles the database password: 12Port injects it into the backend login.

Every session is listed in 12Port and can be terminated from there, but the client can reconnect while the user still has access to the asset. To prevent new connections, complete the user's approved access request (see Ending Access). When the asset's access profile asks for it, the session is recorded as a readable, encrypted transcript of statements, parameter values, result rows, row counts, messages and errors, and each statement is saved as a session event.

The proxy is agentless: nothing is installed on the database server or on the client.

This guide covers Microsoft SQL Server and Azure SQL Database. For Oracle Database, see the Oracle guide. Both use the same Database Proxy port.


How it works

  1. The user's client connects to the 12Port Database Proxy port. It names the database asset as its database, or adds it to the login name as user#asset.
  2. The proxy recognizes the SQL Server protocol (TDS) and answers the client's PRELOGIN itself. It encrypts the client connection with TLS, inside PRELOGIN as SQL Server does, or from the first byte for TDS 8 (strict) clients.
  3. The client logs in with the user's 12Port user name and password stored as their transit credential (SQL Server authentication), not with the database account.
  4. 12Port authorizes the session: asset permissions, an approved access request where the asset needs one, the access profile, and MFA.
  5. The proxy connects to the server named by the asset's URL, directly or through a peer gateway. The connection is always encrypted, and the server's certificate is checked.
  6. The proxy logs in to SQL Server as the asset's account: SQL Server authentication, NTLM, Kerberos, or Entra ID (Azure SQL). When the server redirects the login (Azure SQL, availability-group read-only routing), the proxy follows the redirect; the client stays connected to the proxy.
  7. From then on, the proxy relays the client's traffic to the server and, when recording is on, writes a transcript and statement events as the session runs.
    1. When either side disconnects, or the session is terminated in 12Port, both connections close and the session is completed. After a termination, the client can reconnect and start a new session until the user's approved access request is completed.

Because the client authenticates to 12Port and not to SQL Server, the user needs no database login or password of their own, and 12Port can automatically rotate the database account's password without notifying users.


Supported Servers and Clients

The proxy has been tested with:

Component Tested versions
SQL Server 2017, 2019, 2022, 2025 (Linux); 2025 Express, named instance (Windows Server 2022); 2022 on Linux joined to an Active Directory domain
Azure SQL Database Serverless, connection policy Redirect (TDS 8 strict also tested)
JDBC Microsoft JDBC Driver (mssql-jdbc) 13.4, 13.6
DBeaver 26.2
SQL Server Management Studio 21 (query window and Object Explorer)
sqlcmd ODBC Driver 17 and 18 for SQL Server; go-sqlcmd
.NET System.Data.SqlClient and Microsoft.Data.SqlClient, MARS on and off
Other Windows' built-in SQL Server ODBC driver (SQLSRV32, TDS 7.1), FreeTDS tsql, Python pymssql

Protocol support: TDS 7.1 to 7.4 and TDS 8.0 (strict encryption), MARS (multiple active result sets), and table-valued parameters.

Logon methods:

Connection Methods
Client to proxy SQL Server authentication only, with the 12Port user name and stored password. Windows authentication (Integrated Security), Entra ID, and certificate logon to the proxy are refused.
Proxy to SQL Server SQL Server authentication, NTLM, Kerberos, or Entra ID (application and client secret), chosen on the asset.

One listening port serves every database type. The proxy recognizes the protocol from the client's first bytes.


Requirements

  • 12Port tenant with the Database Proxy enabled (Configuration > Database Proxy).
  • A Database Access Server port assigned to the tenant and reachable from the users' clients.
  • Network access from the 12Port node (or from a peer gateway) to the SQL Server port. For a named instance without a port, also UDP 1434 (SQL Server Browser).
  • For each database: an asset of the SQL Server Database type, with a URL, a user name and a password.
  • For each user: a 12Port user account with permission and an appropriately configured access profile on the asset. The user must log in to the 12Port web portal one time before a proxy session can authenticate properly.

Configuration

1. Tenant Port

Each tenant has its own Database Access Server port, assigned automatically starting from 15200. It is shown on the tenant's Configuration > Database Proxy page.

After changing a tenant's Database Access Server port, open the Database Proxy page and save it once so that the listener moves to the new port.

2. Database Proxy Page

Open Configuration > Database Proxy.

Setting Description
Server Port The tenant's Database Access Server port (read-only). Can only be changed from the /base tenant.
Require TLS On (default): clients must encrypt the connection. A client that cannot encrypt is refused after PRELOGIN. Off: such clients log in without encryption; every client that can encrypt still does.
Share Session Across Programs Whether other programs on the same client machine join an open session (see Sessions).
Certificate subject, fingerprint, validity The certificate the proxy presents to TLS clients. The fingerprint is shown as SHA256:<HEX>.
Provide your certificate Generate a certificate automatically, keep the existing one, or import your own: PEM, PEM bundle (certificate chain and key) or PKCS#12.
Download certificate Downloads the proxy certificate, for clients that must trust it explicitly.
Enabled Starts or stops the tenant's Database Proxy listener.

A generated certificate names the 12Port host (the host of the tenant's URL) in its subject CN and subject alternative name. Clients that check the server name must connect to that host name, or name it explicitly (see Trusting the Proxy Certificate).

Changes to the certificate or to Require TLS take effect for new connections immediately, without restarting the listener. Open sessions keep the settings they started with.

If no certificate exists yet, no client can connect over TLS. Save the page once with Generate certificate automatically selected.

3. Database Assets

Create an asset of the SQL Server Database type for each database.

Field Description
Name The name users connect with (see Naming the Asset).
URL A SQL Server JDBC URL naming the server, port or instance, and database. See the forms below.
User The account the proxy logs in as. Its form depends on Authentication.
Password That account's password, or the application's client secret for Entra ID. 12Port can manage and rotate the password like any other asset password.
Authentication (Hidden) How the proxy logs in to SQL Server: Database (default), NTLM, Kerberos or Entra ID. See Backend Authentication.
Realm, KDC (Hidden) For Kerberos: the Kerberos realm (for example CORP.CONTOSO.COM) and the KDC host.
Tenant Id (Hidden) For Entra ID: the Entra ID tenant of the application. Optional.
Trust Certificate Accept any server certificate without checking it. Off by default. See Server Certificate.

Accepted URL Forms

Form Example
Host, port, database jdbc:sqlserver://db.contoso.com:1433;databaseName=Sales
Default port (1433) jdbc:sqlserver://db.contoso.com;databaseName=Sales
Named instance (port from SQL Server Browser) jdbc:sqlserver://db.contoso.com\SQLEXPRESS;databaseName=Sales
Named instance with its port jdbc:sqlserver://db.contoso.com\SQLEXPRESS:52319;databaseName=Sales
Properties only jdbc:sqlserver://;serverName=db.contoso.com;portNumber=1433;databaseName=Sales
TDS 8 (strict) to the server jdbc:sqlserver://db.contoso.com:1433;databaseName=Sales;encrypt=strict
Kerberos service principal jdbc:sqlserver://db.contoso.com:1433;databaseName=Sales;serverSpn=MSSQLSvc/db.contoso.com:1433
Azure SQL Database jdbc:sqlserver://myserver.database.windows.net:1433;databaseName=Sales
jTDS jdbc:jtds:sqlserver://db.contoso.com:1433/Sales

Notes:

  • Name the database in the URL. The backend session always starts in the URL's database. Without one, it starts in the account's default database, usually master. On Azure SQL Database, a session in master cannot reach the user database at all; queries against it fail with Cross-database queries are not supported in this version of SQL Server or with error 40515.
  • databaseName and database are both accepted, and so is /database after the host.
  • User and password properties in the URL are ignored; the proxy uses the asset's fields.
  • Other driver properties (encrypt=true, trustServerCertificate, hostNameInCertificate, etc) are ignored. The proxy always encrypts its connection to the server; only encrypt=strict changes how.

4. Backend Authentication

The Authentication field chooses how the proxy logs in to SQL Server as the asset's account. The client always logs in to the proxy the same way, with its 12Port user name and password.

Authentication User Password Also set
Database A SQL Server login, for example app_owner Its password —
NTLM DOMAIN\user, user@domain, or a local Windows account The account's password —
Kerberos DOMAIN\user or user@REALM The account's password Realm, KDC
Entra ID A user principal name, or the application (client) ID of an Entra ID app registration The user's password, or the application's client secret Tenant Id (optional)

NTLM

The proxy uses NTLMv2. It does not send channel binding, so a server with Extended Protection set to Required refuses the login. The default (Off) works, and so does Allowed.

Kerberos

The proxy logs in to the realm's KDC with the asset's account and requests a service ticket for the server, then checks the server's reply (mutual authentication).

  • The service principal is MSSQLSvc/<host>:<port>, with the host as written in the URL (an IP address is first resolved to its host name). When the server's SPN is registered differently, for example MSSQLSvc/host.corp.contoso.com:SQLEXPRESS for a named instance, give it with serverSpn in the URL.
  • The SPN must be registered on the SQL Server service account (setspn -L <account>). A missing SPN fails the login, and the reason is in the 12Port log.
  • The KDC is contacted from the 12Port node, also for an asset behind a peer gateway, over TCP port 88. An unreachable KDC fails the login after about 5 seconds.
  • Kerberos logins and service tickets are cached per account until the ticket nears expiry, so repeated connections do not contact the KDC each time. A changed password is picked up at the next login.

Entra ID

Entra ID authentication works with Azure SQL Database and Azure SQL Managed Instance. The proxy gets an access token for Azure SQL from Entra ID and logs in with it. Two methods are supported:

Method User Password
Entra ID user The user principal name, for example svc-sales@contoso.com The user's password
Application The application (client) ID of an Entra ID app registration The application's client secret

To set up Entra ID authentication:

  1. In Entra ID, create or choose the user account the proxy logs in as. For the application method, register an application and create a client secret for it.
  2. In the database, create a user for that identity and grant it the access it needs. Name the user by its user principal name, or by the application's display name in Entra ID. For example:
CREATE USER [svc-sales@contoso.com] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [svc-sales@contoso.com];

CREATE USER [my-app-name] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [my-app-name];
3. On the asset, set Authentication to Entra ID. Enter the user principal name or client ID in User and the password or client secret in Password.

Tenant Id is optional. When it is set, the proxy requests the token from that tenant before it connects. When it is empty, the server returns its tenant during the login and the proxy requests the token from that tenant.

When the tenant comes from the server, the proxy sends the password or client secret only to an Entra ID authority of the Azure public cloud (login.microsoftonline.com, login.windows.net), and only to request an Azure SQL token. The proxy refuses a server that names any other authority.

Limits: both methods work in the Azure public cloud only. The proxy does not support MFA or interactive logon, so an Entra ID user that requires MFA cannot log in through the proxy. For these accounts, use the application method instead. Entra ID does not apply MFA to an application, although Conditional Access policies for workload identities can still block it. Certificate credentials and managed identities are not supported.

5. Server Certificate

The proxy always encrypts its connection to SQL Server and checks the server's certificate, unless the asset's Trust Certificate field is on.

A certificate is accepted when both are true:

  • It chains to a certificate in the tenant's Trusted certificate store, or to a public certificate authority known to the keystore (as Azure SQL's certificates do).
  • It names the host the asset's URL connects to.

SQL Server creates a self-signed certificate when none is configured, and such a certificate fails the check. For these servers, either:

  • import the server's certificate, or the authority that issued it, into the tenant's Trusted store; or
  • turn on Trust Certificate on the asset. The connection is still encrypted, but the server's identity is not checked.

A server that does not support encryption at all is refused.

When a login is routed to another server (Azure SQL redirect, availability-group routing), that server's certificate is checked against the host name it was routed to.

6. Access Control

The Database Proxy applies the same checks as the other 12Port proxies.

Check Where it is configured Effect
Permission Asset or site roles The user needs a role on the asset, or a site role of Asset Manager or Administrator.
Access request Asset workflow Where the asset requires an approved request, the user must have one prior to connecting.
Access profile Asset's access profile Native Session = Deny refuses the connection. Native Session = Allow allows the connection, Native Session = Allow and Record allows the connection and generates a session transcript. Keyboard = Allow and Record saves each statement as a session event. A user without an assigned access profile is refused.
MFA Tenant or user MFA policy The MFA code is appended to the user name (see Username).

Every refusal reaches the client as error 18456, Login failed for user '<user>'., the same answer as a wrong password, so a client cannot learn which check failed. The reason is written to the 12Port log.

7. User Transit Credential

Each user sets a transit credential in My Account > Profile > Transit Credentials. This is their personal password used to authenticate into 12Port and by the proxies. If one is not assigned, please click the available button and enter the current password.

A user without a transit credential cannot log in through the proxy.

8. Peer Gateways

A server that the 12Port node cannot reach directly can be reached through a peer gateway. Link the asset to a peer node (Manage > Peer Nodes) as for any other asset. The proxy then opens its connection to SQL Server through the peer's HTTP proxy tunnel, and the session lists the peer as its gateway.

  • The URL's host and port are resolved by the peer, so they must be valid from the peer's network.
  • For a named instance without a port, the SQL Server Browser query (UDP 1434) also goes through the peer. This needs a peer node of the same 12Port version; an older peer refuses the query, and the login fails with that reason in the 12Port log.
  • Redirected logins (Azure SQL, availability groups) also go through the peer.
  • When the asset's peer is down, the login is refused; the proxy does not fall back to a direct connection.
  • Kerberos KDC requests are made from the 12Port node, not through the peer.

A change to an asset's peer link applies to new connections within 10 seconds.


Connecting

Naming the Asset

The client names the asset in one of two ways:

Way Login name Database
Asset as the database alice sales-db (the asset name)
Asset in the login name alice#sales-db The asset name, the URL's database, or empty
  • The asset name is matched exactly, ignoring case. Assets in personal spaces are not matched. The asset's id (a UUID) can be used instead of its name.
  • Use the user#asset form for clients that cannot set a database, or that list databases before they connect.
  • With user#asset, a database other than the asset or the URL's database is refused. Only when the asset's URL names no database does the client's database choice reach the server.

If several assets share a name and also share the same site, URL and peer, the user's permissions choose among them. If the same-named assets differ, or the user may use more than one of them, the connection is refused. Rename one of the assets, or connect by asset ID.

The session always starts in the asset's database. The login response reports it under the name the client asked for, so the client shows the asset name as its current database. A USE of the asset's name is answered by the proxy (SSMS, pymssql and tsql send one after logging in).

Username

The login name is the user's 12Port user name, with SQL Server authentication:

[DOMAIN\]user[?code][#asset]
Part Meaning
DOMAIN\ The directory domain for directory users, for example CORP\alice. Omit it for local 12Port users.
user The 12Port user name.
?code The current MFA code, when MFA is required. &code works the same way.
#asset The asset, when the client does not name it as the database.

The password is the user's personal password for 12Port authentication stored as their transit credential.

Choose SQL Server Authentication in the client, not Windows authentication: a DOMAIN\user name with SQL Server authentication is a 12Port directory user, not a Windows logon.

Trusting the Proxy Certificate

Current drivers encrypt by default and check the server's certificate. With the proxy, that is the proxy's certificate. Either trust it, or tell the client not to check it (not recommended for production use).

Client Trust the proxy certificate Skip the check
mssql-jdbc, DBeaver Import the downloaded certificate into a trust store and set trustStore, trustStorePassword (and trustStoreType=PKCS12); or, on Windows, import it into the Windows store and run the JVM with -Djavax.net.ssl.trustStoreType=Windows-ROOT trustServerCertificate=true
SSMS, ODBC Driver 18, sqlcmd, .NET on Windows Import the certificate into the Windows Trusted Root Certification Authorities store SSMS: Trust server certificate. ODBC: TrustServerCertificate=yes. sqlcmd: -C
ODBC, sqlcmd, go-sqlcmd on Linux Add the certificate to the system's trusted certificates (update-ca-certificates) TrustServerCertificate=yes, -C

The certificate names the 12Port host. A client that connects by IP address or another name must name the certificate's host: hostNameInCertificate=<12Port host> (JDBC), HostNameInCertificate=<12Port host> (ODBC 18, Microsoft.Data.SqlClient), or Host name in certificate in SSMS.

Connection Examples

In the examples, proxy.contoso.com is the 12Port host, 15200 the tenant's Database Access Server port, and sales-db the asset name. SQL Server tools write the port after a comma: proxy.contoso.com,15200.

JDBC (mssql-jdbc)

jdbc:sqlserver://proxy.contoso.com:15200;databaseName=sales-db;encrypt=true;trustStore=/path/to/proxy-truststore.p12;trustStorePassword=<password>;trustStoreType=PKCS12

User alice, password the transit credential. For TDS 8, use encrypt=strict.

DBeaver

Create a SQL Server connection:

Field Value
Host / Port proxy.contoso.com / 15200
Database sales-db
Authentication SQL Server Authentication
Username / Password alice / the password stored as transit credential
Driver properties trustStore, trustStorePassword, trustStoreType, or trustServerCertificate=true

DBeaver opens several connections (navigator, metadata, each SQL editor); they are recorded as one session. Turn off Show All Databases in the connection settings: the proxy session can use only the asset's database.

SSMS

Field Value
Server name proxy.contoso.com,15200
Authentication SQL Server Authentication
Login / Password alice#sales-db (or alice with the database set under Connection Properties > Connect to database: sales-db) / the password stored as transit credential
Encryption Mandatory, or Strict
Trust server certificate Off once the proxy certificate is trusted

sqlcmd

sqlcmd -S tcp:proxy.contoso.com,15200 -U alice -d sales-db

Add -C to skip the certificate check, -N s for TDS 8 (strict) with go-sqlcmd or ODBC 18.

.NET (Microsoft.Data.SqlClient)

Server=tcp:proxy.contoso.com,15200;Database=sales-db;User ID=alice;Password=<transit credential>;Encrypt=Mandatory

ODBC

Driver={ODBC Driver 18 for SQL Server};Server=tcp:proxy.contoso.com,15200;Database=sales-db;UID=alice;PWD=<transit credential>;Encrypt=yes

Connection Cases

The client's connection to the proxy and the proxy's connection to the server are independent.

Client to Proxy

Client asks for Require TLS on Require TLS off
Encryption (current drivers' default, encrypt=true, Mandatory) TLS TLS
Encryption off, but supported (encrypt=false) TLS for the whole connection TLS for the whole connection
No encryption support (old or misconfigured clients) Refused after PRELOGIN Connected without encryption
TDS 8 strict (encrypt=strict, Strict) TLS from the first byte TLS from the first byte

The proxy encrypts the whole connection, not only the login, whenever the client supports encryption.

Proxy to Server

Asset URL Proxy to server connection
No encrypt property, or any value but strict TLS negotiated in PRELOGIN, whole connection encrypted
encrypt=strict TDS 8: TLS from the first byte
Server without encryption support Refused

The server's certificate is checked unless Trust Certificate is on (see Server Certificate).

Redirected Logins

Azure SQL Database (connection policy Redirect) and availability groups with read-only routing answer the login with another server to use. The proxy follows up to 10 redirects within one 30-second limit, through the asset's peer when it has one. The client stays connected to the proxy, and the transcript's "opened" line says where the login was routed.

Azure SQL Database

  • Use one asset per database, with the database in the URL. A session cannot switch databases on Azure SQL Database.
  • A serverless database that is paused resumes on the first login, which can take longer than the proxy waits for one login step (15 seconds). If the first login after a pause fails, try again after a minute.
  • Entra ID logon is described under Backend Authentication.

Canceling a Running Statement

A client's cancel request (JDBC Statement.cancel(), a query timeout, SSMS Cancel Executing Query, Ctrl+C in sqlcmd) is relayed to the server, which stops the statement. The session stays open, and the transcript records the statement as canceled by the client.


Sessions

Each connection that passes authorization joins a 12Port session:

Property Value
Channel DBP:MSSQL
Account The asset's database account
Gateway The 12Port node and Database Access Server port, or the peer gateway
Status Active while connected; Completed when closed; Terminated when ended from 12Port
  • One session per client. The connections a client opens together (DBeaver's navigator, metadata and editor connections; SSMS's Object Explorer and query windows) are one session. The user passes MFA once, the transcript names the connection of each statement, and terminating the session closes all of them. The session ends a minute after its last connection closes.
  • Share Session Across Programs: when on (the default), other programs from the same 12Port user, client IP address and operating-system user join the open session without MFA. When off, each program has its own session.
  • Terminate: terminating the session in 12Port closes its connections within a few seconds, and the client sees a lost connection. The proxy authorizes each new connection on its own, so the client can reconnect right away and start a new session. To prevent this, complete the user's approved access request (see Ending Access).
  • Sessions report: the asset view of an SQL Server Database asset includes the Sessions report.
  • Failed backend logins: when SQL Server rejects the asset's account (for example after its password was changed outside 12Port), or its certificate is not trusted, the session records an error event with the reason, and the client receives error 18456.

Ending Access

Terminating a session closes its current connections only. While the user still has access to the asset, their client can reconnect and the proxy authorizes a new session.

To end a user's access to an asset that requires an access request, complete their approved request first and then terminate the session. The open connections close, and the proxy refuses any new connection from that user with error 18456.


Recording

Recording is controlled by the user's access profile:

Access profile setting What is recorded
Native Session = Allow and Record An encrypted transcript of the session, downloadable from the session list.
Keyboard = Allow and Record Each statement as a session event.
Both Both.

Recording observes the relayed traffic without changing it. If part of the traffic cannot be read, the transcript says so and the session continues unaffected.

Transcript

The transcript is plain text: comment lines start with --, statements are written as sent, and result rows are written as CSV.

-- 12Port database session 6f1c...
-- user alice as app_owner on asset sales-db (DBP:MSSQL)
-- started 2026-11-23T09:41:58.031+01:00[Europe/Berlin]
-- 2026-11-23 09:41:58.120 connection 2 Metadata opened: program DBeaver 26.2.5 - Metadata, machine WS-ALICE
-- 2026-11-23 09:42:00.577 #1 QUERY
SELECT id, name, created FROM customers WHERE region = @P0
-- binds: EMEA
-- columns: id int, name nvarchar(100), created datetime2
id,name,created
1,Acme,2024-02-29 00:00:00.0000000
2,Globex,2025-01-15 00:00:00.0000000
-- 2 rows
-- 2026-11-23 09:42:05.102 #2 CHANGE
UPDATE customers SET name = @P0 WHERE id = @P1
-- binds: Acme Ltd, 1
-- 1 row affected
-- 2026-11-23 09:42:05.140 #3 TRANSACTION
COMMIT TRANSACTION
-- done
-- 2026-11-23 09:42:09.881 #4 QUERY
SELECT * FROM no_such_table
-- error 208: Invalid object name 'no_such_table'.
-- 2026-11-23 09:42:12.003 connection 2 Metadata closed

For each statement, the transcript records:

Item Recorded as
Time and sequence -- <time> #<n> <kind>
Statement text As sent: a SQL batch, or the statement a procedure call runs (sp_executesql, prepared statements, cursors), or EXEC <procedure> for a stored procedure call
Parameter values -- binds: ..., in order. NULL is shown as empty.
Result columns Name and type
Result rows CSV, up to the row limit
Messages PRINT and informational messages
Output parameters output parameter: <value>
Outcome Row count (5 rows, 1 row affected), done, or error <number>: <message>

A batch with several statements is one transcript entry, with each result in turn.

Statement kinds:

Kind First keyword
QUERY SELECT, WITH, VALUES, TABLE
CHANGE INSERT, UPDATE, DELETE, MERGE
DEFINITION CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE
CALL EXEC, EXECUTE, DECLARE, BEGIN (a block)
TRANSACTION BEGIN TRAN[SACTION], SAVE TRAN[SACTION], COMMIT, ROLLBACK, SET TRANSACTION, and the transaction requests drivers send (recorded as BEGIN TRANSACTION, COMMIT TRANSACTION, and so on)
OTHER Anything else, such as USE or SET

Limits

Limit Value In the transcript
Text value size 64 KB Larger values are recorded as type and size
Binary values Always Recorded as type and size, for example <varbinary 4 bytes>
Rows per result 1000 -- rows after the first 1000 are counted, not recorded; the total count is always recorded, for example -- 5000 rows, 1000 recorded
One request or one value 16 MB -- a request of over 16 MB was not recorded, or -- the response could not be read (a value of over 16 MB). The client still receives everything.

Statement Events

With Keyboard = Allow and Record, each statement is saved as a session event when the server has answered it:

Statement kind Event type
QUERY SqlQuery
CHANGE SqlChange
DEFINITION SqlDefinition
CALL SqlCall
TRANSACTION SqlTransaction
OTHER SqlOther

The event holds the statement text (up to 4000 characters), its start and end time, and its row count. Each connection's opening is saved as a SqlConnect event with its program, machine and operating-system user.

Recording Cases

Case How it is recorded
Query Columns, rows (to the limit), total row count
Prepared statement run several times The statement text each time, with that run's parameter values
Server cursor (sp_cursoropen, then fetches) The statement, then each fetch (/* fetch */) with its rows
INSERT, UPDATE, DELETE, MERGE Parameter values and the number of rows affected
DDL Statement and done
Stored procedure EXEC <procedure>, parameter values, result sets, output parameters
Bulk load (SqlBulkCopy, bcp, JDBC bulk copy) /* bulk load */ INSERT BULK ..., then the loaded rows as the statement's result (to the row limit)
Table-valued parameter Its type and row count
PRINT, RAISERROR with low severity The message text
Database error -- error <number>: <message>
Statement cancelled by the client The statement, then cancelled by the client
MARS: statements from several result sets interleaved on one connection Each statement in turn; when another statement starts before the first one's rows are all read, the rest of the first is noted as not recorded
Sensitivity classification labels Passed to the client unchanged; rows are recorded as usual
Always Encrypted columns Recorded as encrypted, by type and size; values are not decrypted. Calls with encrypted parameters are noted as not readable
Connection closed before the server answered -- no response: the session ended before the database answered
Through a peer gateway, or a redirected login Recorded the same as a direct connection

Not Recorded

  • Values of binary types (varbinary, image, timestamp), beyond type and size.
  • Text values over 64 KB, beyond type and size; values and requests over 16 MB.
  • Always Encrypted values.
  • Driver housekeeping that is not a statement, such as sp_unprepare and cursor close calls.

When part of a request or response cannot be read, the transcript notes it in place, for example -- a request could not be read (...) or -- the response could not be read (...), followed by the number of rows recorded before that point.

Viewing and Storing Transcripts

Transcripts are stored encrypted in the 12Port recordings directory location, one file per session. Download a session's transcript from the Session Report list. When recording is off, a transcript is not written, saved, or stored.


Troubleshooting

Errors the Client Sees

Error Meaning What to check
18456 Login failed for user '<user>'. Wrong user name or transit credential; Windows authentication used instead of SQL Server authentication; no asset with that name, or the asset's URL is not a SQL Server URL; the database named is not the asset's; a 12Port check denied the user (permission, access request, access profile, MFA, ambiguous asset); or the backend login failed (account rejected, server unreachable, certificate not trusted, Kerberos or Entra ID error). The 12Port log states the reason. For backend failures, the session also shows an error event.
Certificate errors: PKIX path building failed (JDBC); The certificate chain was issued by an authority that is not trusted (SSMS, ODBC, .NET) The client does not trust the proxy certificate. Trust the downloaded proxy certificate, or skip the check (see Trusting the Proxy Certificate).
The target principal name is incorrect / host name mismatch The client connected by a name that is not in the proxy certificate. Connect by the 12Port host name, or set the host name in certificate.
Connection closed right after connecting Require TLS is on and the client cannot encrypt. Turn on encryption in the client, or turn Require TLS off.
40515 or Cross-database queries are not supported in this version of SQL Server (Azure SQL) The session is in master because the asset's URL names no database. Add databaseName=<database> to the asset's URL.
Connection lost The session was terminated in 12Port, or the server closed the connection. The session list and the 12Port log.
Other SQL Server errors Returned by the server and relayed as is. The statement.

Common backend failures in the 12Port log

Log message contains Meaning
The database certificate is not trusted The server's certificate does not chain to the Trusted store or a public authority, or does not name the URL's host. Import its authority into the Trusted store, or turn on Trust Certificate.
the database does not support encryption The server cannot encrypt; the proxy requires it.
did not finish within 30 s The server, or a server the login was redirected to, did not answer in time. A paused Azure SQL serverless database resumes slowly.
Login failed for user (from the server) The asset's User or Password, or the login's permission on the database.
Kerberos errors (Server not found in Kerberos database, Pre-authentication information was invalid) SPN not registered or written differently (use serverSpn); wrong password; wrong realm or KDC.
Entra ID token ... failed Wrong user name or password, wrong application ID or secret, wrong tenant, or an expired secret.

Logging

The proxy logs to the 12Port log under com.otna.proxy.db. To diagnose a problem, set that logger to DEBUG in the 12Port logging configuration on the /base tenant. DEBUG logging includes the connection steps, the reason for every refusal, routing, TLS details, and recording notes.

The logger com.otna.proxy.db.mssql.MssqlTraffic.wire at TRACE writes every packet of a session in hex, including statements and result data. Turn it on only for a short diagnosis.


Security Notes

  • Users never receive the database account's password or the application's client secret; the proxy injects them into the backend login.
  • A wrong password, an unknown user, an unknown asset and a denied user all receive the same error 18456.
  • Keep Require TLS on (the default) so the client connection is encrypted. The proxy always encrypts its connection to SQL Server.
  • Keep Trust Certificate off where possible, and import the servers' certificate authorities into the Trusted store, so the proxy verifies that it is talking to the right server.
  • With Entra ID and no Tenant Id, the password or client secret is sent only to Azure public-cloud Entra ID authorities, and only for an Azure SQL token.
  • Transcripts are encrypted at rest. Session events contain statement text; protect access to session data accordingly.