How to do cosmos DB connection with JMeter? - database

In JMeter how to add connection string of Cosmos DB and how to configure all required JDBC driver setting in JMeter to connect Cosmos DB ?

Depending on how much you want to invest in terms of money and time the options are in:
Cdata Cosmos DB JDBC Driver (as of now it is something like $2k per machine per year). If you go for this option you will have possibility to use JMeter's JDBC Connection Configuration and JDBC Request sampler normally.
There is a Java SDK for CosmosDB, so you can download client library, add it to JMeter Classpath and use DocumentClient class in order to establish connection and perform operations from JSR223 Sampler using Groovy language.
Check out NoSQL tutorial: Build a SQL API Java console application article for comprehensive instructions, example code, etc.

Related

Does MSSQL JDBC utilize server aliases

I am preparing for a SQL Server database migration. I would like to use the alias functionality from the SQL Server Native Client, configured with cliconfg.exe, to redirect my client applications to the new server. I am using this in conjunction with DNS aliases so I can redirect the connection to a new port. However, my applications use MSSQL JDBC instead of the native client.
Does MSSQL JDBC use the alias settings from the native client? Is it, by chance, a wrapper over the native client functionality? Both are provided by Microsoft. If not, does MSSQL JDBC have an equivalent client-hosted server name redirect functionality? How is this configured?
I did some preliminary testing with the native client settings and it seems like the JDBC driver does not utilize the alias. However, the naming schemes are a bit different between the two so I may not have had the names correct. I am referring to jdbc:sqlserver://servername:port compared to servername,port in the alias tool.
I asked the mssql-jdbc team and at this time (Dec 2022) the driver does not support aliases.

What to add in a docker image for the airflow environment if we need the DAG to connect to a sql server? And what will be the code for the connection?

I want to connect to SQL server using my DAG in the airflow environment, what all libraries should I include in my docker image so that it creates the environment to connect the sql server.
My docker image includes:
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux
I believe including mssql among the list of Airflow extras should suffice
pip install 'apache-airflow[mssql]'
EDIT-1
responding to query raised in comments
Assuming you are
Creating an Airflow Connection (webUI or otherwise)
Using an Airflow Hook, namely MsSqlHook
Airflow will take care of generating the connection string for you
It picks conn_type from the category Microsoft SQL Server
It creates the properly formatted endpoint URI
And DbApiHook that extends MsSQLHook also offers methods like get_records()
As for example you can see this

Testing multiple connections to SQL Server

We're migrating SQL2005 Enterprise to SQL2012 Enterprise (on a new server too, from WIn2003 to Win2012).
Is there a way to test multiple connections to the database to prove it can take the same load as the previous server?
The application is a website, .Net3.5 with Min and Max pool size set in the connection string.
You can do it via Apache JMeter and next few steps:
Download jTDS JDBC Driver and drop it to /lib folder of your JMeter installation
Restart JMeter
Add Thread Group to Test Plan and configure virtual users and iterations count
Add JDBC Connection Configuration and provide JDBC url, driver class name and credentials
Database URL: jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
JDBC Driver class name: net.sourceforge.jtds.jdbc.Driver
Add JDBC Request sampler and put your query there
Repeat step 5 for all query types
Add a listener, i.e. Aggregare Report
See The Real Secret to Building a Database Test Plan With JMeter guide for more detailed explanation of database load testing domain.

Servelt Database Connectivity: JDBC, ODBC, Connection Pooling and

For an exam question, I am looking at the various ways in which a servlet can make a connection to a database connection. So far I have
JDBC
ODBC
Database Pooling
But the question asks for 4, and I cannot seem to find the 4th alternative. Does it actually exist?
I suspect you might want to look at the Java Persistence API. Go Google JPA.
I would add JNDI lookup and connecting directly using DriverManager. And what is database pooling? Do you mean connection pooling?
On the other hand if they are asking about high-level technologies: jdbc -> mybatis -> hibernate -> jpa.
A servlet can't really use ODBC it might be able to use a JDBC via ODBC driver, but the servlet sees only ODBC.
Similarly Connection Pooling just pools JDBC connections. The connections are just made via JDBC.
Since the expected answer is 4 they might be asking for the 4 types of JDBC drivers

Cannot load drivers for SQL Server on WSO2 Data Services Server

I am attempting to create a new Data Service in WSO2 Data Services Server to connect with SQL Server 2005. However, every time I test the connection I receive the error message "Driver class com.microsoft.jdbc.sqlserver.SQLServerDriver can not be loaded".
Data Source Type: RDBMS, Non-XA-DataSource
Database Engine: Microsoft SQL Server
Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
...
I don't believe my connection string or credentials are a problem as it fails on loading the driver.
What is the step that I'm missing in this process?
You have to put the Microsoft SQL driver jar inside repository/components/lib of DSS distribution in order to load the driver class.
The folder structure has changed for Enterprise Integrator v6 you will need to drop off the file into your [EI_HOME]/lib folder. Default folder is "C:\Program Files\WSO2\Enterprise Integrator\6.6.0\lib".
Depending on what version of Java you are using, you may download the corresponding version from here.
Extract the file and you drop the jar:
mssql-jdbc-7.2.2.jre8.jar - for java 1.8 class version 52
Check out this link for class versions.

Resources