I'm new to connecting Java to SQL Server but hopefully I manage to connect them successfully through helps of various tutorials. But there are these methods and syntax that I couldn't explain for myself.
1.
Connection conn=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=login_DB;integratedSecurity=true");
Regarding the code above, what does integratedSecurity=true
do?
2.
String user = rss.getString(1);
String pass = rss.getString(2);
Does the parameter inside getString(1)
and getString(2)
pertains to the column in the Database? And also, how does the ResultSet
affects the getString()
?
3.
while(rss.next()){
String user = rss.getString(1);
String pass = rss.getString(2);
if(usernameTF.getText().trim().equals(user)&&passwordTF.getText().trim().equals( pass)){
count = 1;
}//if success
}//while
Lastly, at least for now, does the while(rss.next())
method simply means that while there is a row in my table?
I know my code is a bad practice. But I am really trying my best to make it better.