SQL Parameter Unbinder & Query Hydrator

Parse parameterized SQL log queries containing placeholders (?, $1, :name) and hydrate them with correctly escaped parameter values into ready-to-run SQL.

How to Map and Unbind SQL Log Parameters

1

Paste Raw SQL Query

Paste the parameterized query containing placeholder markers (?, $1, :id) copied from your application backend logger output.

2

Paste Bound Parameters

Paste parameter binding lists. Supports JSON arrays, Hibernate binding statements, pgAdmin params list, or standard comma splits.

3

Execute & Extract SQL

Click "Compile Executable Query" to replace placeholders with correctly escaped values, auto-beautify raw text, and copy to clipboard.

Tool Options

Log Framework Auto-Detection

Automatically decodes parameters format from Hibernate (`binding parameter`), Spring Boot, MyBatis log dumps, or PostgreSQL debug outputs.

SQL Injection Safe Escaping

Correctly formats strings with escaped quotes, parses numerical items, keeps booleans clean, and converts date strings to TO_TIMESTAMP formats.

Beautifier & Indenter

Applies database keywords capitalization (SELECT, WHERE, JOIN) and layouts lines cleanly so you can paste directly to database editors.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the SQL Parameter Unbinder & Query Hydrator do?

The SQL Parameter Unbinder & Query Hydrator reconstructs fully executable SQL queries from parameterized statements extracted from application logs, ORM frameworks (Hibernate, Spring Data JPA, MyBatis, Prisma), or database drivers (PostgreSQL, MySQL, Oracle, MSSQL). It parses positional (?), numbered ($1, $2), and named (:name) placeholders and securely binds them with escaped string, numeric, boolean, UUID, or timestamp values.

Core Concepts

Understanding SQL parameter binding and unbinding rules:

  • Placeholder Pattern Matching: Auto-detects positional ? wildcards, PostgreSQL numbered $n variables, and named :identifier parameters.
  • Log Format Auto-Parsing: Extracts values from JSON arrays (["val1", 21]), Hibernate binding logs (binding parameter [1] as [VARCHAR] - [active]), and pgAdmin parameter maps ($1 = 'active', $2 = 21).
  • Dialect-Safe Value Escaping: Escapes single quotes ('') in strings, converts date strings to Oracle TO_TIMESTAMP / TO_DATE calls, and prevents SQL injection issues during debugging.

How to use the tool?

  1. Paste Parameterized SQL: Enter your SQL query containing placeholder markers (?, $1, :id) or click Load Sample.
  2. Paste Bound Parameters: Enter your parameters array (JSON array, Hibernate log lines, or comma-separated values).
  3. Compile & Copy: Select your target Database Dialect, click Compile Executable Query, and click Copy or Download to export the ready-to-run SQL.

Related Developer Utilities

If you work with database queries, SQL logs, and ORM debugging, explore these complementary tools:

REST API Integration

Blueutils provides a free REST API endpoint (POST https://blueutils.com/api/sql/sql-parameter-unbinder) to programmatically hydrate and replace placeholders in parameterized SQL queries with correctly escaped parameter values.

API Request Parameters

Name Type Description Example
rawText String Parameterized SQL query containing placeholders. "SELECT * FROM users WHERE status = $1 AND age > $2"
paramsText String Parameter values (JSON array, logs, or comma list). "[ \"active\", 21 ]"
dialect String Database dialect: "postgresql", "mysql", "oracle", "mssql". "postgresql"
beautify Boolean Whether to apply standard capitalization and indentation. true

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/sql/sql-parameter-unbinder \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "SELECT * FROM users WHERE status = $1 AND age > $2",
    "paramsText": "[\"active\", 21]",
    "dialect": "postgresql",
    "beautify": true
  }'

Python

import requests

url = "https://blueutils.com/api/sql/sql-parameter-unbinder"
payload = {
    "rawText": "SELECT * FROM users WHERE status = $1 AND age > $2",
    "paramsText": "[\"active\", 21]",
    "dialect": "postgresql",
    "beautify": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String jsonPayload = """
            {
                "rawText": "SELECT * FROM users WHERE status = $1 AND age > $2",
                "paramsText": "[\\"active\\", 21]",
                "dialect": "postgresql",
                "beautify": true
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/sql/sql-parameter-unbinder"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

API Response Parameters

Name Type Description Example
isValid Boolean Indicates whether parameter binding succeeded. true
unboundQuery String Fully compiled executable SQL query. "SELECT *\nFROM users\nWHERE status = 'active'..."
parameterCount Number Count of parameters mapped and substituted. 2

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "unboundQuery": "SELECT *\nFROM users\nWHERE status = 'active'\n  AND age > 21",
  "parameterCount": 2
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Query input cannot be empty."
}

Rate Limit Exceeded Response (HTTP 429 Too Many Requests)

{
  "error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}

Why use an API to unbind SQL parameters?

Integrating the SQL Parameter Unbinder API into backend observability dashboards, log aggregation pipelines, or AI agent tool calling provides key benefits:

  • Rapid Script Validation: Converts raw split logs from production tracing tools directly into runnable SQL queries for debugging.
  • Optimized Token Efficiency for AI Agents: LLMs frequently misalign positional ? or $n placeholders when hydrating parameters. Calling the API extracts the complete query deterministically without hallucination.
  • Deterministic Accuracy Without Hallucinations: Ensures 100% dialect-safe string quote escaping and timestamp formatting.

Native Usage

How to unbind SQL parameters locally in terminal environments or scripts:

Windows (CMD / PowerShell)

# Sequentially replace query placeholders in PowerShell
$sql = "SELECT * FROM users WHERE status = ? AND age > ?;"
$params = @("'active'", "21")
foreach ($p in $params) {
    $indexOf = $sql.IndexOf('?')
    if ($indexOf -ge 0) {
        $sql = $sql.Remove($indexOf, 1).Insert($indexOf, $p)
    }
}
Write-Output $sql

Linux / Unix (Bash)

# Simple replacement using Python in Linux
python3 -c "
sql = 'SELECT * FROM users WHERE status = ? AND age > ?;'
params = [\"'active'\", '21']
for p in params:
    sql = sql.replace('?', p, 1)
print(sql)
"

Python

Using Python:

def unbind_sql(sql, params):
    for p in params:
        val = f"'{p}'" if isinstance(p, str) else str(p)
        sql = sql.replace("?", val, 1)
    return sql

query = "SELECT * FROM users WHERE status = ? AND age > ?;"
params = ["active", 21]
print(unbind_sql(query, params))

Java

Using Java:

public class SqlUnbinderExample {
    public static String unbind(String sql, Object[] params) {
        String result = sql;
        for (Object p : params) {
            String val = (p instanceof String) ? "'" + ((String) p).replace("'", "''") + "'" : String.valueOf(p);
            result = result.replaceFirst("\\?", val);
        }
        return result;
    }

    public static void main(String[] args) {
        String sql = "SELECT * FROM users WHERE status = ? AND age > ?;";
        Object[] params = {"active", 21};
        System.out.println(unbind(sql, params));
    }
}

Frequently Asked Questions (FAQ)

What is an SQL Parameter Unbinder & Query Hydrator?

It is a developer utility that parses parameterized queries containing unmapped placeholders (?, $1, :name) from application logs or ORMs and binds/hydrates their corresponding parameter array values to return a clean executable query.

How do I hydrate parameterized SQL queries online?

Paste your SQL statement with placeholders (?, $1, :name) in the query box and your raw parameters or log lines into the parameter box, select your dialect (Postgres, MySQL, Oracle, MSSQL), and click Unbind & Hydrate Parameters.

Which logging frameworks and ORMs are supported?

The tool auto-detects formats from popular database libraries and log frameworks, including Hibernate binding parameters, Spring Boot Data JPA, MyBatis, Prisma, SQLAlchemy, pgAdmin log files, and standard JSON parameter arrays.

Are string parameters securely escaped?

Yes. The unbinder properly wraps strings and UUID parameters in dialect-specific single quotes, escapes single quotes to prevent syntax errors, formats Oracle TO_TIMESTAMP functions, and keeps integers and booleans unquoted.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.