你看看我的这个代码是可以编译的
import java.sql.*; import java.util.*; public class sqltest { public static void main(String[] args) throws ClassNotFoundException, SQLException{ Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); String url="jdbc:microsoft:Ssqlserver://localhost:1433;DataBaseName=liu"; String username="liu"; String password=" "; Connection conn = DriverManager.getConnection(url,username,password); Statement stt=conn.createStatement(); ResultSet rs=stt.executeQuery("select* from uptable"); String username1=rs.getString(username); String password1=rs.getString(password); Scanner rd=new Scanner(System.in); System.out.println("请输入登陆账号:"); String username2=rd.next(); System.out.println("请输入登录密码:"); String password2=rd.next(); if(username2.equals(username1)&&password2.equals(password1)){ System.out.println("登陆成功"); } else System.out.println("你输入的账号或者密码不正确!"); } }