package jsp; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.naming.Context; import javax.naming.NamingException; import javax.sql.DataSource; public class csvp { private String username; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String x; public csvp(){ } public String receive(){ try {Context initCtx = new javax.naming.InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds; ds = (DataSource)envCtx.lookup("jdbc/mysql"); try {Connection con = ds.getConnection(); Statement stmt; stmt = con.createStatement(); String sql="Select * from user" ; System.out.println(sql); ResultSet rs= stmt.executeQuery(sql); x=""; if (!rs.next()){x="������";}else{ rs.beforeFirst(); while (rs.next()){ //x+=rs.getString(2); x+= rs.getRow()+","; x+=rs.getString(2)+","; x+=rs.getString(3)+"\n"; } } rs.close(); stmt.close(); con.close(); } catch (SQLException e) { // TODO �Զ���ɵ� catch �� e.printStackTrace(); } } catch (NamingException e) { // TODO �Զ���ɵ� catch �� e.printStackTrace(); } ; System.out.println(x); return x.trim(); } }

qiuqiuqiu111 LV4
2022年11月29日
yymmyy LV1
2021年10月28日
ewofl888 LV1
2021年6月21日
2539788229 LV4
2021年1月4日
ahly88 LV1
2020年11月7日
jiayouyy LV8
2020年6月1日
柠檬味汽水 LV1
2020年4月13日
3478CH LV9
2019年11月21日
2308478564 LV15
2019年11月18日
1219610676 LV4
2019年9月28日