<%! private synchronized static Connection getDBConnection(JspWriter out) { javax.sql.DataSource ds=null; Connection connRSFind=null; try { javax.naming.Context ctx = new javax.naming.InitialContext(); if (ctx == null ) throw new Exception("Boom - No Context"); ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/crossNews"); try { connRSFind = ds.getConnection(); } catch (java.sql.SQLException e) { System.out.println("getting new data source connection failed! Error: "+e+"\n"); } } catch (Exception e) { System.out.println("Could Not get data source, error: "+e+"\n"); } return connRSFind; } // Display an SQLException which has occured in this application. private static void showSQLException (JspWriter out, java.sql.SQLException e) { java.sql.SQLException next = e; while (next != null) { try { out.println (next.getMessage ()); out.println ("Error Code: " + next.getErrorCode ()); out.println ("SQL State: " + next.getSQLState ()); } catch (Exception e1) { e1.printStackTrace(); } next = next.getNextException (); } } %>