Having trouble establishing a connection with the database using selenium

Attempting to establish a connection with the database for testing purposes led to an error:

java.sql.SQLException: Client does not support authentication protocol requested by server; consider upgrading MySQL client at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)

Is there a more effective method for upgrading the Mysql client?

Below is the code being used:

 package DatabaseTesting;

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;

    import org.testng.annotations.Test;

    public class TestDB 
    {
         @Test
        public void ConnectToSql() throws ClassNotFoundException, SQLException
        {
            String dburl = "jdbc:mysql://localhost:3306/selenium";
            String user = "root";
            String pass = "Admin@123";

             Class.forName("com.mysql.jdbc.Driver");

             System.out.println("Driver Loaded");

             DriverManager.getConnection(dburl,user,pass);

             System.out.println("Connected to Database");


        }

    }

I have searched extensively for a solution but have been unable to find one. Any assistance in resolving this issue would be greatly appreciated.

Answer №1

Make sure to upgrade your mysql-connector-java jar file to the newest version, which is 8.0.13. For more information, visit the following link:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Error encountered while attempting to locate a WebElement in Webdriver Selenium using Java: java.lang.NullPointerException

My attempt to fetch data from an excel sheet and login to Gmail was partially successful. The browser opened, the desired page loaded, and the login ID was successfully retrieved from the excel sheet and stored in a variable called sUsername. However, I en ...

Sending a returned value to another function

I'm facing an issue with a method I have implemented, where I return a variable that needs to be compared but I'm struggling to retrieve it... This is the code snippet: public char setCurrency(String currencyToSet) { WebElement currencyVal ...

Running TestNG.xml > executing only the first TestNG test

Issue with TestNG.xml: Only First @Test Executing I encountered a problem where only the first @Test is executed when running the same testng.xml file on a new device (PC) even though the setup and project are identical to the working one. The test run ...

I'm attempting to showcase information from my MySQL database in JSON format, but I'm consistently encountering the same error message

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myexample/com.example.myexample.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object refe ...

Looking for the answer to utilize selenium for product scraping

I'm currently focused on a personal project involving parsing product names and prices. To achieve this, you can navigate to shoppingSite. After arriving at the site, click the button below the map, then click it again on the right side. Opt for the u ...

Is it possible to reuse a WebDriverWait instance?

When working with a page object that interacts with various elements on the DOM, is it better to create a single instance of WebDriverWait on initialization and use it for all waits? Or should separate instances be created for each element being waited on? ...

Unable to perform file upload using SendKeys method in Selenium

I'm struggling with an issue related to uploading files in Selenium using C# .NET with FirefoxDriver. Here's the code I have: IWebElement chooseFile = driver.FindElement(By.XPath("//button[@id='btnSelect']")); chooseFile.SendKeys(@"D:&b ...

Communication between the Node development server and the Spring Boot application was hindered by a Cross-Origin Request

Here is the breakdown of my current setup: Backend: Utilizing Spring Boot (Java) with an endpoint at :8088 Frontend: Running Vue on a Node development server exposed at :8080 On the frontend, I have reconfigured axios in a file named http-common.js to s ...

Exploring JavaScript through the Lens of Object-Oriented Concepts from Java

Having spent a significant amount of time using Java, I delved into web development with GWT (Google Web Toolkit) where the convenience of having my Java object-oriented constructs translated to GWT seamlessly by Google was a major draw. While my knowledge ...

struggling with setting up a Python script to automate logging into several email accounts

Here is my code where I am attempting to create a function that includes a list to log into each email account one at a time. The issue I am facing is that it is trying to loop through the entire list instead of logging into one email at a time. How can I ...

Element not found: {"method":"xpath","selector":"//*[@id='identify_email']"}

Hey guys, I have encountered an error that says: Unable to locate element: {"method":"xpath","selector":"//*[@id='identify_email']"} Although I am confident that the selector I used is correct as I checked it in the console. Does anyone have a ...

Deactivate the SELENIUM_PROMISE_MANAGER in a specific Protractor suite

Because Selenium's control flow will be disabled in the future, I am transitioning to writing new specs using async/await. In order to do this, I need to use the SELENIUM_PROMISE_MANAGER: false config option, which unfortunately causes my old specs t ...

Decipher serialized json data in the Java programming language

Having trouble with JSON once again :( Here's the original response: {"xml-fragment":{"workItem":{"@id":"251","@version":"74"},"presentation":{"@formIdenitifier":"1.0.0.201310151421/openspaceGWTPull_DefaultChannel/.default/Npda/NpdaProcess/UserRecon ...

Extracting data from the web using BeautifulSoup and stable URLs

Currently, I am attempting to extract information from this website. r = requests.get(url) soup = BeautifulSoup(r.text , 'lxml') details = soup.find_all('span', {'class' : 'src'}) details = soup.find_ ...

Jasmine is having trouble scrolling the window using executeScript

I usually use the following command: browser.driver.executeScript('window.scrollTo(0,1600);'); However, this command is no longer working. No errors are showing in the console, making it difficult to troubleshoot. Interestingly, the same scri ...

The Selenium Webdriver TestNG tests are "clashing" with each other

I have been attempting to execute Selenium Webdriver tests concurrently on a single machine utilizing TestNG. The scenario involves 3 @Test methods, where each method logs in with a different user to the same application and navigates to the home page. My ...

Tips for using Selenium to interact with the save or print button in the Google Chrome print window, even when the HTML page contains a shadow-root

https://i.stack.imgur.com/NFJat.pngMy goal is to use Selenium and Python for web scraping. I am currently using Chrome version 123.0.6312.87 with a compatible web driver. Specifically, I am interested in extracting data from the following page: "https://we ...

Error: Unable to locate the module 'selenium' when using subprocess

Experiencing an issue when attempting to launch a program with a subprocess. The program runs smoothly when executed directly, without going through another file. Python 3.10 is being used on Windows 10. I have verified that the selenium module is up to d ...

Can the creation of an Allure report be done within Python's unittest framework?

Is there a way to generate an allure report in python-unittest, similar to how it's done in Pytest? ...

Traverse all elements in xpath by utilizing @Findby in Java

I've recently started using Page Factory and I'm facing a challenge when it comes to providing Xpath in @FindBy. I'm looking for suggestions or references on how to pass variables in Xpath using @FindBy. The element that needs to be replace ...