@Daria_D15

Как отправить SQL запрос на Java, запрос SELECT, получение данных для автотеста?

Ошибка
Execution failed for task ':compileTestJava'.
> Could not resolve all files for configuration ':testCompileClasspath'.
   > Could not find mysql:mysql-connector-java:8.3.0.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/8.3.0/mysql-connector-java-8.3.0.pom


Ошибка после понижения версии mysql connector
No matching tests found in any candidate test task.
    Requested tests:
        Test pattern tests.DataSourseTest in task :test

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 5s
4 actionable tasks: 1 executed, 3 up-to-date


package tests;
import org.junit.Test;

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

import javax.xml.parsers.ParserConfigurationException;
import java.sql.*;
import java.io.IOException;



import static java.sql.DriverManager.getConnection;

public class DataSourse {

    @Test

    public void mysqlDataSource() throws ParserConfigurationException, IOException, ClassNotFoundException, SQLException {


        try {
            String url = "jbdc:mysql://10.63.2.143:4306/";
            String username = "***";
            String password = "***";
            Connection conn = DriverManager.getConnection(url, username, password);
            Class.forName("com.mysql.jdbc.Driver");
            System.out.println("yra");


            try {
                Statement statement = conn.createStatement();
                PreparedStatement stmt;
                ResultSet rs = statement.executeQuery("select to_account_id * from task * where task_type_id = 1 * order by date_create * LIMIT = 1");
                System.out.println("to_account_id");


            } finally {
                conn.close();
            }

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}

plugins {
    id 'java'
    id "io.qameta.allure" version "2.11.2"
}

group = 'org.example'
version = '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    testImplementation 'io.cucumber:cucumber-java:7.1.0'
    testImplementation 'com.codeborne:selenide:7.2.0'
    testImplementation 'io.cucumber:cucumber-junit:7.1.0'
    testImplementation 'io.qameta.allure:allure-selenide:2.25.0'
    testImplementation 'io.qameta.allure:allure-junit5:2.25.0'
    testImplementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.33'

}

test {
    useJUnitPlatform()
}
  • Вопрос задан
  • 83 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы