Couldn't find anything on the Internet for this at all and wondered if someone could help me.
Using Apache Derby with a query in a Spring Boot app:
The query starts like this:
WITH dbName AS {
(Then goes on to select data from tables)
}
When running my test cases I get an exception which reads:
java.sql.SQLSyntaxErrorException: Syntax error: Encountered "with" at line 1, column 1
Does Apache Derby support WITH? I can't see any other reason why this shouldn't work.
After some more research, I can confirm that Derby does not support recursive queries
Found this Issue https://issues.apache.org/jira/browse/DERBY-11
Related
I have an issue on an sql statement with the mariadb-connect-engine.
Actually it's the NOT LIKE operator which return really strange result.
On this sql request :
SELECT ARS_RESSOURCE, ARS_LIBRERES1 FROM ressource WHERE ARS_RESSOURCE NOT LIKE '568614561456%'
it would return all the result in the datatable, but it just don't return anythink while :
SELECT ARS_RESSOURCE, ARS_LIBRERES1 FROM ressource WHERE ARS_RESSOURCE LIKE '%'
or :
SELECT ARS_RESSOURCE, ARS_LIBRERES1 FROM ressource WHERE ARS_RESSOURCE LIKE '01%'
return all the result asked.
Did i do something wrong or the NOT LIKE operator on a connect table have a diferrent behaviour than on classic connector ?
To be more accurate i use a connect table from mariadb to sqlserver, so maybe this behaviour could be cause by the ODBC driver or something but i don't find any clue at the moment
Actually I opened an issue on the support site of MariaDB and the NOT LIKE operator isn't works properly at the moment with the CONNECT engine when you use it with the CONNECTION argument to connect on an other table.
Here is the link of the opened issue on mariaDB.org:
link to jira.mariadb.org
maybe this could help some people with the same issue.
(to be more accurate this was opened on 10.2.* version of MariaDB and not solve at this date)
I've made a very simple database and am trying
select * from klant;
I've verified the table exists, and last week was able to see data in it. Today however I keep getting
Statement failed, SQLSTATE = 42S02
Dynamic SQL Error
-SQL error code = -204
-Table unknown
-KLANT
-At line 1, column 15
The same select query in flameRobin gives the following error:
Error: *** IBPP::SQLException ***
Context: Database::Statistics
Message: isc_database_info failed
SQL Message : -902
can't format message 13:98 -- message file C:\WINDOWS\SYSTEM32\firebird.msg not found
Engine Code : 335544727
Engine Message :
Error writing data to the connection.
I have copied the firebird.msg to the system32 folder so it should be able to find it there.
Any pointers toward the solution would be greatly appreciated. Similar question all seem to point toward issues with transactions, I can't see that being the problem here.
Edit:
I'm using the included ISQL tool from firebird and start the session by connecting to the database that includes my table. Same for flamerobin, first connect to database, I can see the table that i want to select from but it gives this error.
Edit2:
Finally reinstalled Firebird making sure I gave it admin right, which I think it had before, but wasn't sure about. This seems to have fixed it.
I’m installed oracle 11g R2 in my system. But when I connect to the database in sql developer it shows the error as following:
An error was encountered performing the requested operation:
The Network Adapter could not establish the connection
Vendor code 20
I know it was due to the incorrect CLASSPATH for oracle
My CLASSPATH for oracle and java are:
E:\app\JamesPJ\product\11.2.0\dbhome_1\jlib\orai18n.jar.;E:\app\JamesPJ\product \11.2.0\dbhome_1\jdbc\lib\ojdc6_g.jar.;E:\app\JamesPJ\product\11.2.0 \dbhome_1\BIN.;C:\Program Files\Java\jdk1.7.0_09\bin.;C:\Users\JamesPJ\Documents.;E: \app\JamesPJ\product\11.2.0\dbhome_1\jdbc\lib.;E:\app\JamesPJ\product\11.2.0\dbhome_1\jlib.;E:\app\JamesPJ\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar.;E:\app\JamesPJ\product\11.2.0\dbhome_1\oc4j\jdbc\lib\orai18n.jar.;E:\app\JamesPJ\product\11.2.0\dbhome_1\oc4j\jdbc\lib\ocrs12.jar
I don’t know those variables are correct or not.
If any one know the solution for it, please answer me….
Thanks in advance….
Try to replace all found .; in your CLASSPATH with ; and eleminate whitespaces such as in:
E: \app\JamesPJ\product\11.2.0\dbhome_1\jdbc\lib
then try again, your classpath doesnt look normal now.
I created a Sybase database emp_details using SQL Anywhere and Sybase Central. I had given emp/emp as dba username/password while creating.
The db got created and the files were generated in the given folder.
When I tried running the below script using Ineractive SQL:
use master
go
if exists (select 1 from master..sysdatabases where name='emp_details')
checkpoint emp_details
go
It threw the following exception
Could not execute statement.
Syntax error near 'checkpoint' on line 2
SQLCODE=-131, ODBC 3 State="42000"
Line 4, column 1
Haven't been able to figure out what exactly the syntax issue is and have been stuck up with this for a while.
Any ideas?
First of all, you may want to think about posting your SQL Anywhere questions to the http://sqlanywhere-forum.sap.com/ forum. It's a forum dedicated to the SQL Anywhere product line.
Is there any possibility that the two periods together might be causing your syntax issue?
Normally you're not going to get an exact area where the error is coming from. See if that helps. Also check out the other forum as well.
Is there a programmatic way to validate HiveQL statements for errors like basic syntax mistakes? I'd like to check statements before sending them off to Elastic Map Reduce in order to save debugging time.
Yes there is!
It's pretty easy actually.
Steps:
1. Get a hive thrift client in your language.
I'm in ruby so I use this wrapper - https://github.com/forward/rbhive (gem install rbhive)
If you're not in ruby, you can download the hive source and run thrift on the included thrift configuration files to generate client code in most languages.
2. Connect to hive on port 10001 and run a describe query
In ruby this looks like this:
RBHive.connect(host, port) do |connection|
connection.fetch("describe select * from categories limit 10")
end
If the query is invalid the client will throw an exception with details of why the syntax is invalid. Describe will return you a query tree if the syntax IS valid (which you can ignore in this case)
Hope that helps.
"describe select * from categories limit 10" didn't work for me.
Maybe this is related to the Hive version one is using.
I'm using Hive 0.8.1.4
After doing some research I found a similar solution to the one Matthew Rathbone provided:
Hive provides an EXPLAIN command that shows the execution plan for a query. The syntax for this statement is as follows:
EXPLAIN [EXTENDED] query
So for everyone who's also using rbhive:
RBHive.connect(host, port) do |c|
c.execute("explain select * from categories limit 10")
end
Note that you have to substitute c.fetch with c.execute, since explain won't return any results if it succeeds => rbhive will throw an exception no matter if your syntax is correct or not.
execute will throw an exception if you've got an syntax error or if the table / column you are querying doesn't exist. If everything is fine, no exception is thrown but also you'll receive no results, which is not an evil thing
In the latest version hive 2.0 comes with hplsql tool which allows us to validate hive commands without actually running them.
Configuration:
add the below XML in hive/conf folder and restart hive
https://github.com/apache/hive/blob/master/hplsql/src/main/resources/hplsql-site.xml
To Run the hplsql and validate the query , please use the below command:
To validate Singe Query
hplsql -offline -trace -e 'select * from sample'
(or)
To Validate Entire File
hplsql -offline -trace -f samplehql.sql
If the query syntax is correct , the response from hplsql would be something like this:
Ln:1 SELECT // type
Ln:1 select * from sample // command
Ln:1 Not executed - offline mode set // execution status
if the query Syntax is wrong , the syntax issue in the query will be reported
If the hive version is older, we need to manually place the hplsql jars inside the hive/lib and proceed.