Skip to content

Database Configuration

Shashank Patil edited this page Jul 26, 2026 · 1 revision

Database Configuration

The Generic SQL API Framework uses a JSON-based configuration file to establish a connection with your database.


Configuration File

The database configuration is located at:

config/database.json

Example Configuration

{
    "driver": "ODBC Driver 18 for SQL Server",
    "server": "localhost\\SQLEXPRESS",
    "database": "AdventureWorks",
    "username": "sa",
    "password": "YourPassword",
    "trustServerCertificate": true
}

Configuration Options

Property Description
driver ODBC driver installed on the system
server SQL Server instance name
database Database to connect
username SQL Server username
password SQL Server password
trustServerCertificate Trust the server certificate

Windows Authentication

If you are using Windows Authentication:

{
    "driver": "ODBC Driver 18 for SQL Server",
    "server": "localhost\\SQLEXPRESS",
    "database": "AdventureWorks",
    "authentication": "windows"
}

SQL Server Authentication

Example:

{
    "driver": "ODBC Driver 18 for SQL Server",
    "server": "192.168.1.100",
    "database": "ProductionDB",
    "username": "sa",
    "password": "Password123"
}

Supported Drivers

Recommended:

  • ODBC Driver 18 for SQL Server

Also supported:

  • ODBC Driver 17 for SQL Server

Testing the Connection

Use the database information endpoint to verify your configuration.

GET /api/database/info

Example response:

{
    "success": true,
    "server": "localhost\\SQLEXPRESS",
    "database": "AdventureWorks",
    "version": "Microsoft SQL Server"
}

Common Issues

Login Failed

  • Verify the username and password.
  • Ensure SQL Server Authentication is enabled.

Server Not Found

  • Confirm the SQL Server instance name.
  • Check firewall settings.
  • Verify SQL Server is running.

ODBC Driver Missing

Install the latest Microsoft ODBC Driver for SQL Server and restart your web server.


Security Best Practices

  • Never commit database passwords to Git.
  • Use environment variables for production deployments.
  • Limit database permissions to only the required operations.
  • Regularly rotate database credentials.

Next Steps

Now that your database is configured, continue with:

  • Your First API
  • JSON Request Format
  • SQL Query Files
  • Examples

Clone this wiki locally