<%@ page language=" java" import="java.util.*,java.sql.*" pageEncoding="UTF-8"%> <% String driverClass="com.mysql.jdbc.Driver"; String url="jdbc:mysql://localhost:3306/news"; String username="root"; String password=""; Class.forName(driverClass); Connection conn=DriverManager.getConnection(url,username,password); Statement stat=conn.createStatement(); ResultSet rs=stat.executeQuery("select * from newdb"); %> <% while(rs.next()){ } %> <% rs.close(); stat.close(); conn.close(); %> |