<%@ page language = "java"%><%@ page import = "java.util.*"%><%@ page import = "java.sql.*"%><%@ page import = "java.io.*"%><%@ page import = "java.net.*"%><?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
  <title>Bandz RSS Feed</title>
  <link>http://scorn.ath.cx:8080</link>
  <description>Bandz RSS Feed</description>
<%

		Connection conn = null;
  String bandname="";
           try
           {   response.setContentType("text/xml");
               String userName = "root";
               String password = "";
               String url = "jdbc:mysql://localhost/band";
               Class.forName ("com.mysql.jdbc.Driver").newInstance();
               conn = DriverManager.getConnection (url, userName, password);
               System.out.println ("Database connection established");
           
              

           
      Statement s = conn.createStatement ();
			String query= ("Select * from news ORDER by DATE, TIME DESC LIMIT 5");
			System.out.println(query);			
			s.executeQuery (query);
			ResultSet rs = s.getResultSet ();
              
      
      int idVal;
      String name="";
      String news="";
      
      java.sql.Time time = null;
      java.sql.Date date = null;

                           
		while (rs.next ())
		{
			idVal = rs.getInt ("id");
			name/*:)*/ = rs.getString ("name");
			news = rs.getString ("news");
			time = rs.getTime("time");
			date= rs.getDate("date");
/*
			out.println("<H3><u><b>"+name+":</b></u></H3>"+date+" "+time+"<br>"+news);
			out.println("<br><br>");
*/		
      out.println("<item>");
      out.println("<title>"+name+"</title>");
      out.println("<link>http://scorn.ath.cx:8080</link>");
      out.println("<description>"+news+"</description>");
      out.println("</item>");
			
			
		}
		rs.close ();
		s.close ();

           
	}
           
                      catch (Exception e)
           {
               System.err.println ("database error");
               System.err.println (e);
           }
           
           finally
           {
               if (conn != null)
               {
                   try
                   {
                       conn.close ();
                       System.out.println ("Database connection terminated");
                   }
                   catch (Exception e) { /* ignore close errors */ }
               }
           }
           

%>
</channel>
</rss>

