java.sql.SQLException: No suitable driver for jdbc: sqlserver found when connecting to the Azure database

I am using an Azure database and have added all the necessary JAR files to my library. Here is my code, I'm not sure why it can not connect. Please advise.

 String connectionUrl =
                "jdbc:sqlserver://bcs430-final-project.database.windows.net:1433;"
                        + "database=OASIS ASSISTANT;"
                        + "user=farmingdale@bcs430-final-project;"
                        + "password=bcs430w!;"
                        + "encrypt=true;"
                        + "trustServerCertificate=false;"
                        + "loginTimeout=30;";




     String insertSql = "select * from dbo.BCS102 where crse = bcs102 ";

        ResultSet resultSet = null;

        try (Connection connection = DriverManager.getConnection(connectionUrl);
                PreparedStatement prepsInsertProduct = connection.prepareStatement(insertSql, Statement.RETURN_GENERATED_KEYS);) {

            prepsInsertProduct.execute();
            // Retrieve the generated key from the insert.
            resultSet = prepsInsertProduct.getGeneratedKeys();

            // Print the ID of the inserted row.
            while (resultSet.next()) {
                System.out.println("Generated: " + resultSet.getString(1));
            }
        }
        // Handle any errors that may have occurred.
        catch (Exception e) {
            e.printStackTrace();
        }

here is the mistake

java.sql.SQLException: No suitable driver found for jdbc:sqlserver://bcs430-final-project.database.windows.net:1433;database=OASIS ASSISTANT;user=farmingdale@bcs430-final-project;password=bcs430w!;encrypt=true;trustServerCertificate=false;loginTimeout=30;
    at java.sql.DriverManager.getConnection(DriverManager.java:689)
    at java.sql.DriverManager.getConnection(DriverManager.java:270)
    at SeniorProject.main(SeniorProject.java:35)

drivers – Problems connecting to the sqlserver instance

When I try to connect to sqlcmd like this:

sqlcmd -S 127.0.0.1:1433 -U SA -P happen

I get ..

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server: logon timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server: TCP Provider: Error Code 0x2AF9.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server: A network-related or instance-specific error occurred while connecting to SQL Server. The server was not found or is unreachable. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. For more information, see the SQL Server Books Online.

I'm afraid my driver is not installed properly. I've read Google information about this issue, but nothing works

nc -z -v -w5 127.0.0.1 1433
Connection to the 127.0.0.1 1433 port (tcp / ms-sql-s) successful!

..and
tsql -S 127.0.0.1 -U SA
Password:
Locale is "es_ES.UTF-8"
Locale set is "UTF-8"
Using the default character set "UTF-8"
1>
.. also works.

systemctl status mssql-server –no-pager

$ systemctl status mssql-server –no-pager
● mssql-server.service – Microsoft SQL Server Database Engine
Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preference: enabled)
Active: active (running) since Thu 2019-08-08 18:19:10 CEST; 3h 21min
Documents: https://docs.microsoft.com/en-us/sql/linux
Main PID: 25809 (sqlservr)
Tasks: 154
CGroup: /system.slice/mssql-server.service
25809 / opt / mssql / bin / sqlservr
25856 / opt / mssql / bin / sqlservr

8:18:59 AM dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (71B blob data)
before 08 18:19:59 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (162B blob data)
before 08 18:19:59 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (124B blob data)
ago 08 19:03:34 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (96B blob data)
ago 08 19:03:34 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (74B blob-data)
ago 08 19:03:34 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (68B blob-data)
before 08 19:03:35 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (136B blob data)
before 08 19:03:35 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (111B blob data)
ago 08 19:03:35 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (137B blob-data)
before 08 19:03:35 dpinalopez68-SATELLITE-C50D-A-12R sqlservr (25809): (112B blob data)

…. and finally

sudo lsof -i -P -n | grep LISTEN
(sudo) contraseña para dpinalopez68:
systemd-r 909 systemd-resolve 13u IPv4 22378 0t0 TCP 127.0.0.53:53 (LISTEN)
Plex x20M 1908 root 60u IPv6 31648 0t0 TCP *: 32400 (LISTEN)
Plex x20M 1908 root 61u IPv4 31650 0t0 TCP 127.0.0.1:32401 (LISTEN)
smbd 2022 root 32u IPv6 32325 0t0 TCP *: 445 (LISTEN)
smbd 2022 root 33u IPv6 32326 0t0 TCP *: 139 (LISTEN)
smbd 2022 root 34u IPv4 32327 0t0 TCP *: 445 (LISTEN)
smbd 2022 root 35u IPv4 32328 0t0 TCP *: 139 (LISTEN)
Plex x20S 2191 root 7u IPv4 34705 0t0 TCP 127.0.0.1:38271 (LISTEN)
Plex x20D 3555 root 15u IPv4 38184 0t0 TCP *: 1573 (LISTEN)
Plex x20D 3555 Root 33u IPv4 37458 0t0 TCP *: 32469 (LISTEN)
Plex x20T 3574 root 13u IPv4 37432 0t0 TCP 127.0.0.1:32600 (LISTEN)
cupsd 4881 root 6u IPv6 47176 0t0 TCP (:: 1): 631 (LISTEN)
cupsd 4881 root 7u IPv4 47177 0t0 TCP 127.0.0.1:631 (LISTEN)
Code 14120 dpinalopez68 78u IPv4 441836 0t0 TCP 127.0.0.1:56103 (LISTEN)
sqlservr 25856 mssql 171u IPv6 249437 0t0 TCP *: 1433 (LISTEN)
sqlservr 25856 mssql 172u IPv4 249438 0t0 TCP *: 1433 (LISTEN)
sqlservr 25856 mssql 176u IPv6 249441 0t0 TCP (:: 1): 1434 (LISTEN)
sqlservr 25856 mssql 179u IPv4 249442 0t0 TCP 127.0.0.1:1434 (LISTEN)

Every help is appreciated.
thank you in advance

David

SQL Server – Google Sheets with no option to connect to my SqlServer database

In Microsoft Excel, on the Data tab, we have the ability to connect to external databases. I'm trying to connect to Google Sheets through the Data tab, and there are no connectivity options.

There were no options to connect to Google Sheets, and you have no options to connect.

I would like to connect Google Sheet to existing SqlServer hosting.

I want to make Pivot Table through this connection and be able to view it within a site.

SQL Server – What is the "best" way to handle and store the base64 return of an API with SqlServer + C #?

I use an ASP.NET core API and get the return of a file in Base64. I would like to know how to handle it best. Should I convert them to bytes and save them in a varbinary field on the SQL server or create a text box and save the base64 field directly. If you have another option, can you explain it to me better?

asp.net mvc timestamp in C # for persistence in SqlServer

Is there a typing that already does this in C # to persist in the SQL Server database?

I need to resolve the CreatedAt and UpdatedAt properties. Be saved for any change in the bank.

public class UserBaseEntity
{
    [Key]
    [ScaffoldColumn(false)]
    
    
    
    public int Id {get; Set; }

    [Timestamp]
    public DateTime CreatedAt {get; Set; }

public DateTime UpdatedAt {get; Set; }
}

Would the signature on the property solve this case?

SQL Server 2016 – SQLServer Row-level security – Force the enforcement out of the database

I have a multi-tenant app running on a single SQL dbb 2016. I have an RLS predicate (row-level security) on customer_id (which is unique for each tenant) and the column exists in all tables.

CREATE FUNCTION dbo.[RLSPredicate] (@CustomerId bigint)
RETURNS TABLE
With planning
AS
RETURN SELECT 1 AS RLSPredicateResult WHERE (@CustomerId =
CAST (SESSION_CONTEXT (N & # 39; customer_id & # 39; AS bigint))

GO

- two tables example
CREATE SECURITY POLICY [dbo],[RLSPolicy] 
 ADD FILTER PREDICATE [dbo],[RLSPredicate] ([customer_id]) ON [dbo],[user],
ADD FILTER PREDICATE [dbo],[RLSPredicate] ([customer_id]) ON [dbo], 
  [user_email]
  WITH (STATE = ON, SCHEMABINDING = ON)
GO

- Sample request
EXEC sp_set_session_context @ key = N # customer_id #, @ value = & # 39; 1231312 & # 39;
Select Top 1000 * [user] Where customer_id = 1231312

With the above design, EXEC sp_set_session_context must always be executed before a user query retrieves the database. However, there were cases when the application team forgot to add the code EXEC sp_set_session_context in new projects
The problem is that there is no way to guarantee that queries coming to the database will always contain EXEC sp_set_session_context. The queries are available in all forms, EXEC, sp_executesql, ad hoc queries, etc.

Would you like to know if there is a way to redesign the filter predicate, forcing RLS out of the database and removing the EXEC sp_set_session_context dependency before each query.

In addition, there are more than 500 KB of customer_id values.

Many Thanks!