%@ page import = "java.sql.*" %>
Just enter your lab username in the box below (e.g., "jsmith"), then press the "Get Print Credit" button. You will then be shown the number of pages of printing you have left.
<% String user = request.getParameter("userName"); if (user == null) { %>
<% } else { int UserId=0; String strUser = ""; String pages=""; try { String UserStatement = "SELECT user_id FROM people WHERE id ='" + user + "'"; String PrintStatement = "SELECT convert(int, (user_purse + tuition_purse + technology_purse) * 33) AS pages FROM people_balances WHERE user_id ="; Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://athens:1433;DatabaseName=pharos", "sa", "einstein"); Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stmt.executeQuery(UserStatement); rs.first(); UserId= rs.getInt("user_id"); rs.close(); ResultSet rs2 = stmt.executeQuery(PrintStatement + UserId); rs2.first(); pages=rs2.getString("pages"); out.println("You have " + pages + " pages left.
"); rs2.close(); } catch (Exception e) { %>
<% } } %>
The same information can also be found on the Law Computing Support home page.