{"id":39965023,"url":"https://github.com/qoretechnologies/module-odbc","last_synced_at":"2026-01-18T21:35:18.384Z","repository":{"id":13451813,"uuid":"66345283","full_name":"qoretechnologies/module-odbc","owner":"qoretechnologies","description":"Qore ODBC database driver module","archived":false,"fork":false,"pushed_at":"2026-01-16T10:11:26.000Z","size":342,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":14,"default_branch":"develop","last_synced_at":"2026-01-16T23:55:52.570Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qoretechnologies.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-08-23T07:44:24.000Z","updated_at":"2026-01-16T10:11:30.000Z","dependencies_parsed_at":"2023-02-18T14:31:20.648Z","dependency_job_id":null,"html_url":"https://github.com/qoretechnologies/module-odbc","commit_stats":null,"previous_names":["qoretechnologies/module-odbc"],"tags_count":59,"template":false,"template_full_name":null,"purl":"pkg:github/qoretechnologies/module-odbc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoretechnologies%2Fmodule-odbc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoretechnologies%2Fmodule-odbc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoretechnologies%2Fmodule-odbc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoretechnologies%2Fmodule-odbc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qoretechnologies","download_url":"https://codeload.github.com/qoretechnologies/module-odbc/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qoretechnologies%2Fmodule-odbc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28551202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T20:59:07.572Z","status":"ssl_error","status_checked_at":"2026-01-18T20:59:02.799Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-18T21:35:18.313Z","updated_at":"2026-01-18T21:35:18.377Z","avatar_url":"https://github.com/qoretechnologies.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Qore ODBC Module\n\nODBC database driver module for the [Qore programming language](http://qore.org).\n\n## Features\n\n- Full ODBC 3.x API support\n- Transaction management (commit, rollback)\n- Prepared statements with parameter binding\n- Array binding for bulk operations\n- LOB (Large Object) support\n- Stored procedures support\n- Multiple database support (PostgreSQL, MySQL, Oracle, MS-SQL, Firebird, and more)\n- Timezone-aware date/time handling\n- Unicode support (UTF-8)\n- Auto-reconnection support\n\n## Requirements\n\n### Build Requirements\n- CMake 3.5 or higher\n- C++11 compatible compiler (GCC, Clang, MSVC)\n- Qore development headers (qore-devel) 1.14 or higher\n- unixODBC development headers (unixODBC-devel)\n- Doxygen (for documentation generation)\n\n### Runtime Requirements\n- Qore 1.14 or higher\n- unixODBC library\n- ODBC driver for your target database\n\n## Installation\n\n### From Source\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake\nsudo make install\n```\n\n### RPM-based Systems (Fedora, RHEL, CentOS, openSUSE)\n\n```bash\n# Install build dependencies\nsudo dnf install gcc-c++ cmake qore-devel unixODBC-devel doxygen\n\n# Build and install\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake\nsudo make install\n```\n\n### Debian/Ubuntu\n\n```bash\n# Install build dependencies\nsudo apt-get install g++ cmake libqore-dev unixodbc-dev doxygen\n\n# Build and install\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake\nsudo make install\n```\n\n### Building Documentation\n\n```bash\ncd build\ncmake ..  # if not done before\nmake docs\n```\n\nDocumentation will be generated in `build/docs/html/`.\n\n## Quick Start\n\n### Basic Connection\n\n```qore\n#!/usr/bin/env qore\n\n%require-our\n%requires odbc\n\n# Using DSN (Data Source Name)\nDatasource ds(\"odbc:mydsn\", \"username\", \"password\");\n\n# Or using a connection string\nDatasource ds(\"odbc\", NOTHING, NOTHING, NOTHING, NOTHING, {\n    \"conn\": \"Driver={PostgreSQL};Server=localhost;Database=mydb;\",\n    \"USER\": \"username\",\n    \"PASSWORD\": \"password\"\n});\n\n# Execute a query\nhash result = ds.select(\"SELECT * FROM users WHERE id = %v\", 1);\nprintf(\"User: %y\\n\", result);\n\nds.commit();\n```\n\n### DSN-less Connection Examples\n\n**PostgreSQL:**\n```qore\nDatasource ds(\"odbc\", NOTHING, NOTHING, NOTHING, NOTHING, {\n    \"conn\": \"Driver={PostgreSQL Unicode};Server=localhost;Port=5432;Database=testdb;\",\n    \"USER\": \"postgres\",\n    \"PASSWORD\": \"secret\"\n});\n```\n\n**MySQL:**\n```qore\nDatasource ds(\"odbc\", NOTHING, NOTHING, NOTHING, NOTHING, {\n    \"conn\": \"Driver={MySQL ODBC 8.0 Driver};Server=localhost;Database=testdb;\",\n    \"USER\": \"root\",\n    \"PASSWORD\": \"secret\"\n});\n```\n\n**MS-SQL:**\n```qore\nDatasource ds(\"odbc\", NOTHING, NOTHING, NOTHING, NOTHING, {\n    \"conn\": \"Driver={ODBC Driver 17 for SQL Server};Server=localhost;Database=testdb;\",\n    \"USER\": \"sa\",\n    \"PASSWORD\": \"secret\"\n});\n```\n\n**Oracle:**\n```qore\nDatasource ds(\"odbc\", NOTHING, NOTHING, NOTHING, NOTHING, {\n    \"conn\": \"Driver={Oracle 19 ODBC driver};DBQ=//localhost:1521/ORCL;\",\n    \"USER\": \"scott\",\n    \"PASSWORD\": \"tiger\"\n});\n```\n\n### Prepared Statements\n\n```qore\nSQLStatement stmt(ds);\nstmt.prepare(\"INSERT INTO users (name, email) VALUES (%v, %v)\");\nstmt.bindArgs((\"John Doe\", \"john@example.com\"));\nstmt.exec();\nds.commit();\n```\n\n### Batch Operations with Array Binding\n\n```qore\nlist names = (\"Alice\", \"Bob\", \"Charlie\");\nlist emails = (\"alice@example.com\", \"bob@example.com\", \"charlie@example.com\");\n\nds.exec(\"INSERT INTO users (name, email) VALUES (%v, %v)\", names, emails);\nds.commit();\n```\n\n### Type Binding\n\nUse `odbc_bind()` for explicit type specification:\n\n```qore\n%requires odbc\n\n# Bind a DATE type explicitly\nauto date_val = odbc_bind(ODBCT_DATE, 2024-01-15);\nds.exec(\"INSERT INTO events (event_date) VALUES (%v)\", date_val);\n```\n\nAvailable binding types:\n- `ODBCT_SLONG`, `ODBCT_ULONG` - 32-bit integers\n- `ODBCT_SSHORT`, `ODBCT_USHORT` - 16-bit integers\n- `ODBCT_STINYINT`, `ODBCT_UTINYINT` - 8-bit integers\n- `ODBCT_FLOAT`, `ODBCT_DOUBLE` - Floating point\n- `ODBCT_DATE`, `ODBCT_TIME`, `ODBCT_TIMESTAMP` - Date/time types\n\n## Configuration Options\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `optimal-numbers` | Return numeric values as integers when possible | Yes |\n| `string-numbers` | Return all numeric values as strings | No |\n| `numeric-numbers` | Return numeric values as arbitrary-precision numbers | No |\n| `bigint-native` | Return BIGINT as native 64-bit integer | Yes |\n| `bigint-string` | Return BIGINT as string | No |\n| `fractional-precision` | Fractional seconds precision (1-9) | 6 |\n| `login-timeout` | Login timeout in seconds | 0 (no timeout) |\n| `connection-timeout` | Connection timeout in seconds | 0 (no timeout) |\n| `qore-timezone` | Server timezone (e.g., \"Europe/Prague\", \"+02:00\") | Local |\n| `preserve-case` | Preserve column name case in results | No |\n| `conn` | Additional ODBC connection string parameters | - |\n\n### Setting Options\n\n```qore\n# At connection time\nDatasource ds(\"odbc:mydsn\", \"user\", \"pass\", NOTHING, NOTHING, {\n    \"login-timeout\": 30,\n    \"qore-timezone\": \"UTC\",\n    \"numeric-numbers\": True\n});\n\n# After connection\nds.setOption(\"fractional-precision\", 9);\n```\n\n## Error Handling\n\nThe module raises various exceptions for error conditions:\n\n| Exception | Description |\n|-----------|-------------|\n| `ODBC-CONNECTION-ERROR` | Connection failure |\n| `ODBC-EXEC-ERROR` | SQL execution error |\n| `ODBC-BIND-ERROR` | Parameter binding error |\n| `ODBC-PREPARE-ERROR` | Statement preparation error |\n| `ODBC-COMMIT-ERROR` | Transaction commit failure |\n| `ODBC-ROLLBACK-ERROR` | Transaction rollback failure |\n| `ODBC-CONNECTION-DEAD-ERROR` | Connection lost |\n| `ODBC-OPTION-ERROR` | Invalid option value |\n\n### Error Handling Example\n\n```qore\ntry {\n    ds.exec(\"INSERT INTO users (id, name) VALUES (%v, %v)\", 1, \"Test\");\n    ds.commit();\n} catch (ex) {\n    printf(\"Error: %s: %s\\n\", ex.err, ex.desc);\n    ds.rollback();\n}\n```\n\n## Troubleshooting\n\n### Connection Issues\n\n1. **Verify ODBC driver installation:**\n   ```bash\n   odbcinst -q -d  # List installed drivers\n   ```\n\n2. **Test connection with isql:**\n   ```bash\n   isql -v mydsn username password\n   ```\n\n3. **Check odbc.ini configuration:**\n   ```bash\n   cat /etc/odbc.ini      # System DSNs\n   cat ~/.odbc.ini        # User DSNs\n   ```\n\n### Common Issues\n\n- **\"Driver not found\"**: Install the appropriate ODBC driver for your database\n- **\"Connection timeout\"**: Check network connectivity and firewall settings\n- **\"Authentication failed\"**: Verify username/password and database permissions\n\n## Links\n\n- [Qore Programming Language](http://qore.org)\n- [GitHub Repository](https://github.com/qorelanguage/module-odbc)\n- [unixODBC Project](http://www.unixodbc.org)\n- [API Documentation](https://qorelanguage.github.io/module-odbc)\n\n## License\n\nMIT License - see [LICENSE.txt](LICENSE.txt) for details.\n\n## Author\n\nOndrej Musil (Qore Technologies, s.r.o.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqoretechnologies%2Fmodule-odbc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqoretechnologies%2Fmodule-odbc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqoretechnologies%2Fmodule-odbc/lists"}