jdbc链接数据库伪代码:
public class TestJdbc
{
Connection conn=null;
Prestament ps=null;
ResultSet rs=null;
Class.Forname=(com.mysql.jdbc.driven)
conn=Drivemanger.getconnection(url,username,password)
Srring sql="Select * from employller"
ps=conn.paredstament(sql);
rs=ps.exeuquery(sql);
while(rs.next)
{
Syso("id:"+rs.getInt(1)+"name:"+rs.getString(2))
}
if(rs!=null)
{
rs.close
}
if(ps!=null)
{
ps.close
}
}