Priority REST: Does not support OData parameter “$count” - priority-web-sdk

Does not support OData parameter "$count".
https://www.odata.org/getting-started/basic-tutorial/#count
It is very important parameter which helps to reduce time for requests.
Moreover, it should be supported if you declare that you are working on an OData protocol.
Requests:
https://my.domain.com/odata/Priority/tabula.ini/demo/DOCUMENTS_D/$count
https://my.domain.com/odata/Priority/tabula.ini/demo/DOCUMENTS_D?$count&$filter=CDES eq 'Some text'
(As usual) Return incorrect "500 Internal Server Error" error.
Is this issue are common for whole Priority REST ?
When you plan to add support of "count" parameter ?

Indeed the $count parameter is not implemented.
It is not mandatory by the Odata protocol specification to support the $count parameter
(on the Minimal and Intermediate Conformance Levels).
Maybe you can use $top parameter in some cases to limit the size of the result.
Regarding the 500 Server error, I suggest you add to the web.config file
the line
<customErrors mode="Off" />
in the system.web section.
Then you may see a more informative error.

Related

org.apache.hive.jdbc.HiveDriver: HiveBaseResultSet has not implemented absolute()?

I just started using the driver org.apache.hive.jdbc.HiveDriver (Version
1.2.1 for spark2) with a Spark Thrift Server (STS) (reference here)
java.sql.ResultSet defines the method absolute() (JavaDoc here)
but HiveBaseResultSet seems to have chosen not to implement the method (source code here)
So now my application (built on top of SmartGWT) was doing a simple operation and I got the following error message:
=== 2017-05-13 18:06:16,980 [3-47] WARN RequestContext - dsRequest.execute() failed:
java.sql.SQLException: Method not supported
at org.apache.hive.jdbc.HiveBaseResultSet.absolute(HiveBaseResultSet.java:70)
at org.apache.commons.dbcp.DelegatingResultSet.absolute(DelegatingResultSet.java:373)
at com.isomorphic.sql.SQLDataSource.executeWindowedSelect(SQLDataSource.java:2970)
at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:2024)
What is the reason that the driver chose not to implement absolute()?
Are there any workaround for the limitation?
Thanks for the hint from Mark Rotteveel. Now I understand better and let me post an answer to my own question.
Implementation of absolute() is optional
As specified by the Interface of ResultSet#absolute() (link), the implementation for absolute() is optional -- especially when the result set type is TYPE_FORWARD_ONLY.
Workaround
In my case, the result set comes from a Spark Thrift Server (STS) so I guess it is indeed forward-only. So the question became how to instruct my application to NOT making a call to absolute(), which is basically for cursor movement.
SmartGWT-specific answer
For SmartGWT, this is controlled by a property called sqlPaging, which we can specified for an OperationBinding. The right value to use seems to be dropAtServer (more reference here). So I set my SmartGWT DataSource XML file to something like this
<operationBindings>
<operationBinding operationType="fetch" progressiveLoading="false"
sqlPaging="dropAtServer"
>
After that I saw another error, which is now related to HiveConnection#commit():
java.sql.SQLException: Method not supported
at org.apache.hive.jdbc.HiveConnection.commit(HiveConnection.java:742)
at org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334)
at com.isomorphic.sql.SQLTransaction.commitTransaction(SQLTransaction.java:307)
at com.isomorphic.sql.SQLDataSource.commit(SQLDataSource.java:4673)
After more digging, I realized that the right property for SmartGWT to control the commit behavior is autoJoinTransactions and I should set it to false (more reference here). After these two changes, I could get may application to talk to STS via jdbc.HiveDriver
For anyone out there who are also trying this, here is my full settings for the driver in SmartGWT's server.properties (more reference here)
sql.defaultDatabase: perf2 # this name is picked by me, but it can be anyname
sql.perf2.driver.networkProtocol: tcp
sql.perf2.driver: org.apache.hive.jdbc.HiveDriver # important
sql.perf2.database.type: generic # important
sql.perf2.autoJoinTransactions: false # important
sql.perf2.interface.type: driverManager # important
sql.perf2.driver.url: jdbc:hive2://host:port # important -- pick your host:port
sql.perf2.driver.user: someuser # important -- pick your username
sql.perf2.interface.credentialsInURL: true
sql.perf2.driver.databaseName: someDb
sql.perf2.driver.context:

WLST offline jdbc name contains slash

I am trying to create a datasource jdbc for weblogic using WLST offline.
cd('/')
create('jdbc/test', 'JDBCSystemResource')
cd('JDBCSystemResource/(jdbc/test)/JdbcResource/(jdbc/test)')
but I keep getting an error:
No such element JdbcResource named jdb
On the oracle website they say to use parentheses but still on the JdbcResource part it fails.
It would appear you can't use slashes in names when using WLST Offline. Tucked away in the WLST Documentation ...
When using WLST offline, the following characters are not valid in names of
management objects: period (.), forward slash (/), or backward slash (\).
I would suggest not having the 'jdbc/' in the name of the data source, you can use it in the JNDI name for the DS since it's this value which a client will use to find it.
UPDATE:
I had interpreted that comment on the use of parentheses as referring to WLST online, but having done a bit more experimenting you are correct and that's not the case. I used the console to create a data source called 'jdbc/test'. Then using WLST online I was able to do cd straight to it ...
wls:/soa_domain/serverConfig> cd ('JDBCSystemResources/jdbc/test/JDBCResource/jdbc/test')
wls:/soa_domain/serverConfig/JDBCSystemResources/jdbc/test/JDBCResource/jdbc/test> ls()
dr-- InternalProperties
dr-- JDBCConnectionPoolParams
dr-- JDBCDataSourceParams
dr-- JDBCDriverParams
dr-- JDBCOracleParams
dr-- JDBCXAParams
-r-- Name jdbc/test
-r-- Version null
-r-x isSet Boolean : String(propertyName)
-r-x unSet Void : String(propertyName)
I then tried the same using offline using parentheses around both occurrances of the name and this failed. I then tried moving up the tree one element at a time and the first three succeeded (so the brackets are definitely for use in offline)...
wls:/offline/soa_domain>cd ('JDBCSystemResource/(jdbc/test)/JdbcResource')
wls:/offline/soa_domain/JDBCSystemResource/(jdbc/test)/JdbcResource>ls()
drw- jdbc/test
It's the last element which fails. Without brackets you get the 'No such element' error ...
wls:/offline/soa_domain/JDBCSystemResource/(jdbc/test)/JdbcResource>cd ('jdbc/test')
Error: cd() failed. Do dumpStack() to see details.
wls:/offline/dev2_soa_domain/JDBCSystemResource/(jdbc/test)/JdbcResource>dumpStack()
com.oracle.cie.domain.script.jython.WLSTException:
com.oracle.cie.domain.script.ScriptException: No such element JdbcResource named jdbc
With brackets you get ...
wls:/offline/soa_domain/JDBCSystemResource/(jdbc/test)/JdbcResource>cd ('(jdbc/test)')
Error: cd() failed. Do dumpStack() to see details.
wls:/offline/soa_domain/JDBCSystemResource/(jdbc/test)/JdbcResource>dumpStack()
com.oracle.cie.domain.script.jython.WLSTException: java.lang.UnsupportedOperationException: Could not create generic operation:JdbcResource
....
Caused by: java.lang.UnsupportedOperationException: Could not create generic operation:JdbcResource
at com.oracle.cie.domain.operation.OperationBuilder.createConfigOperation(OperationBuilder.java:339)
So in summary, I think you've found a bug there. I think your options are either to use WLST online or to not have a slash in the name although it's still fine (and indeed standard practice) have a slash in the JNDI name.
Your navigation to MBean is need to modified...
Can you try this example script given below?
http://wlstbyexamples.blogspot.in/2010/02/configuring-generic-datasource.html

jmeter jdbc variable names query

Again more apologies from myself for being a Jmeter newbie - I'm a little stuck with the JDBC requests - I've trawled through the posts on this site for the last 3 hours - but I can't quite find anything relevant (unless I'm missing something).
My environment: Jmeter v2.11, JDK 7, Oracle 12
It's very simple - I have a JDBC Sampler that I need to setup to use the value that is provided by a JDBC PreProcessor.
Essentially I have a JDBCPreProcessor setup to identify the next (new) record's unique reference (call it applicationID)
JDBC PreProcessor Details
Select Statement --> select max(applicationID)+1 from table;
I have a JDBC Sampler setup that I need to use the 'max(applicationID)+1' value (determined by the JDBC preprocessor)
JDBC Sampler Details
Select Statement --> select status from table where applicationID = 'max(applicationID)+1'
I am unsure how to do this. I have looked at the instructions and a lot of other Jmeter JDBC request posts, but I'm afraid I can't find the relevant info I need.
I did try including adding a 'Variable Name' of 'maxrecordidvar' in the JDBC PreProcessor and set the JDBC Sampler query --> select status from table where applicationID = maxrecordidvar
HOWEVER - this (obviously) didn't work - I get an Oracle error 'ORA-00904: "MAXRECORDIDVAR": invalid identifier'
Again, many apologies if this is a stupid question and many thanks for all/any help anyone can provide!
I have simulated a concept of this using MYSQL, but the test plan is similar.
JDBC pre processor to get an Integer
Use that integer in a following JDBC request
First, the JDBC PreProcessor and JDBC Request do not just simply emit to a single variable, but rather expose a few variables based on your name. For example
Query : select CAST(RAND() * 242 AS UNSIGNED);
Variable Name : foo
Which means later on I have access to
${foo_#} - the number of rows (which should be 1)
${foo_1} - the value in first column row 1
This query only has one column and row, otherwise ${foo_2} would be first column row 2. More docs at JDBC Request
Second, to use with in my JDBC Request I had to use a Prepared Select Statement. Passing in ${foo_1} as the Parameter Value and INTEGER as the Parameter Type (I am using mysql).
I posted a simulated load test and JMX File.
I believe that using __intSum() or longSum() function is easier way of incrementing your "applicationID" variable by one.
See How to Use JMeter Functions posts series for advanced information on different JMeter functions, where to place, how to use them, etc.

Is the “Maximum number of POST request parameters” limit trappable?

Coldfusion 10 allows a limit to be set for the maximum number of POST request parameters (Server Settings / Settings / Request Size Limits / Maximum number of POST request parameters). The default limit is 100.
Is it possible to trap when this limit has been exceeded so that it can be handled with a custom handler? If yes, how?
I've tried to trap it with a site wide error handler and an onError() method in Application.cfc. Neither attempt was successful.
Thanks for looking.
I can confirm the behavior you are seeing. I think the exception is being thrown by the CF servlet, before Application.cfc is invoked, which would explain why onError never fires.
So far, the only option that worked for me is adding a custom error page in WEB-INF\web.xml, using an HTTP status code:
<error-page>
<error-code>400</error-code>
<location>/path/to/myErrorPage.cfm</location>
</error-page>
Note: From the comments, #Adrian mentioned that he added the above to \cfusion\runtime\conf\web.xml, rather than the one in web-inf\.
Update 1:
Further reading suggests you can also configure things at a more granular level. To handle a specific kind of exception, use <exception-type> instead of <error-code>. For example:
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/path/to/myErrorPage.cfm</location>
</error-page>
That said, in my (brief) test, CF10 appeared to use very general exception classes for this error. Both of which have many potential causes, not just posting too many form fields. So keep that in mind. Granted it is a bit more focused than handling all HTTP 500 errors, but it may still encompass other causes as well.
javax.servlet.ServletException: ROOT CAUSE:
java.lang.IllegalStateException: Cannot call sendError() ..
Update 2:
Turns out the javax.servlet.ServletException was just a red herring. As #AdrianWright pointed out in the comments, that error is related to Debugging Settings. When CF generates the "Maximum number of POST request parameters" message, it does not properly account for debugging, which in turn causes a new exception: java.lang.IllegalStateException. Hence the HTTP 500 error:
When debugging is disabled (as it would be on a production system) CF simply writes an error message directly to the response stream and returns HTTP status code 400. Since no exception is thrown, <exception-type> is useless here. So you are stuck with using status code:
<error-page>
<error-code>400</error-code>
<location>/path/to/myErrorPage.cfm</location>
</error-page>
However, on the custom error page, you can extract the error message from the request stream. Then handle it accordingly:
<cfset req = getPageContext().getRequest()>
<cfset message = req.getAttribute("javax.servlet.error.message")>
<cfif message contains "POST parameters exceeds">
Too many form fields. do something...
<cfelse>
Some other cause. do something else
</cfif>
If the limit is exceeded, then there would be entries in the ColdFusion exception and application log.

Dapper.net Oracle parameter

I am trying to use Dapper.net with Oracle.
From this post i understood that we could use parameters with no prefixes and dapper would then work for both sql serverand oracle
I'm having a hard time making it to work without the explicit oracle named parameters prefix :
The following query
sqlConnection.Query("Select * FROM document WHERE id = param1", new { param1 = 963 });
Throws ORA-00904: "PARAM1": invalid identifier
If i try with the # prefix it throws ORA-00936: missing expression
If i use the : prefix it works as expected. But i do not want my queries to be dependent (as far as possible) upon Oracle or Sql Server.
I am using the latest nuget package version Dapper.dll 1.12.1.1
What am I doing wrong or did i misunderstand this post?
Yes, you misunderstood the post. The SQL is passed through as-is, and must contain the correct :param1 or #param1 etc. The "no prefix at all" is talking about the code that you don't see - specifically, making sure that the code does (via some mechanism):
cmd.Parameters.Add("param1", 963);
vs
cmd.Parameters.Add("#param1", 963);
vs
cmd.Parameters.Add(":param1", 963);
The first (no prefix) is the correct and preferred option.
If you want the SQL in your code to be parameter agnostic, you could use the information from here: Get the parameter prefix in ADO.NET
The SQL is rarely close enough, however, that just looking up the parameter prefix will fix all problems.

Resources