Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'doszke'. ClientConnectionId:b7005fe3-904d-40c5-a89e-af0cb61250d6
- at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:254)
- at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:258)
- at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:104)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4772)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3581)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:81)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3541)
- at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7240)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2869)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2395)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2042)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1889)
- at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1120)
- at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:700)
- at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
- at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
- at main.Main.main(Main.java:38)
- package main;
- import java.sql.*;
- public class Main {
- private static ResultSet selectStan(Connection connection) throws SQLException {
- String sql_stmt = "SELECT * FROM STAN;";
- Statement statement = connection.createStatement();
- ResultSet result = statement.executeQuery(sql_stmt);
- System.out.println("Select executed");
- return result;
- }
- public static void main(String[] args) {
- try {
- Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- String userName = "doszke";
- String password = "doszke123";
- String url = "jdbc:sqlserver://localhost:1433;databaseName=TestBazyDanych;user=doszke;password=doszke123";
- try (Connection con = DriverManager.getConnection(url)) {
- if(con != null){
- System.out.println("connected");
- } else {
- System.out.println("unable to connect");
- }
- }
- catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment