Skip to content

Sqlserver Connection Strings

SQL Server Connection Strings in API Maker

Overview

API Maker requires SQL Server connection strings in a specific format to ensure consistent, reliable connections. This format works across all supported environments when the authentication type matches your SQL Server configuration.


Supported Format

Server=server_ip;User Id=user_id;Password=your_password;Trusted_Connection=False;TrustServerCertificate=True

Example – SQL Authentication (most common in API Maker):

Server=192.168.1.50;User Id=sa;Password=SecurePass123;Trusted_Connection=False;TrustServerCertificate=True

Example – Windows Authentication (less common, requires API Maker host on same domain):

Server=192.168.1.50;Trusted_Connection=True;TrustServerCertificate=True

Parameters Explained

  • server_ip: The IP address or hostname of your SQL Server instance.
  • User Id: Your SQL Server login username (omit for Windows Authentication).
  • Password: Your SQL Server login password (omit for Windows Authentication).
  • Trusted_Connection:

    • True → Use Windows Authentication (integrated security). Requires API Maker to run under a Windows account that has SQL Server access.
    • False → Use SQL Authentication (username/password). Recommended for most cloud or remote setups.
    • TrustServerCertificate:

    • True → Skip certificate validation (useful for development or self-signed certs).

    • False → Validate the certificate (recommended for production with valid SSL/TLS).

Best Practices

  • Prefer SQL Authentication unless API Maker runs in the same Windows domain as SQL Server.
  • Store sensitive credentials in API Maker Secrets, not in plain text.
  • Keep connection string formatting consistent across dev, staging, and prod.
  • Test your connection before deploying to production.
  • Avoid committing credentials to version control.

Connecting SQL Server in API Maker

  1. Go to API Maker → Secret Management → Default.
  2. Select sqlServer as the database type.
  3. Paste your connection string in the correct format for your authentication type.
  4. Test the connection — fix any credential, firewall, or SSL issues.
  5. Once connected, you can:

    • Create schemas for your tables.
    • Use /api/schema/... endpoints for optimized queries.
    • Leverage Deep Populate to join SQL Server with MongoDB, MySQL, PostgreSQL, and more.

Troubleshooting

Issue Possible Cause Solution
Authentication failed Wrong username/password or incorrect authentication mode For SQL Authentication, set Trusted_Connection=False. For Windows Authentication, remove User Id and Password and set Trusted_Connection=True.
Timeout error Network/firewall restrictions or incorrect port Ensure the SQL Server host is reachable and port 1433 is open.
Named instance not connecting Incorrect server name or instance configuration Use server_ip\\instance_name or enable SQL Server Browser service.
SSL/TLS connection issues Certificate validation problems Use TrustServerCertificate=True for testing or self-signed certs, or configure a valid SSL/TLS certificate for production.

FAQs

Q: Can I use a hostname instead of IP?
Yes, if DNS resolves correctly.

Q: Is specifying the port required?
Not if using the default port (1433). Include it like Server=host,port for non-default ports.

Q: Can I connect to a named instance?
Yes, replace server_ip with server\\instance_name.

Q: Does Trusted_Connection=True mean Windows Authentication?
Yes. Only use it if API Maker runs on a Windows machine with domain access to the SQL Server.