Error in connection with database - sql

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.

Related

Apache Derby - Does it support 'WITH'

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

Syntax error JMeter DB2

Hy guys,
I'm trying to setup a DB2 (V11.1) stress test using Jmeter (3.1).
I've downloaded JMeter and the jdbc driver.
I've copied the jdbc driver into JMETER_DR/lib/db2jcc4.jar
I've created a Thread Group with 10 users
I've created the JDBC connection (disabling the Connection validation by Pool). Database URL: jdbc:db2://10.40.2.157:50000/TEST . JDBC Driver Class: com.ibm.db2.jcc.DB2Driver
I've created the JDBC Request: Query Type: Select Statement. Query: select * from TEST.TESTTABLE;
When I run the test plan I got the error:
1489682525237,5,DB2 JDBC select,42601 -104,"com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=;;from TEST.TESTTABLE;END-OF-STATEMENT, DRIVER=4.16.53",DB2 Thread Group 1-1,text,false,,108,0,1,1,0,0,0
I've tested the same connection parameters and query using another Software (RazorSQL) and they are fine.
What it could be?
You received the illegal symbol error.
Using semicolon after a single statement may produce this error.
Try to remove the semicolon ;

Read access violation related to input(variable,anydtdtm.);

Somebody tell me I'm not crazy. I have SAS on a server, and I'm running the following code:
data wtf;
a=".123456 1 1";
b=input(a,anydtdtm.);
run;
If I run this on my local computer, no problem. If I run this on the server, I get:
ERROR: An exception has been encountered.
Please contact technical support and provide them with the following traceback information:
The SAS task name is [DATASTEP]
ERROR: Read Access Violation DATASTEP
Exception occurred at (04E0AB8C)
Task Traceback
Address Frame (DBGHELP API Version 4.0 rev 5)
0000000004E0AB8C 0000000009C4EC20 sasxdtu:tkvercn1+0x9B4C
0000000004E030D9 0000000009C4F100 sasxdtu:tkvercn1+0x2099
0000000005FF14BE 0000000009C4F108 uwianydt:tkvercn1+0x47E
0000000002438026 0000000009C4F178 tkmk:tkBoot+0x162E6
Does anyone else get this error???
This is an internal bug that cannot be resolved by the user. You'll need to send this information, your environment description, and the exact steps to recreate the bug over to SAS Technical Support to open up an investigation and determine a workaround.
If your server is a database not made up of .sas7bdat files, it might be due to the SAS/ACCESS engine attempting to translate the function into a way that the server's language can understand, but is unable to do so properly; that is, it might think it's doing it correctly, but it's not. There are special cases where this can occur, and you may have discovered one.
If you are in fact querying some other database, try adding this before running the data step:
options sastrace=',,,d' sastraceloc=saslog;
This will show all of the steps as SAS sends data & functions to and from the server, and may help give some insight.
I am getting the same error on Linux system running SAS 9.4
AUTOMATIC SYSSCP LIN X64
AUTOMATIC SYSSCPL Linux
AUTOMATIC SYSVER 9.4
AUTOMATIC SYSVLONG 9.04.01M3P062415
AUTOMATIC SYSVLONG4 9.04.01M3P06242015
Until SAS can fix the informat you probably need to add additional testing in your code to exclude strange values like that.

Postgresql job scheduler using pgagent giving error with update query

I have created a job scheduler using pgagent in postgresql:
What I did is mentioned as screen shots
I had created like this to update name in my database field in a certain time. But when I check it is getting failed.
The failed status as follows:
What I did wrong? How can I correct it?
I have also faced the same problem exactly. By trial and error, I changed the Connection Type from Local to Remote and gave the following connection string
user=some_user password=some_password host=localhost port=5432 dbname=some_database
in the properties of the Step. And, it worked. So, the trick is to treat even the local server as a remote server.

Validate Hive HQL syntax?

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.