{"id":18484658,"url":"https://github.com/isghe/oracle-java-examples","last_synced_at":"2026-04-28T18:03:11.858Z","repository":{"id":45635811,"uuid":"217852759","full_name":"isghe/oracle-java-examples","owner":"isghe","description":"simple oracle java examples","archived":false,"fork":false,"pushed_at":"2021-12-03T14:48:07.000Z","size":320,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T21:43:00.106Z","etag":null,"topics":["betterway","connection","correctway","database","example-codes","examples","goodway","helloworld","java","ojdbc7","oracle","sql","transaction","wrongway"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isghe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://blockstream.info/address/1Java1MmYqF3hTQmvwjtT3k8Dbc6HHd7Tv"]}},"created_at":"2019-10-27T12:37:16.000Z","updated_at":"2021-12-03T14:48:10.000Z","dependencies_parsed_at":"2022-07-20T20:03:07.800Z","dependency_job_id":null,"html_url":"https://github.com/isghe/oracle-java-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isghe%2Foracle-java-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isghe%2Foracle-java-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isghe%2Foracle-java-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isghe%2Foracle-java-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isghe","download_url":"https://codeload.github.com/isghe/oracle-java-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254029008,"owners_count":22002284,"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":["betterway","connection","correctway","database","example-codes","examples","goodway","helloworld","java","ojdbc7","oracle","sql","transaction","wrongway"],"created_at":"2024-11-06T12:41:56.352Z","updated_at":"2026-04-28T18:03:06.826Z","avatar_url":"https://github.com/isghe.png","language":"Java","funding_links":["https://blockstream.info/address/1Java1MmYqF3hTQmvwjtT3k8Dbc6HHd7Tv"],"categories":[],"sub_categories":[],"readme":"# Oracle Java Examples\n\nSimple examples, showing how to connect to ORACLE DB, with Java `ojdbc` driver, and how to make inserts without polluting ORACLE environment.\n\nIt's important to understand that polluting the ORACLE environment, without closing the opened connection, at the end, it will lock the system.\n\n## Table of contents\n* [Examples](#examples)\n* [Compatibility](#compatibility)\n* [Install](#install)\n* [Configure](#configure)\n* [Compile](#compile)\n* [Run](#run)\n* [Monitor](#monitor)\n* [Disclaimer](#disclaimer)\n* [Donations](#donations)\n\n## Examples\nThe examples are:\n* `HelloWorld`:\nJust a simple query to table `DUAL`;\n* `WrongWay`:\nInserts data in table `TEST_INSERT`, in wrong way: opens the connection for each insert, without closing the connection. Because of that it's polluting the ORACLE environment with tons of SESSIONS_PER_USER, until the system resources run out!\n* `CorrectWay`:\nJust closes the balanced connection with the open ones. At least it's not polluting the ORACLE environment; but it's unnecessary opening and closing the connection for each insert;\n* `GoodWay`:\nOpens the connection to ORACLE only one time, closing it only one time at the end of the program;\n* `BetterWay`:\nOne connection, one commit.\n\n## Compatibility\n\nTested on:\n\n* `macOS Mojave 10.14.6`\n\t* java: `1.8.0_66`\n\t* javac: `1.8.0_66`\n* `Oracle Linux Server 7.5`\n\t* `Oracle Database 18c Express Edition`\n\t* java: `1.8.0_151`\n\t* javac `1.8.0_151`\n\n## Install\n\nDownload `ojdbc7.jar` from [jdbc-drivers-12c-downloads](https://www.oracle.com/database/technologies/jdbc-drivers-12c-downloads.html) and copy it in `lib/` folder.\n\nTo run the examples `WrongWay`, `CorrectWay`, `GoodWay`, `BetterWay`, execute the script in `sql/create-table_test_insert.sql`; it will create the table `TEST_INSERT` in your DB.\n\n## Configure\n\nCopy `Configure/Credentials-template.java` to `Configure/Credentials.java` and modify the credentials you need (url, user and password).\n\n## Compile\n\n`$ cd examples/HelloWorld`\n\n`$ . ../../script/compile.sh`\n\n## Run\n`. ../../script/run.sh`\n\n## Monitor\nTo monitor the SESSIONS_PER_USER execute the query in `sql/sessions_per_user.sql`\n\nMonitorWrongWay,: 61 SESSIONS_PER_USER polluting ORACLE environment:\n![WrongWay](images/MonitorWrongWay.png \"WrongWay\")\n\nMonitorCorrectWay: just 3 SESSIONS_PER_USER:\n![WrongWay](images/MonitorCorrectWay.png \"CorrectgWay\")\n\n## Disclaimer\n Don't use this repo in production, it's only an academic collection of examples; production is on another layer.\n Use at your own risk.\n\n## Donations\n Donations are welcome at Bitcoin address: `1Java1MmYqF3hTQmvwjtT3k8Dbc6HHd7Tv`\n\n\u003cdiv style=\"text-align: right; align:right\"\u003eAlmaty, Kazakistan, 28 Ottobre 2019\u003cbr\u003eIsidoro Ghezzi\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisghe%2Foracle-java-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisghe%2Foracle-java-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisghe%2Foracle-java-examples/lists"}