Sql异常com.microsoft.sqlserver.jdbc.sqlserverexception:用户''登录失败。 Clientconnectionid:073b35b2-0e56-460d-8353-9de2b2d0ecff [英] Sql exception com.microsoft.sqlserver.jdbc.sqlserverexception: login failed for user ''. Clientconnectionid:073b35b2-0e56-460d-8353-9de2b2d0ecff
本文介绍了Sql异常com.microsoft.sqlserver.jdbc.sqlserverexception:用户''登录失败。 Clientconnectionid:073b35b2-0e56-460d-8353-9de2b2d0ecff的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
import java.sql.*;
public class Conection
{
public static void main(String a[]) throws ClassNotFoundException, SQLException
{
try
{
String url = "jdbc:sqlserver://localhost\\MALIKUSMANNAWAZ:1433;databaseName=ali";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection(url);
System.out.println("connection created");
Statement st=conn.createStatement();
String sql="select * from Login_System";
ResultSet rs=st.executeQuery(sql);
while(rs.next())
{
System.out.println("Name: "+rs.getString(1));
//System.out.println("Address : "+rs.getString(2));
}
if(st!=null)
st.close();
if(conn!=null)
conn.close();
}
catch(SQLException sqle)
{
System.out.println("Sql exception "+sqle);
}
}
}
我尝试了什么:
仅使用Windows身份验证...
What I have tried:
Using Windows Authentication Only...
推荐答案
已解决:
Solved:
Connection conn = DriverManager.getConnection("jdbc:sqlserver://localhost\\MALIKUSMANNAWAZ:1433;databaseName=ali","sa","dbase");
System.out.println("connection created");
Statement st=conn.createStatement();
String sql="select * from Login_System";
这篇关于Sql异常com.microsoft.sqlserver.jdbc.sqlserverexception:用户''登录失败。 Clientconnectionid:073b35b2-0e56-460d-8353-9de2b2d0ecff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文