SQL Server wire examples
TDS is the connection protocol used by SQL Server clients. These recipes describe existing preview TDS listeners and their limited query compatibility. SQL Server is not offered as a new connection method. The dated driver results apply only to the tested forms.
- Prepare the invoice sampleCreate and load it through an authorized interface.
- Connect a supported driverUse Java or Go with verified TLS.
- Query the top invoicesRun the documented ordering and result-limit form.
- Inspect the five rowsCheck the returned invoice fields and amount order.
Existing SQL Server listener examples
- Connect Java to an existing TDS listener — Use the SQL Server JDBC driver over TLS.
- Connect Go to an existing TDS listener — Use go-mssqldb over TLS.
- Reuse a parameterized statement — Prepare a supported SQL statement and bind new values for each execution.
- Use supported T-SQL forms — The listener translates selected T-SQL query syntax into engine SQL.
- Recognize unsupported T-SQL — Some T-SQL constructs have no supported equivalent here.
Prepare the invoice data
The Java and Go examples read a table named invoices. Ask an administrator to create and load it through an authorized writable interface in the namespace resolved by your connection. Keep read-only credentials read-only; do not change permissions to make a tutorial run.
Small invoice table and five rows
Run each statement separately. Use a disposable table; existing invoices must not be overwritten for this example.
CREATE TABLE invoices (
id BIGINT PRIMARY KEY,
customer_ref TEXT,
amount_cents BIGINT,
status TEXT
);
INSERT INTO invoices (id, customer_ref, amount_cents, status) VALUES
(4101, 'ACME-77', 129900, 'open'),
(4088, 'ACME-12', 98450, 'open'),
(4077, 'ORBIT-3', 61000, 'open'),
(4051, 'ACME-77', 44900, 'open'),
(4020, 'ORBIT-9', 12750, 'open');The five amounts appear in descending order in the connection examples. A successful connection with an empty result is different from a connection failure; check the selected namespace and loaded rows.
Check the connection first
Read the compatibility requirements. Confirm the existing listener, TLS and credential mode before running a write. Current PostgreSQL database logins are read-only; they are not a replacement connection for the write examples on this page.
Microsoft, SQL Server and T-SQL are trademarks of the Microsoft group of companies; mssql-jdbc and go-mssqldb are Microsoft's own drivers. They are named here only to describe protocol and dialect compatibility and to identify the versions it was measured against. OriginChainDB is not affiliated with, endorsed by, or sponsored by Microsoft, and does not distribute Microsoft software.