I am using IBM DB2 v8 (New-Function mode) and I am using Entity Framework 5.0.0
I have a LINQ query which executes perfectly in my environment, but it is not working at another environment. I tried to extract the SQL query generated for that LINQ query by debugging the code. I tried to execute that SQL in my environment (DB2 DB v9.1 and DB2 driver 10.5), it worked well. For the same query it did not work in my another environment: DB2 DB v8 (New-Function mode) and DB2 driver 9.7. It gave an error for "CROSS" JOIN. As I am using LINQ, the query is an automatically generated one, which I cannot change. I want to make that run in my second environment also. Below I have given my sample query. Please let me know if there is any way to solve this ?
SELECT t1.MyName, t2.MySalary
FROM Employee t1 CROSS JOIN Salary t2
I got the following Error :
ILLEGAL SYMBOL "CROSS". SOME SYMBOLS THAT MIGHT BE LEGAL ARE:.
SQLCODE=-104, SQLSTATE=42601
V8 does not support the CROSS JOIN clause. From the manuals:
V8: http://www-01.ibm.com/support/knowledgecenter/SSEPGG_8.2.0/com.ibm.db2.udb.doc/admin/r0000875.htm
joined-table
>>-+-table-reference--+-----------+--JOIN--table-reference--ON--join-condition-+-><
| '-| outer |-' |
'-(--joined-table--)--------------------------------------------------------'
V9.5: http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.5.0/com.ibm.db2.luw.sql.ref.doc/doc/r0000875.html
joined-table
>>-+-table-reference--+-----------+--JOIN--table-reference--ON--join-condition-+-><
| '-| outer |-' |
+-table-reference--CROSS JOIN--table-reference------------------------------+
'-(--joined-table--)--------------------------------------------------------'
Note the new CROSS JOIN clause in newer releases. On a side note, V8 is no longer supported, you should really switch to a newer release ;-)
HTH.
Related
Today I had to rebuild our BugZilla installation. It has been painful, mainly because I unintentionally incurred an upgrade from MySQL 5.7 to MySQL 8.0. Now BugZilla is reporting an SQL syntax error. In an attempt to debug this, I connected directly to the database using the MySQl client and ran the following query:
SELECT * FROM groups;
This results in the error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups' at line 1
The same query works for any other table, just not "groups". I am exhausted and have no energy left to solve this. I am guessing that MySQL 8.0 introduced "GROUPS" as a keyword. I would appreciate some help.
Upon investigation it turns out that MySQL 8.0 has indeed introduced "groups" as a keyword, and BugZilla needs to be modified to quote the table name in all places. Unfortunately the database code is shared among many different types of database which all use different characters to quote table names.
My final solution was to switch to using PostgreSQL.
After upgrading from Oracle 11/12 to 18/19 I get this error: ORA-01036: illegal variable name/number.
The error occurred in a query like this:
SELECT * FROM (SELECT * FROM TABLE) MY_TABLE WHERE ROWNUM <= :P_ROWNUM
(Subquery + binding parameters)
The identical query works properly with the Oracle 11.2.0.4 or 12.1.0.2 client. It fails with the Oracle Client 18c or 19c.
PS: The Oracle Server is version 18c 64x for Windows.
I use Delphi 10.1.2 with ADO components (dbGO). I also tried with Delphi 13.3.3 but the behavior is the same.
It seems to be a problem in the Oracle OLE DB provider (ORAOLEDB).
If I don't use ADO but DevArt Unidac all worked as expected.
Someone can help me?
Max
Your query is fine. We ran into a similar issue when migrating from 12.1 to 19. In our case, we have a custom OLE DB provider that interfaces with OraOLEDB (and others) using the Microsoft OLE DB Provider Templates (ATL). When attempting to upgrade from 12.1.x to 19c we started seeing the strange and confusing "ORA-01036: illegal variable name/number" error for parameterized SELECT queries. The queries would succeed the first time they were executed but subsequent executions would fail when all we did was change the parameter value (the queries were executed sequentially). I went on a wild goose chase trying to diagnose the issue and finally decided it had to be an Oracle caching bug of some kind. Yesterday, I experimented with the cache-related connection string attributes and found that adding the MetaDataCacheSize attribute and setting its value to 0 (zero) resolved the issue for us. None of the current Oracle patches appear to address this issue, at least none of those that mention the ORA-01036 error.
I am trying to execute one SQL, which is made up of bind variables. It's working fine with ORACLE DB but not with DB2
Here is the sample SQL: (UPPER/UCASE it can be anything)
SELECT Col1 FROM tab1 WHERE Col1 = 'abc' AND (UPPER(Col1) LIKE (UPPER(:1) || '%' ESCAPE '\') ORDER BY 1
Error is as follows:
db2 => SELECT Col1 FROM tab1 WHERE Col1 = 'abc' AND (UPPER(Col1) LIKE (UPPE
R(:1) || '%' ESCAPE '\') ORDER BY 1
SQL0104N An unexpected token "1" was found following "". Expected tokens mayinclude: "<IDENTIFIER>". SQLSTATE=42601
I am not sure, what is the problem here. Its not prompting for input bind value.
In Oracle DB, everything is working fine.
In DB2, I used command line to execute the query. For Oracle, I used ORACLE SQL developer.
You are using the interactive CLP for Db2 on Microsoft Windows, while connected to a remote Db2-for-Z/OS database.
This CLP interface does not have any functionality for prompting for host-variable values in dynamic-SQL. That's why you get the error message.
You can either use an alternative interface (for example IBM Data Studio, or many other java based database front-end tools) , or continue to use Oracle-SQL-Developer to access Db2 for Z/OS.
You can configure 'Oracle SQL Developer' to use the Db2 type-4 jdbc driver (db2jcc4.jar) along with the licence file for Db2 for Z/OS ('db2jcc_license_cisuz.jar'). You will need to get the Db2 licence file from your mainframe DBA or from Passport-Advantage, or alternatively connect via a Db2-connect gateway server (in which case you won't need a separate licence file on the workstation running Oracle-SQL-Developer).
However, the degree to which each such tool understands Db2-for-Z/OS varies, so if you get issues that you cannot easily workaround, then use instead the free IBM Data Studio which works with Db2-for-Z/OS, and Db2-for-i, and Db2 for LUW.
Configuring SQL-Developer to access Db2 is documented widely, including on this website, and also by Oracle. So do your research, this is not programming but configuration. Stackoverflow is for programming questions.
I am using Oracle SQL Developer version 4.1.0.19.
So this can be a very simple issue but I cannot seem to find the solution anywhere as I have just started using SQL Developer.
I type in this query
create table Student(Stu_id INTEGER,Stu_name VARCHAR(60),Stu_email VARCHAR(60))
select * from Student
And when I Run the SELECT query, I get an error something like this:
Method oracle/jdbc/driver/T4CCallableStatement.isClosed()Z is abstract
I have no idea as to why this is happening , this may be very stupid but I cannot seem to find a solution.
BTW I am using Oracle 11g version.
How did you install SQL Developer? Can you download the zip off of OTN and extract it to a fresh directory and try running it from there?
Your error message indicates something VERY bad is wrong with one of the drivers. Which makes me wonder if you messed with one of the JARs or are attempting to use an old Oracle Client with a THICK connection.
I have Oracle 11.2.0 (x64) installed on my personal development environment. When running SQL selections that Left Join more than 10 tables I am easily to get Oracle crash with ORA-12537: Network Session: End of file. If I use Inner Join there is no such problem. For a same particular query this happens all the time, no matter how many data is in my database (in fact not much data is there, no more than several hundred rows.)
I work with around 100 people who install Oracle with same version and roughly same settings, and apparently not seen anywhere else as far as I know.
This error can be triggered no matter if I run the query from SQL Developer or using C#.Net Data Access.
Any ideas please?
My Alert/Log.Xml has these:
Exception [type: ACCESS_VIOLATION, UNABLE_TO_READ] [ADDR:0x45] [PC:0x35797B4, _kkqstcrf()+1342]
and
Errors in file c:\oracle\diag\rdbms\orcl1\orcl1\trace\orcl1_ora_1192.trc (incident=41028):
ORA-07445: exception encountered: core dump [kkqstcrf()+1342] [ACCESS_VIOLATION] [ADDR:0x45] [PC:0x35797B4] [UNABLE_TO_READ] []