I have an Entity with few #Lob fields which contains some images. And when I execute following method,
entityManager.persist(myEnity);
This method produces following query which takes long time to execute as my table is large.
SELECT id, img_1, img_2 FROM my_entity WHERE (ID = :1) FOR UPDATE;
I don't want this query to execute because I want to INSERT a row only.
FYI, I have following Application Environment.
EJB 3.0
EclipseLink 2.3.0
JDK 1.6
WebLogic 10.3
Oracle 11g
Oracle JDBC drivers before Oracle 11 had a 4k LOB size limit, so the only way to write lobs is to insert and empty lob, and the select the lobs back and writing into them. This is what you are seeing.
This is configurable, it is only done if your "eclipselink.target-database" is "Oracle8i", "Oracle9i", "Oracle10g".
For Oracle 11g you should use "Oracle11", this platform will not use the locator, as it should no longer be required in Oracle 11g. You may need to be on the latest version (2.4) for this. Using "Oracle" as your target will also not use the locator.
You can also disable the locator usage in your platform with a customizer,
platform.setShouldUseLocatorForLOBWrite(false);
Related
I am using oracle_fdw 2.2.0devel, PostgreSQL 10.13, Oracle client 18.3.0.0.0
We have a foreign table in Postgres defined as this:
CREATE FOREIGN TABLE public.tickers
(
ticker_id INTEGER,
ticker VARCHAR,
)
SERVER oracle
OPTIONS (table 'TICKERS', schema 'COMMENTARY', readonly 'true');
This is connecting to as 12c SE database. This works fine, however, I've noticed that the query in Oracle is actually looking like this:
SELECT
/*618157932326e692807010156f98ddac*/
r2."TICKER_ID",
r2."TICKER"
FROM "COMMENTARY"."TICKERS" r2
WHERE (upper(r2."TICKER") = upper(:p1))
Why would it automatically be adding the "UPPER" clause? This slows the Oracle query and does not use an index, unless I create a FBI using "upper".
Was wondering if there was some option I'm supposed to disable.......
The only way that oracle_fdw will generate an Oracle query that uses the upper function is if the original PostgreSQL query already had upper in it.
I have a application which uses Firebird (Version 2.5) database. I wanted to trigger one of the table entry to another database table which is in SQL Server 2008 R2. When I commit I am getting this following error
ErrorCode: 335544569 (ErrorMessage: Dynamic SQL Error SQL error code = -104).
Code:
CREATE TRIGGER "trig_INV"
FOR "INVA"
ACTIVE
AFTER UPDATE
POSITION 100
AS
BEGIN
IF ((updating) AND ((old.cold <> new.cold))) THEN
BEGIN
INSERT INTO 192.168.17.206/1043: [RBT].[dbo].[N_Inv]([COLA], [COLB], [COLC], [COLD], [COLD], [COLE])
SELECT FIRST 1
"COLA", "COLB", "COLC", "COLD", "COLE"
FROM "INVA"
ORDER BY COLA DESC
END
I am not sure firebird trigger allow to push records to a SQL Server database. It will be great if anyone has tried such and provide some reference. Thanks in advance.
You get that error because the syntax you're using doesn't exist in Firebird. Firebird has no support to connect to other database systems than Firebird (in theory you could write a provider that allows connecting to other databases systems, but as far as I know, none exist in reality).
If you want to synchronize to a different database system, you will either need to write a UDF or UDR (the replacement of UDFs introduced in Firebird 3) to do this for you, or a custom application that provides synchronization, or use third-party software to do this (for example, SymmetricDS).
Is it possible to find the instance name of a DB2 database by querying the catalog metadata? For instance, we can find the columns of tables using SELECT tbname, column_name FROM SYSIBM.SYSCOLUMNS. Is there an analogous query that can get the instance name?
I need this because I am running a query to get the remaining free space in the DB, across several instances. I would prefer to have the query itself tell me the name of the instance.
Running DB2 10.5 on Linux.
For DB2 LUW you can use ENV_INST_INFO. The instance name is in the column INST_NAME:
SELECT INST_NAME FROM SYSIBMADM.ENV_INST_INFO
Depending on your DB2-server version and platform, you might use MON_GET_INSTANCE table function (see IBM DB2 knowledge center for details and example). For the instance name you can use PDLOGMSGS_LAST24HOURS
I'm using JPA 2.1 eclipselink to call Stored Procedures from the database and i don't want to hardcoded the schema name. Is there a way to switch between schemas dynamically?
I'm using JPA 2.1, EclispseLink 2.5.2, weblogic 12.1.3
EDITED: Schema name is unknown, so i cannot create mapping file for each schema. Plus I might have 5-10 schemas in the database. What I want is a way to go to the database, select a schema name and switch them at runtime
I have very simple named query on JPA (toplink ):
UPDATE Server s SET s.isECM = 0
I don't carry about cache or validity of already preloaded entities. But database connection is performed from restricted account (only INSERT/UPDATE/DELETE). It is appeared that toplink on this query executes (and failed since TL_Server is not exists) very strange SQL:
INSERT INTO TL_Server (elementId, IsECM)
SELECT t0.ElementId, ?
FROM Element t0, Server t1
WHERE ((t1.elementId = t0.ElementId) AND (t0.elementType = ?))
bind => [0, Server]
What is this? How the simple UPDATE appears an INSERT? Why toplink queries TL_?
The TL_Server is a temp table. Because the UpdateAll query is determined to be complex the temp table must be used. I assume it is determined to be complex because the class has multiple tables, so they must be joined, which cannot be done on a simple update.
If you class just had a single table, then just a simple update would be done.
If this is failing, then it is an issue with your database platform's temp table support. Ensure you are setting you "toplink.target-database" correctly. What database are you using?
You seem to be using a very old version of TopLink Essentials? The UpdateAll support has considerably improved in the latest EclipseLink versions, you may consider upgrading.
If you cannot get it to work using TopLink Essentials, you could always just use a native SQL query instead of JPQL.