Giter Club home page Giter Club logo

Comments (6)

lauriejim avatar lauriejim commented on July 21, 2024 10

Actually no and it's not plan today.

from strapi-examples.

maulik-modi avatar maulik-modi commented on July 21, 2024 2

Actually no and it's not plan today.

@lauriejim , Do you accept PR for oracle support. Some organizations are heavily invested and may not switch to another database system with failover, replication and all that stuff just to have CMS.

from strapi-examples.

achmedsgit avatar achmedsgit commented on July 21, 2024 1

please add support for oracle.

from strapi-examples.

DVIMultimedia avatar DVIMultimedia commented on July 21, 2024

Not planned in 2020 ?

from strapi-examples.

stevefan1999-personal avatar stevefan1999-personal commented on July 21, 2024

Technically speaking, this is not the concern of Strapi. Bookshelf relies on Knex, and Knex does support Oracle. However, you will have to be a little bit creative.

First, you will have to install the Oracle Client:

# yarn add oracledb

Then, you will have to patch node_modules\strapi-connector-bookshelf\lib\knex.js:

*** knex.js     2020-09-18 19:04:57.901164900 +0800
--- "knex copy.js"      2020-09-18 19:06:01.012209000 +0800
***************
*** 19,26 ****
    'mysql2',
    'sqlite3',
    'mariasql',
!   'oracle',
!   'strong-oracle',
    'mssql',
  ];

--- 19,25 ----
    'mysql2',
    'sqlite3',
    'mariasql',
!   'oracledb',
    'mssql',
  ];

But consider that the CTO of Strapi, aka @lauriejim, was so pissed about adding Oracle support, so I assume he had some beef with Oracle before. Based on that, I doubt even if I tried to submit a PR he will immediately close it anyway.

Then you will need to modify your config.js

module.exports = ({ env }) => ({
  defaultConnection: "default",
  connections: {
    default: {
      connector: "bookshelf",
      settings: {
        client: "oracledb"
      },
      options: {
        useNullAsDefault: true,
        connection: {
          user: "admin",
          password: "attack at dawn",
          connectString: "db202008101919_high",
        },
      },
    },
  },
});

This will unfortunately override all connection settings.

But even after that you will still be blocked: You are going to face this

[2020-09-18T10:58:12.579Z] debug ⛔️ Server wasn't able to start properly.
[2020-09-18T10:58:12.580Z] error Error: Undefined binding(s) detected when compiling SELECT. Undefined column(s): [core_store.id] query: select * from (select "core_store".* from "core_store" where "core_store"."key" = ? and "core_store"."type" = ? and "core_store"."value" = ? and "core_store"."id" = ?) where rownum <= ?
    at Oracledb_Compiler.toSQL (E:\strapi\my-project\node_modules\knex\lib\query\compiler.js:101:13)
    at Builder.toSQL (E:\strapi\my-project\node_modules\knex\lib\query\builder.js:76:44)
    at E:\strapi\my-project\node_modules\knex\lib\runner.js:30:36
From previous event:
    at Runner.run (E:\strapi\my-project\node_modules\knex\lib\runner.js:25:16)
    at Builder.Target.then (E:\strapi\my-project\node_modules\knex\lib\interface.js:14:43)
    at processImmediate (internal/timers.js:456:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I don't know what it is and I will update the status if me/you could make a breakthough.

And also this if tried to bypass the exception:

ODPI [23428] 2020-09-18 21:26:52.989: ODPI-C 4.0.1
ODPI [23428] 2020-09-18 21:26:52.989: debugging messages initialized at level 25
ODPI [22164] 2020-09-18 21:26:54.691: SQL select TABLE_NAME from USER_TABLES where TABLE_NAME = :1
ODPI [12536] 2020-09-18 21:26:54.837: SQL create table "core_store" ("id" integer not null primary key, "key" varchar2(255) null, "value" clob null, "type" varchar2(255) null, "environment" varchar2(255) null, "tag" varchar2(255) null)
ODPI [23216] 2020-09-18 21:26:55.005: SQL DECLARE PK_NAME VARCHAR(200); BEGIN  EXECUTE IMMEDIATE ('CREATE SEQUENCE "core_store_seq"');  SELECT cols.column_name INTO PK_NAME  FROM all_constraints cons, all_cons_columns cols  WHERE cons.constraint_type = 'P'  AND cons.constraint_name = cols.constraint_name  AND cons.owner = cols.owner  AND cols.table_name = 'core_store';  execute immediate ('create or replace trigger "core_store_autoinc_trg"  BEFORE INSERT on "core_store"  for each row  declare  checking number := 1;  begin    if (:new."' || PK_NAME || '" is null) then      while checking >= 1 loop        select "core_store_seq".nextval into :new."' || PK_NAME || '" from dual;        select count("' || PK_NAME || '") into checking from "core_store"        where "' || PK_NAME || '" = :new."' || PK_NAME || '";      end loop;    end if;  end;'); END;
ODPI [12536] 2020-09-18 21:26:55.325: SQL select * from (select "core_store".* from "core_store" where "core_store"."key" = :1) where rownum <= :2
ODPI [12536] 2020-09-18 21:26:55.576: SQL insert into "core_store" ("key", "type", "value") values (:1, :2, :3)
ODPI [23216] 2020-09-18 21:26:55.777: SQL select * from (select "core_store".* from "core_store" where "core_store"."key" = :1 and "core_store"."type" = :2 and "core_store"."value" = :3 and "core_store"."id" = :4) where rownum <= :5
ODPI [23216] 2020-09-18 21:26:55.929: OCI error ORA-00932: inconsistent datatypes: expected - got CLOB (dpiStmt_execute / execute)
[2020-09-18T13:26:55.932Z] debug ⛔️ Server wasn't able to start properly.
[2020-09-18T13:26:55.933Z] error Error: select * from (select "core_store".* from "core_store" where "core_store"."key" = :1 and "core_store"."type" = :2 and "core_store"."value" = :3 and "core_store"."id" = :4) where rownum <= :5 - ORA-00932: inconsistent datatypes: expected - got CLOB
 

from strapi-examples.

dnikomon avatar dnikomon commented on July 21, 2024

@stevefan1999-personal , @maulik-modi

You can't put a CLOB in the WHERE clause. From the documentation:

Large objects (LOBs) are not supported in comparison conditions. However, you can use PL/SQL programs for comparisons on CLOB data.

"value" clob null

where "core_store"."key" = :1 and "core_store"."type" = :2 and "core_store"."value" = :3

Fix

switch (options.client) {
        case 'oracledb':
          options.connection.fetchAsString = [ 'number', 'clob' ]
          break;

Now it breaks at bootstrapping plugins plugins bootstrap, user boostrap and admin bootstrap but the server is running

from strapi-examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.