Free web hosting music - 518 Part IV . Development Cached connections Up
518 Part IV . Development Cached connections Up to this point, I ve been showing examples using the ResultSetobject. The ResultSet object remains connected to the data source for result retrieval. Because the connection must remain intact and active, the ResultSetobject is not useful for working with data over a networked connection. The JDBC API defines a RowSet interface that includes a CachedRowSetclass that can be used to retrieve results and place them into a cache for later use. Connecting to MySQL with the JDBC API and MySQL Driver Connecting to MySQL with JDBC for the first time can be a humbling experience. After lurking on Java mailing lists for a long time (as well as watching the Usenet newsgroups), I ve seen numerous questions by first-time developers who struggle with this initial JDBC connection. The following code demonstrates a typical connection to a MySQL server, made with Java. import java.sql.*; public class FirstConnection { public static void main(String args[]) { String url = jdbc:mysql://localhost/ecommerce ; Connection con; try { Class.forName( org.gjt.mm.mysql.Driver ); } catch(java.lang.ClassNotFoundException e) { System.err.print( ClassNotFoundException: ); System.err.println(e.getMessage()); } try { con = DriverManager.getConnection(url, suehring , evh5150 ); System.out.println( Connection established! ); con.close(); } catch(SQLException ex) { System.err.println( SQLException: + ex.getMessage()); } } }
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.