PHPackages                             sybase-connector/doctrine-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. sybase-connector/doctrine-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

sybase-connector/doctrine-bundle
================================

Symfony bundle providing Doctrine DBAL integration for SAP SQL Anywhere via PDO\_ODBC + FreeTDS

00PHP

Since Jun 3Pushed 1mo agoCompare

[ Source](https://github.com/Mayki-kicas/Symfony-Sybase-Connector)[ Packagist](https://packagist.org/packages/sybase-connector/doctrine-bundle)[ RSS](/packages/sybase-connector-doctrine-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

sybase-connector/doctrine-bundle
================================

[](#sybase-connectordoctrine-bundle)

Symfony bundle providing Doctrine DBAL integration for **SAP SQL Anywhere** via **PDO\_ODBC + FreeTDS**.

---

How it works (end to end)
-------------------------

[](#how-it-works-end-to-end)

### The problem

[](#the-problem)

SAP SQL Anywhere is not MySQL or PostgreSQL — Doctrine doesn't support it natively. Key differences:

- SQL Anywhere uses `SELECT TOP N START AT M` instead of `LIMIT/OFFSET`
- Different types: `BIT` instead of `BOOLEAN`, `MONEY`, `LONG VARCHAR`, etc.
- Connection goes through ODBC via FreeTDS (a C library that speaks the TDS protocol)
- FreeTDS quirks: no server-side prepared statements, only one active cursor per connection

### The connection stack

[](#the-connection-stack)

```
Your PHP code (Symfony / Doctrine)
        |
This bundle (SybaseDriver -> SybaseConnection -> SQLAnywherePlatform)
        |
PDO_ODBC (PHP extension)
        |
unixODBC (system ODBC driver manager)
        |
FreeTDS (ODBC driver speaking TDS 5.0 protocol)
        | TCP
SAP SQL Anywhere (port 2639)

```

### Bundle components

[](#bundle-components)

FileRole`SybaseDriver`Creates the PDO\_ODBC connection, builds the DSN, retries on transient network errors`SybaseConnection`PDO wrapper that auto-closes the previous cursor before each query (FreeTDS "Invalid cursor state" bug)`SQLAnywherePlatform`Translates Doctrine SQL to SQL Anywhere dialect (`TOP/START AT`, `CURRENT DATE`, `BIT`, `ISNULL()`, types...)`SQLAnywhereSchemaManager`Schema introspection via system views (`sys.systable`, `sys.systabcol`, etc.)`SybaseConnectorExtension`Auto-configures a Doctrine DBAL connection via `PrependExtensionInterface`---

Installation
------------

[](#installation)

### System prerequisites (FreeTDS + ODBC)

[](#system-prerequisites-freetds--odbc)

**Option A: Docker (recommended)** — everything included, nothing to install:

```
docker compose build
docker compose run --rm php composer install
```

**Option B: macOS (Homebrew)**:

```
brew install freetds unixodbc

# Register the FreeTDS driver in ODBC
cat >> $(odbcinst -j | grep DRIVERS | awk '{print $2}')
