{"id":19165670,"url":"https://github.com/loopbackio/loopback-connector-db2","last_synced_at":"2025-05-07T12:23:33.375Z","repository":{"id":42657452,"uuid":"46471632","full_name":"loopbackio/loopback-connector-db2","owner":"loopbackio","description":"LoopBack Connector for IBM DB/2","archived":false,"fork":false,"pushed_at":"2024-11-19T19:28:32.000Z","size":405,"stargazers_count":17,"open_issues_count":3,"forks_count":14,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-04-17T11:20:21.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loopbackio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-19T06:10:56.000Z","updated_at":"2023-11-02T05:32:09.000Z","dependencies_parsed_at":"2024-11-09T08:34:40.976Z","dependency_job_id":null,"html_url":"https://github.com/loopbackio/loopback-connector-db2","commit_stats":null,"previous_names":["strongloop/loopback-connector-db2"],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopbackio%2Floopback-connector-db2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopbackio%2Floopback-connector-db2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopbackio%2Floopback-connector-db2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopbackio%2Floopback-connector-db2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loopbackio","download_url":"https://codeload.github.com/loopbackio/loopback-connector-db2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252874714,"owners_count":21817892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-09T09:28:56.511Z","updated_at":"2025-05-07T12:23:33.298Z","avatar_url":"https://github.com/loopbackio.png","language":"JavaScript","readme":"# loopback-connector-db2\n\n[IBM® DB2®](http://www.ibm.com/analytics/us/en/technology/db2/) is the database of choice for robust, enterprise-wide solutions handling high-volume workloads.\nIt is optimized to deliver industry-leading performance while lowering costs.  The `loopback-connector-db2` module is the LoopBack connector for DB2.\n\nThe LoopBack DB2 connector supports:\n\n- All [create, retrieve, update, and delete operations](http://loopback.io/doc/en/lb2/Creating-updating-and-deleting-data.html).\n- [Queries](http://loopback.io/doc/en/lb2/Querying-data.html) with fields, limit, order, skip and where filters.\n- All supported DB2 LUW versions.\n\n## Installation\n\nEnter the following in the top-level directory of your LoopBack application:\n\n```\n$ npm install loopback-connector-db2 --save\n```\n\nThe `--save` option adds the dependency to the application's `package.json` file.\n\n## Configuration\n\nUse the [data source generator](http://loopback.io/doc/en/lb3/Data-source-generator.html)  to add the DB2 data source to your application.\nThe entry in the application's `server/datasources.json` will look something like this:\n\n```js\n\"mydb\": {\n  \"name\": \"mydb\",\n  \"connector\": \"db2\"\n}\n```\n\nEdit `server/datasources.json` to add other supported properties as required:\n\n```js\n\"mydb\": {\n  \"name\": \"mydb\",\n  \"connector\": \"db2\",\n  \"username\": \u003cusername\u003e,\n  \"password\": \u003cpassword\u003e,\n  \"database\": \u003cdatabase name\u003e,\n  \"hostname\": \u003cdb2 server hostname\u003e,\n  \"port\":     \u003cport number\u003e\n}\n```\n\nThe following table describes the connector properties.\n\nProperty\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; | Type\u0026nbsp;\u0026nbsp;    | Description\n---------------| --------| --------\ndatabase       | String  | Database name\nschema         | String  | Specifies the default schema name that is used to qualify unqualified database objects in dynamically prepared SQL statements. The value of this property sets the value in the CURRENT SCHEMA special register on the database server. The schema name is case-sensitive, and must be specified in uppercase characters\nusername       | String  | DB2 Username\npassword       | String  | DB2 password associated with the username above\nhostname       | String  | DB2 server hostname or IP address\nport           | String  | DB2 server TCP port number\nuseLimitOffset | Boolean | LIMIT and OFFSET must be configured on the DB2 server before use (compatibility mode)\nsupportDashDB  | Boolean | Create ROW ORGANIZED tables to support dashDB.\ndsn            | String  | DSN string; can be used instead of the username, password, database, hostname and port properties\nmaxPoolSize    | Number  | Maximum number of connections in the connection pool\n\n\nAlternatively, you can create and configure the data source in JavaScript code.\nFor example:\n\n```js\nvar DataSource = require('loopback-datasource-juggler').DataSource;\nvar DB2 = require('loopback-connector-db2');\n\nvar config = {\n  username: process.env.DB2_USERNAME,\n  password: process.env.DB2_PASSWORD,\n  hostname: process.env.DB2_HOSTNAME,\n  port: 50000,\n  database: 'SQLDB',\n};\n\nvar db = new DataSource(DB2, config);\n\nvar User = db.define('User', {\n  name: { type: String },\n  email: { type: String },\n});\n\ndb.autoupdate('User', function(err) {\n  if (err) {\n    console.log(err);\n    return;\n  }\n\n  User.create({\n    name: 'Tony',\n    email: 'tony@t.com',\n  }, function(err, user) {\n    console.log(err, user);\n  });\n\n  User.find({ where: { name: 'Tony' }}, function(err, users) {\n    console.log(err, users);\n  });\n\n  User.destroyAll(function() {\n    console.log('example complete');\n  });\n});\n```\n\n## Running tests\n\n### Own instance\n\nIf you have a local or remote DB2 instance and would like to use that to run the test suite, use the following command:\n- Linux\n```bash\nDB2_HOSTNAME=\u003cHOST\u003e DB2_PORTNUM=\u003cPORT\u003e DB2_USERNAME=\u003cUSER\u003e DB2_PASSWORD=\u003cPASSWORD\u003e DB2_DATABASE=\u003cDATABASE\u003e DB2_SCHEMA=\u003cSCHEMA\u003e CI=true npm test\n```\n- Windows\n```bash\nSET DB2_HOSTNAME=\u003cHOST\u003e\nSET DB2_PORTNUM=\u003cPORT\u003e\nSET DB2_USERNAME=\u003cUSER\u003e\nSET DB2_PASSWORD=\u003cPASSWORD\u003e\nSET DB2_DATABASE=\u003cDATABASE\u003e\nSET DB2_SCHEMA=\u003cSCHEMA\u003e\nSET CI=true\nnpm test\n```\n\n#### How to get a local DB2 instance:\n\n- Go to [IBM DB2 trials](http://www.ibm.com/analytics/us/en/technology/db2/db2-trials.html) page.\n- Register for an account.\n- Download either IBM DB2 or IBM DB2 Express-C.\n- For documentation or more information about the installation or setup, see http://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.kc.doc/welcome.html\n\n#### IBM DB2 Express-C scenario on Windows:\n- Run the setup file.\n- Set user information for the DB2 Administration server.\n- Write down the user information and the password that you create. User name is `db2admin` by default but it could be modified.\n- Configure DB2 instance and write down the port number. It is 50000 by default.\n- Once setup is done, Start the `default DB2 and Database Client Interface Selection Wizard`, and proceed with the configuration.\n- Ensure that the DB2 Data server runtime client is started. The default name is `DB2COPY1`.\n- Let's assume your database name is `sample`, and schema name is `STRONGLOOP`.\n- In Windows, start the DB2 Command window-Administrator (In Mac or Linux, use terminal with proper privileges).\n- Make sure that you are in this path `...\\IBM\\SQLLIB\\BIN` (In mac, it should be ` /Users/\u003cuserid\u003e/sqllib\\bin`), and type the following commands:\n\n```\n\u003eset db2instance=server1\n\n\u003edb2 connect to sample\n\n\u003edb2 set schema to STRONGLOOP\n```\n\n### Docker\nIf you do not have a local DB2 instance, you can also run the test suite with very minimal requirements.\n- Assuming you have [Docker](https://docs.docker.com/engine/installation/) installed, run the following script which would spawn a DB2 instance on your local:\n```bash\nsource setup.sh \u003cHOST\u003e \u003cPORT\u003e \u003cPASSWORD\u003e \u003cDATABASE\u003e\n```\nwhere `\u003cHOST\u003e`, `\u003cPORT\u003e`, `\u003cPASSWORD\u003e` and `\u003cDATABASE\u003e` are optional parameters. By default, the user is `db2inst1`.\n- Run the test:\n```bash\nnpm test\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopbackio%2Floopback-connector-db2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floopbackio%2Floopback-connector-db2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopbackio%2Floopback-connector-db2/lists"}