JDBC
用java语句编写数据库
public class JDBCTest{
public static void main(String[] args){
Class.forName("com.mysql.jdbc.Driver");
Connection conn=null;
PreparedStatement ps=null;
ResultSet rs=null;
String driver=jdbc:mysql:localhost:8080/Driver;
String name="root";
String password="root";
try{
conn=DriverManager.getConnection(driver);
sql="select ename from emp where ename like ?";
ps=conn.getPrerareStatement(sql);
ps.setString(1,name);
rs=ps.exetuQuery();
while(rs.next){
rs.getString("sun");
System.out.println(rs);
}
}
}
}
总结很重要哦 方法得当,坚持会有奇迹哦