{"id":23338408,"url":"https://github.com/abhirockzz/fn-oracledb-java","last_synced_at":"2025-09-13T14:06:16.100Z","repository":{"id":79124990,"uuid":"143690283","full_name":"abhirockzz/fn-oracledb-java","owner":"abhirockzz","description":"Using Oracle Functions with Oracle DB","archived":false,"fork":false,"pushed_at":"2019-01-18T04:49:03.000Z","size":3185,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T16:32:50.170Z","etag":null,"topics":["faas","fnproject","java","jdbc","oracle-db","oracle-functions","orafunc-la","serverless","workshop"],"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/abhirockzz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-06T07:13:05.000Z","updated_at":"2019-01-22T06:55:26.000Z","dependencies_parsed_at":"2023-03-12T06:43:20.437Z","dependency_job_id":null,"html_url":"https://github.com/abhirockzz/fn-oracledb-java","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/abhirockzz%2Ffn-oracledb-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhirockzz%2Ffn-oracledb-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhirockzz%2Ffn-oracledb-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhirockzz%2Ffn-oracledb-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abhirockzz","download_url":"https://codeload.github.com/abhirockzz/fn-oracledb-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247666003,"owners_count":20975785,"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":["faas","fnproject","java","jdbc","oracle-db","oracle-functions","orafunc-la","serverless","workshop"],"created_at":"2024-12-21T03:13:49.844Z","updated_at":"2025-04-07T13:43:48.851Z","avatar_url":"https://github.com/abhirockzz.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Integrating Oracle Functions and Oracle DB\r\n\r\nOracle functions executing `CRUD` operations on Oracle DB. This sample uses a simple `Employee` entity for demonstration purposes\r\n\r\n## Pre-requisites\r\n\r\n- Create an Oracle DB instance e.g. [Oracle DBMS on Oracle Cloud Infrastructure](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/databaseoverview.htm?tocpath=Services%7CDatabase%7C_____0)\r\n- Create the `EMPLOYEES` table in your DB schema using [seed-db.sql](seed-db.sql)\r\n\r\n### Configure Oracle Maven repository\r\n\r\nThis application uses Oracle JDBC driver which is extracted from the Oracle Maven repository. To access the Oracle Maven Repository, you must first register for access on Oracle Technology Network (if you haven't already). You can access the registration application at https://www.oracle.com/webapps/maven/register/license.html\r\n\r\nThis application displays the license agreement for access to the Oracle Maven Repository. You must accept the license agreement to access the Oracle Maven Repository. \r\n\r\nFor further details, please refer to https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9010\r\n\r\n## Create an app with required database configuration\r\n\r\n`fn create app fn-oradb-java-app --annotation oracle.com/oci/subnetIds='[\"\u003cSUBNET_OCID\u003e\"]' --config DB_URL=jdbc:oracle:thin:@//\u003cHOST_IP\u003e:\u003cPORT\u003e/\u003cSERVICE_NAME\u003e --config DB_USER=\u003cDB_USER\u003e --config DB_PASSWORD=\u003cDB_PASSWORD\u003e` \r\n\r\ne.g. `fn create app fn-oradb-java-app --annotation oracle.com/oci/subnetIds='[\"ocid1.subnet.oc1.phx.aaaaaaaaghmsma7mpqhqdhbgnby25u2zo9wqlrrcskvu7jg56dryxt3hgvkz\"]' --config DB_URL=jdbc:oracle:thin:@//129.777.888.999:1521/test_iad1vc.sub09250801039.myvcn.oraclevcn.com --config DB_USER=dba_user --config DB_PASSWORD=s3cr3t`\r\n\r\n## Build process\r\n\r\nA custom Dockerfile is used to build the function(s). The build process accepts the OTN username and password along with a master password as inputs. The master password itself is encrypted using `mvn --encrypt-master-password` and it is then used  to encrypt your OTN credentials. The encrypted master password is stored in `settings-security.xml` and the encrypted OTN credentials are stored in `settings.xml`. These XMLs are then referred by `mvn package`.\r\n\r\n## Deploy\r\n\r\n\u003e Use your OTN username and password (created in the **Configure Oracle Maven repository** step) for `ORACLE_USERID` and `ORACLE_PASSWORD` respectively. You can use any value for the `MASTER_PASSWORD`\r\n\r\n### Deploy all the functions together\r\n\r\n- `cd fn-oracledb-java`\r\n- `fn -v deploy --app fn-oradb-java-app --build-arg MASTER_PASSWORD=\u003cmaven_master_password\u003e --build-arg ORACLE_USERID=\u003cOTN_USERNAME\u003e --build-arg ORACLE_PASSWORD=\u003cOTN_PASSWORD\u003e --all` \r\n\r\ne.g. `fn -v deploy --app fn-oradb-java-app --build-arg MASTER_PASSWORD=foobar --build-arg ORACLE_USERID=abhishek.af.gupta@oracle.com --build-arg ORACLE_PASSWORD=t0ps3cr3t --all`\r\n\r\n\u003e Notice the usage of `--all` flag at the end of the `deploy` command. It uses the app name as specified in `app.yaml`\r\n\r\n### Deploy one function at a time\r\n\r\nFor example if you just want to deploy the `create` function\r\n\r\n- `cd fn-oracledb-java/create`\r\n- `fn -v deploy --app fn-oradb-java-app --build-arg MASTER_PASSWORD=\u003cmaven_master_password\u003e --build-arg ORACLE_USERID=\u003cOTN_USERNAME\u003e --build-arg ORACLE_PASSWORD=\u003cOTN_PASSWORD\u003e`\r\n\r\n## Test\r\n\r\n### Create Employee\r\n\r\n`echo -n '{\"emp_email\": \"a@b.com\",\"emp_name\": \"abhishek\",\"emp_dept\": \"Product Divison\"}' | fn invoke fn-oradb-java-app create-emp`\r\n\r\nIf successful, you should a response similar to this `Created employee CreateEmployeeInfo{emp_email=a@b.com, emp_name=abhishek, emp_dept=Product Divison}`\r\n\r\nCreate as many as you want - make sure that the `emp_email` is unique\r\n\r\n### Read Employee(s)\r\n\r\n- `fn invoke fn-oradb-java-app read-emp` (to fetch all employees)\r\n\r\nYou should get back a JSON response similar to below\r\n\r\n\t[\r\n\t  {\r\n\t    \"emp_email\": \"y@z.com\",\r\n\t    \"emp_name\": \"abhishek\",\r\n\t    \"emp_dept\": \"PM\"\r\n\t  },\r\n\t  {\r\n\t    \"emp_email\": \"a@b.com\",\r\n\t    \"emp_name\": \"abhishek\",\r\n\t    \"emp_dept\": \"Product Divison\"\r\n\t  },\r\n\t  {\r\n\t    \"emp_email\": \"x@y.com\",\r\n\t    \"emp_name\": \"kehsihba\",\r\n\t    \"emp_dept\": \"QA Divison\"\r\n\t  }\r\n\t]\r\n\r\n- `echo -n 'a@b.com' | fn invoke fn-oradb-java-app read-emp` (to fetch employee with email `a@b.com`)\r\n\r\n\t\t[\r\n\t\t  {\r\n\t\t    \"emp_email\": \"a@b.com\",\r\n\t\t    \"emp_name\": \"abhishek\",\r\n\t\t    \"emp_dept\": \"Product Divison\"\r\n\t\t  }\r\n\t\t]\r\n\r\n### Update Employee\r\n\r\nIt is possible to update the department of an employee\r\n\r\n`echo -n '{\"emp_email\": \"a@b.com\", \"emp_dept\": \"Support Operations\"}' | fn invoke fn-oradb-java-app update-emp`\r\n\r\nSuccessful invocation will return back a message similar to `Updated employee UpdateEmployeeInfo{emp_email=a@b.com, emp_dept=Support Operations}`\r\n\r\nCheck to make sure - `echo -n 'a@b.com' | fn invoke fn-oradb-java-app read-emp` - the updated department should reflect\r\n\r\n\t\t[\r\n\t\t  {\r\n\t\t    \"emp_email\": \"a@b.com\",\r\n\t\t    \"emp_name\": \"abhishek\",\r\n\t\t    \"emp_dept\": \"Support Operations\"\r\n\t\t  }\r\n\t\t]\r\n\r\n### Delete Employee\r\n\r\nUse employee email to specify which employee record you want to delete\r\n\r\n`echo -n 'a@b.com' | fn invoke fn-oradb-java-app delete-emp` and you should see `Deleted employee a@b.com` message\r\n\r\nCheck to make sure - `echo -n 'a@b.com' | fn invoke fn-oradb-java-app read-emp`\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhirockzz%2Ffn-oracledb-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhirockzz%2Ffn-oracledb-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhirockzz%2Ffn-oracledb-java/lists"}