I'm a problem in JDBC Connection Configuration.
When i execute my test (only JDBC Request - insert), doesn't appear any results in report (View Results Tree).
The connection is SQL Server.
See below the configuration:
database URL: jdbc:sqlserver://${myURL}
JDBC driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Username: ${user}
Password: ${password}
Could someone help me?
Thanks!!!
Make sure to add Microsoft JDBC Driver for SQL Server to JMeter Classpath and restart JMeter to pick up the .jar
Check jmeter.log file for any suspicious entries
Be informed that JDBC Connection Configuration is a Configuration Element hence it's being executed before anything else so your variables like ${myURL}, ${user} and ${password} might not have their respective values yet
Check that your query returns results in mssql-cli
Set the validation query to select 1 if it's different:
You can check out The Real Secret to Building a Database Test Plan With JMeter article for more comprehensive steps if needed.
Related
I'm trying to set up a Debezium SQL Server Connector against a SQL Server instance that is controlled by DBAs at my workplace. I've been able to start up Zookeeper and Kafka Server without issue, and Kafka Connect itself works with sample Connectors, but when attempting to start a Debezium SQL Server Connector instance I've been getting the error "Couldn't obtain database name".
[2022-07-12 16:36:04,269] ERROR Stopping after connector error (org.apache.kafka.connect.cli.ConnectStandalone:117)
java.util.concurrent.ExecutionException: org.apache.kafka.connect.runtime.rest.errors.BadRequestException: Connector configuration is invalid and contains the following 1 error(s):
Unable to connect. Check this and other connection properties. Error: Couldn't obtain database name
Here is my debezium config:
name=Dbz-SqlServer-connector
connector.class=io.debezium.connector.sqlserver.SqlServerConnector
database.hostname=MyDbHost
database.port=1433
database.user=MyUsername
database.password=MyPassword
database.dbname=MyDatabase
database.server.name=MyDbHost
table.include.list=dbo.CdcTest
database.history.kafka.bootstrap.servers=localhost:9092
database.history.kafka.topic=dbhistory.CdcTest
I've tried this in a .properties file passed to a standalone Connect instance, and as a JSON POST to a distributed Connect instance. I have tried all of the same steps on both my local Windows machine as well as on a linux VM, with the same results.
Confluent and Docker are not options for me in this situation.
for SQL Server login credentials, I am using a local account on the SQL Server instance that does have access to the database in question. I found the source code for debezium's connectors on their github and was able to find that specific error message within the code:
private static final String GET_DATABASE_NAME = "SELECT name FROM sys.databases WHERE name = ?";
...
public String retrieveRealDatabaseName(String databaseName) {
try {
return prepareQueryAndMap(GET_DATABASE_NAME,
ps -> ps.setString(1, databaseName),
singleResultMapper(rs -> rs.getString(1), "Could not retrieve exactly one database name"));
}
catch (SQLException e) {
throw new RuntimeException("Couldn't obtain database name", e);
}
}
I'm not completely familiar with Java but it appears that basically something is going wrong when the connector is trying to run "SELECT name FROM sys.databases WHERE name = 'MyDatabase'". When I run this against the database myself, logged in with the same account I'm using, it seems to work just fine, so I'm really not sure where to go from here. It is fair to say that since I'm not in full control of the SQL Server environment that I'm using, there may be some permissions issues that I'm not aware of, but from what I'm able to test it seems like it should be working.
I would greatly appreciate any help at all, whether just suggestions on settings/configs to check or a full-blown solution.
Thank you!
Update: I've built a simple console app to run that sys.databases query against MyDbHost, master database, as the relevant account, and it's working just fine so I feel like that confirms that my connection info is correct and account permissions are also correct. Seems like this is an issue within the Debezium connector.
It turned out that my problem was a mistake in the connector's config setting. I misunderstood which specific pieces of data to put into database.hostname and database.server.name, and one I corrected those fields the connector works.
I am trying to connect Jmeter to a geo redundant database with two hosts and I am struggling with finding the right Database Url format.
This is how my connection string looks like:
jdbc:oracle:thin:#(DESCRIPTION=(ENABLE=BROKEN)(FAILOVER=on)(CONNECT_TIMEOUT=5sec)(TRANSPORT_CONNECT_TIMEOUT=3sec)(RETRY_COUNT=3)(LOAD_BALANCE=on)(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=HostName)(PORT=port)))(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=HostName2)(PORT=port)))(CONNECT_DATA=(SERVICE_NAME=ServiceName)))
Database Connection Configuration is as following:
JDBC Driver Class: oracle.jdbc.OracleDriver Username: username
Password: password
For the Database URL I tried different formats and I keep getting the error:
Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'
Note that the ojdbc.jar file is in the /lib folder as per the Jmeter documentation. Also, the ports are the same for both hosts.
Any suggestion is welcome. :)
I don't think you will be able to establish the connection to Oracle RAC using JMeter's JDBC Connection Configuration as it doesn't allow full flexibility therefore you will not be able to properly instantiate the PoolDataSourceFactory
So I would recommend switching to JSR223 Test Elements and Groovy language where you will have the full freedom when it comes to setting up the connection, executing queries, accessing results, etc. The relevant code would be something like:
def prop = new Properties()
prop.put('oracle.jdbc.thinForceDNSLoadBalancing','true')
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource()
pds.setConnectionProperties(prop)
pds.setConnectionFactoryClassName('oracle.jdbc.pool.OracleDataSource'); pds.setUser('johndoe')
pds.setPassword('secret')
String dbURL =
'jdbc:oracle:thin:#(DESCRIPTION=(ENABLE=BROKEN)(FAILOVER=on)(CONNECT_TIMEOUT=5sec)' +
'(TRANSPORT_CONNECT_TIMEOUT=3sec)(RETRY_COUNT=3)(LOAD_BALANCE=on)(ADDRESS_LIST=(LOAD_BALANCE=on)' +
'(ADDRESS=(PROTOCOL=TCP)(HOST=HostName)(PORT=port)))(ADDRESS_LIST=(LOAD_BALANCE=on)' +
'(ADDRESS=(PROTOCOL=TCP)(HOST=HostName2)(PORT=port)))(CONNECT_DATA=(SERVICE_NAME=ServiceName)))'
pds.setURL(dbURL)
More information: Configuring Fast Connection Failover for JDBC Clients
It appears to be working with a connection string containing only host 1.
The Database URL is in the form:
jdbc:oracle:thin:#<hostname>:<port>/<serviceName>
Additionally, I got the error because the .jar file's path was not added to the classpath (click on Test Plan, in the bottom select browse next to Add directory or jar to classpath and select your odbc jar).
Another thing that was wrong was the Validation query, it should be "select 1 from dual" and also the query should not contain any semicolon at the end.
I hope this help people with the same issue.
I am trying to do the Load testing on a new Database XpressMP. So I started using jMeter for that. I configured jMeter to make a Select call to our database. Below is configuration-
And below is the Snapshot for XMP Select DB
And if I start my test in the jMeter, I always get this exception-
Response message: java.sql.SQLException: No pool found named: 'ucirrus', ensure Variable Name matches Variable Name of JDBC Connection Configuration
What does this exception mean?
I am pretty much sure, this is the problem with my JDBC Request configuration in my previous image. As I am doing this for the first time.
Can anyone tell me how to fix this problem?
You problem is that you don't use the right variable name.
In JDBC Connection Configuration (within Variable Name bound to pool) set:
Variable Name : ucirrus
I want to access tandem database, and for that i set
Driver : com.tandem.t4jdbc.SQLMXDriver
and test connection gives following error
com.eviware.soapui.support.SoapUIException: Failed to init connection for drvr [com.tandem.t4jdbc.SQLMXDriver], connectionString [jdbc:t4sqlmx://10.100.200.153:18650/catalog=QA_APPL;schema=APPLICATION;user=easyqa.appl;password=#QaAppl!]
IS Soupui supports this drives?
Thank you
Did you put the SQLMXDriver JDBC driver in the {your SoapUI installation}\bin\ext directory?
You should see it being loaded when SoapUI starts up.
You may also need to register it with a Groovy script:
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "com.???.jdbc.Driver" )
I'm new to Apache Cayenne, and I'm trying out my first project. I'm attempting to use the Tools > Reengineer Database Schema feature of CayenneModeler to reverse engineer a SQL Server database.
I attempted to create a new "Saved DataSource". I selected "org.apache.cayenne.dba.sqlserver.SQLServerAdapter" from its list of Adapters, and CayenneModeler automatically filled in the JDBC Driver field and added an example DB URL. I modified the DB URL, provided the username/password, clicked "Continue", and then I get the following error:
Driver load error: com.microsoft.sqlserver.jdbc.SQLServerDriver
I assume this means that CayenneModeler does have a driver for sqlserver by default(?) But I don't see a way to point CayenneModeler to any other drivers...
Any Cayenne experts out there know what I might be doing wrong? Is there a way to give CayenneModeler the driver it needs, assuming that is the problem? Or if a missing driver isn't the problem, does anyone know what is?
The location for adding additional drivers is under Tools > Preferences > ClassPath (Windows) or CayenneModeler > Preferences... > Classpath (OSX).