I am trying to test some JDBC methods using apache jmeter like getFunctions. I have successfully created DB connection and executed a query to create one function.
Now I wanted to test the output of getFunctions method. For this I am using JDBC Request Sampler. I have done below configuration for the JDBC request Sampler to test this method
When I run this Test I am getting below error
Response message: java.sql.SQLSyntaxErrorException: [XXXX][SQLServer JDBC Driver][SQLServer]Line 1: Incorrect syntax near 'NULL'.
I tried 'NULL' , "NULL" and $NULL$ but all are giving same exception.
Can someone please guide me how can I test such methods using JDBC request in Apache Jemeter
As far as I can see from getFunctions() method description it is applicable to DatabaseMetaData therefore unfortunately you won't be able to use JDBC Request sampler for testing this method.
The solution would be switching to JSR223 Sampler and Groovy language, the relevant code would be something like:
def conn = org.apache.jmeter.protocol.jdbc.config.DataSourceElement.getConnection('foo')
def resultSet = conn.getMetaData().getFunctions(null,null,null)
Demo:
Related
I have checked-in 'Generate parent sample' for a transaction controller which has a few HTTP requests. Aggregate Report shows only the transaction controller name but Simple Data Writer report shows both the transaction controller name and the HTTP requests under that. Is there a way to see the Simple data writer with only the transaction controller names and not the HTTP requests underneath?
Thanks,
N
Try running JMeter as:
jmeter -Jjmeter.save.saveservice.subresults=false
if it produces the output you want - you can make the change permanent by adding the next line to user.properties file:
jmeter.save.saveservice.subresults=false
More information:
Results file configuration
Configuring JMeter
Apache JMeter Properties Customization Guide
I am setting up a Spring-boot application to connect to HP NonStop Tandem's SQL/MX. First I achieved this connection by hard-coding the jdbc parameters like dataSource, URL, etc in the service section of the application and it worked (I was able to access tables by executing query).
Now I am trying to remove the hard coded part and have my database related info in application.properties file, but now I am getting the following error
org.springframework.jdbc.support.MetaDataAccessException: JDBC DatabaseMetaData method not implemented by JDBC driver - upgrade your driver; nested exception is java.lang.AbstractMethodError: Method com/tandem/t4jdbc/SQLMXConnection.isValid(I)Z is abstract
Can someone help me understand the root cause? The same driver jar is being used when hard-coding the datasource details and it worked but not working when having the data source properties in application.properties and needs an upgrade to the jar.
I encountered the same exception when using Spring Data JPA in a Spring Boot application, the JTDS driver and the Hikari connection pool. In my case I discovered that the following fixed the problem:
Examining the class com.zaxxer.hikari.pool.PoolBase, the following can be observed:
this.isUseJdbc4Validation = config.getConnectionTestQuery() == null;
Thus JDBC 4 validation will not be attempted if there is a connection test query configured. In a Spring Boot application, this can be accomplished like this:
spring.datasource.hikari.connection-test-query=select 1;
Regretfully I do not have any experience with the T4SQLMX driver but nevertheless hope this can be of some use.
I recently fought through the same issue, for me I was using a JDBC type 3 driver; but my spring implementation only supported a type 4 driver, thus when the method you linked above was attempted to be called, it caused the error.
I suggest you look for a type 4 driver for your particular database and see if that resolves your issue.
Using IntelliJ and a xml soap response, I get a xpath generated that is unique using IntelliJs built in functionality.
Putting this into gatling scala script
val scn = scenario("RuleEngineSimulation")
.exec(http("request_0")
.post("/EngasjementBasisA2A")
.headers(headers_0)
.body(RawFileBody("RuleEngineSimulation_request.xml"))
.basicAuth("test234","test234")
.check(xpath("/SOAP-ENV:Envelope/SOAP-ENV:Body/e:HentRisikoOversiktResponse/ef:engasjementOversiktRisikoer/ef:risikogrupper/ef:risikogruppe/ef:risikoer/ef:risiko/ef:partref/text()").saveAs("partref")))
Running this gives me the following:
Namespace prefix 'SOAP-ENV' has not been declared
Please advice.
Thanks
Magnus
I'm seeing something odd when I run a query in an application deployed in Oracle Application Server 10.1.3, with Oracle10g.
When I run a statement against the database directly (e.g. a standalone app that calls a DAO implemented with hibernate) I see the following:
select
documentco0_.CONTENT_ID as CONTENT1_63_0_,
documentco0_.TSTAMP as TSTAMP63_0_,
documentco0_.CONTENT as CONTENT63_0_
from
MySchema.MyTable documentco0_
where
documentco0_.CONTENT_ID=?
[main] TRACE org.hibernate.type.LongType - binding '1768334' to parameter: 1
[main] TRACE org.hibernate.type.TimestampType - returning '2013-08-05 17:31:32' as column: TSTAMP63_0_
[main] TRACE org.hibernate.type.BinaryType - returning '7f587f608090cac6c9c68081818180b380b380807f5b80c3807f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f40808b8880918091818191807f44809f8080818581818181818180808080808080808182838485868788898a8b7f44803590808281838382848385858484808081fd8182838084918592a1b1c18693d1e187a2f194b201112188a3c2314195d25170a4b3e2f202898a969798999aa5a6a7a8a9aab4b5b6b7b8b9bac3c4c5c6c7c8c9cad3d4d5d6d7d8d9dae3e4e5e6e7e8e9eaf3f4f5f6f7f8f9fa030405060708090a12131415161718191a22232425262728292a32333435363738393a42434445464748494a52535455565758595a6162636465666768696a7172737475767778797a7f5a808881818080bf80fef947bf520c730eff25ada7bd007c7f807a460efd87677f805625220aab7f59' as column: CONTENT63_0_
The same DAO operation when run within the application server however returns the following:
select
documentco0_.CONTENT_ID as CONTENT1_63_0_,
documentco0_.TSTAMP as TSTAMP63_0_,
documentco0_.CONTENT as CONTENT63_0_
from
MySchema.MyTable documentco0_
where
documentco0_.CONTENT_ID=?
2013-08-06 12:49:46,484 TRACE [AJPRequestHandler-RMICallHandler-12] myuser:4 (NullableType.java:133 nullSafeSet()) - binding '1768334' to parameter: 1
2013-08-06 12:49:46,500 TRACE [AJPRequestHandler-RMICallHandler-12] myuser:4 (NullableType.java:172 nullSafeGet()) - returning '2013-08-05 17:31:32' as column: TSTAMP63_0_
2013-08-06 12:49:46,500 TRACE [AJPRequestHandler-RMICallHandler-12] myuser:4 (NullableType.java:172 nullSafeGet()) - returning '80d48081818c808080818080808180808099ff0c809a5c9d809a5c9c80828082808080817f587f608090cac6c9c68081808080804818f7ef8081808080808080808080808080808080808080809a5c9c83408c508081' as column: CONTENT63_0_
You can see that the identifier and timestamp are the same in both cases, but the content blob is different: 360 bytes in the first case and 86 bytes in the second case.
The stand-alone application uses a BasicDataSource, while the application on the server uses a JNDI data source. I have verified that the BasicDataSource contains the same JDBC url that is used in the JNDI data source. Both data sources use the same credentials.
The database operation in the application server has a different trace output, using NullableType::nullSafeGet() to display information instead of org.hibernate.type tracing. I'm not sure if that is relevant.
Is there something obvious that I am overlooking here? I can't see why I am getting different results when running the same query on the same database.
edit: on OAS I have configured a JDBC ConnectionPool, that uses connection factory class oracle.jdbc.pool.OracleDataSource, and the JDBC data source is a managed data source pointing to that connection pool.
I'm thinking there may be an issue with different Oracle JDBC drivers? The BasicDataSource for the stand-alone app uses the JDBC driver oracle.jdbc.driver.OracleDriver and the dialect org.hibernate.dialect.Oracle10gDialect. I can't see any place in OAS administration that shows the equivalent values.
Please have a look at this article
Looks like, for some reason, OAS returns only 86 bytes of the BLOB value, unless you specify an Lob handler on your configuration.
You can also have more info on this thread of CodeRanch describing the same issue
Hope this helps!
I'm stuck trying to run a unit test that makes a web service request. I'm mocking the proxy object of the jax-ws request in my JUnit test using EasyMock.
I have defined the bean using DI in my application-context as follows:
<bean id="mockOrderPort" name="mockOrderPort" class="org.easymock.EasyMock" factory-method="createStrictMock" >
<constructor-arg value="com.proyecti.perama.siman.replica.integration.schema.OrderPort" />
</bean>
This is the test case that is failing:
//II. Fill the authentication response will be used to mock the server calling
final AuthenticationResponse authenticationResponse = new AuthenticationResponse();
authenticationResponse.setToken(encode(TestConstants.EMPTY_TOKEN));
//III. When authentication is called, mock must return the authentication request object created earlier
expect(mockOrderPort.authentication(EasyMock.anyObject(AuthenticationRequest.class))).andReturn(authenticationResponse);
//IV. Make the mock object available for executing the test
replay(mockOrderPort);
//V. Execute the test (call to server is produced inside this method)
executeTest();
//VI. Verify mock behaviour is correct
verify(mockOrderPort);
Inside the executeTest method, there is the call to the WS using the mocked proxy object:
authenticationResponse = portToServer.authentication(authenticationRequest);
No matter what I try, but it ALWAYS tries to connect to the actual WS, raising the following exception:
authentication request has not been successful. Exception: com.sun.xml.ws.client.ClientTransportException: HTTP Transport error: java.net.ConnectException: Connection refused: connect
Why is the mock object trying to connect instead of returning the object I have created?
Thanks!