<%@ page import="java.sql.*" %><% String driver=request.getParameter("driver"); if(driver==null) driver="sun.jdbc.odbc.JdbcOdbcDriver"; String dburl=request.getParameter("dburl"); if(dburl==null) dburl="jdbc:odbc:ECOM"; // quand la source ODBC s'appelle ECOM String dbusername=request.getParameter("dbusername"); if(dbusername==null) dbusername="admin"; String dbpassword=request.getParameter("dbpassword"); if(dbpassword==null) dbpassword="nimda"; String sqlstatement=request.getParameter("sqlstatement"); if(sqlstatement==null) sqlstatement= "SELECT * from Article"; String encoding=request.getParameter("encoding"); if(encoding==null) encoding="iso-8859-1"; // "UTF-8", ... String title=request.getParameter("title"); %> <% if(title!=null) { %> <%=title%> <% } %> <% if(title!=null) { %>

<%=title%>

<% } %> <% Class.forName(driver); Connection cnx = DriverManager.getConnection(dburl,dbusername,dbpassword) ; PreparedStatement stmt = cnx.prepareStatement(sqlstatement); if (stmt.execute()) { ResultSet rs = stmt.getResultSet(); ResultSetMetaData rsmd = rs.getMetaData(); int numcols = rsmd.getColumnCount(); %><% for (int i = 1; i <= numcols; i++){ out.println("<% for(int i = 1; i <= numcols; i++) { Object obj = rs.getObject(i); if (obj != null){ out.println("
" + rsmd.getColumnLabel(i)); } while(rs.next()) { %>
"+obj.toString()); } else { out.println(""); } } } %>
<% rs.close(); } else { out.println("No Row
"); } cnx.close(); %>