public class DslJdbcConnectionPool extends BaseConfigElement
guiClass, name| Constructor and Description |
|---|
DslJdbcConnectionPool(String name,
Class<? extends Driver> driverClass,
String url) |
| Modifier and Type | Method and Description |
|---|---|
DslJdbcConnectionPool |
autoCommit(boolean enabled)
Allows setting if auto-commit is enabled or not in pool connections.
|
protected org.apache.jmeter.testelement.TestElement |
buildTestElement() |
DslJdbcConnectionPool |
maxConnections(int maxConnections)
Allows setting max number of connections to keep with the database.
|
DslJdbcConnectionPool |
maxConnectionWait(Duration maxConnectionWait)
Specifies the time to wait for a connection to be available.
|
DslJdbcConnectionPool |
password(String password)
Allows setting the password required to connect to the database.
|
DslJdbcConnectionPool |
transactionIsolation(int transactionIsolation)
Allows specifying the transaction isolation level to use for queries executed by this pool.
|
DslJdbcConnectionPool |
user(String user)
Allows setting the username required to connect to the database.
|
buildConfiguredTestElement, buildTestElementGui, buildTreeUnder, configureTestElement, durationToSeconds, getGuiClass, getName, loadBeanProperties, showAndWaitFrameWith, showFrameWith, showInGui, showTestElementGuiclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuildTreeUnder, showInGuipublic DslJdbcConnectionPool user(String user)
user - is the username to connect to the database with.public DslJdbcConnectionPool password(String password)
password - is the password to connect to the database with.public DslJdbcConnectionPool autoCommit(boolean enabled)
When enabled, auto-commits avoid having to explicitly commit each modification query (insert, update, delete, etc.), but on the other hand, when doing several queries in batch, it is not as performant as committing several queries at once. Additionally, you might want to disable auto-commit when you want a set of queries to execute in transaction mode (rolling back previous modifications on some particular conditions).
When auto-commit is disabled, you will need to use DslJdbcSampler.commit() for changes
to take effect, and might optionally use DslJdbcSampler.rollback() to cancel the
transaction.
enabled - specifies whether auto-commit is enabled or disabled by default. The connection
behavior can be changed at any point in time by DslJdbcSampler.autoCommit(boolean).public DslJdbcConnectionPool maxConnections(int maxConnections)
The number of connections has a direct impact on database performance and in JMeter required memory. In general the default setting, 0, is good enough, assigning one connection to each JMeter thread. If you set it to another value then the pool of connections will be shared by all threads in JMeter and you should be careful to set it to a number that avoids threads waiting for each other on a connection to be available (eg: setting it to the max number of threads).
maxConnections - specifies the maximum number of connections to use to connect to the
Database. 0 means one connection per thread. When set to a value
different from 0, then connections are shared by JMeter threads.public DslJdbcConnectionPool maxConnectionWait(Duration maxConnectionWait)
When this time is surpassed waiting for a connection, then an error will be generated.
Is usually a good practice to set this to a value that can detect potential unexpected behavior. I.e.: set it to a value that is big enough for usual behavior not to fail, but low enough for detecting unusual/unexpected behavior.
maxConnectionWait - duration to wait for a connection until an error arises. By default
this is set to 10 seconds. If set to 0 seconds, it means that it will
wait indefinitely for the connection (which is not advisable).public DslJdbcConnectionPool transactionIsolation(int transactionIsolation)
Transaction isolation level are usually required to be tuned either to improve performance or avoid potential conflicts between concurrent queries.
transactionIsolation - specifies a transaction level which value is -1 or one of Connection.TRANSACTION_NONE,
Connection.TRANSACTION_READ_COMMITTED,
Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_REPEATABLE_READ or Connection.TRANSACTION_SERIALIZABLE. By default is set to -1,
which means that it will use the default level for the connection
string, session or database.Connectionprotected org.apache.jmeter.testelement.TestElement buildTestElement()
buildTestElement in class BaseTestElementCopyright © 2022. All rights reserved.