Documentos de Académico
Documentos de Profesional
Documentos de Cultura
- Kavyashree C M
Table Of Contents
Why Java 7? IO and New IO Package(JSR 203) Java programming language(JSR 334) JDBC
Why Java 7?
Provides comprehensive support for file I/O and accessing file system.
FileSystem fs = FileSystems.newFileSystem(uri, env); Path zipfile = Paths.get("/codeSamples/zipfs/zipfstest.zip"); FileSystem fs = FileSystems.newFileSystem(zipfile, env, null);
File I/O
Commonly used methods for small files.
readAllBytes(Path) or readAllLines(Path,Charset) write(Path,byte[],OpenOption) or write(Path,Iterable<? extends CharSequence>, Charset,OpenOption)
Improved Compiler Warnings and Errors when Using Non-Reifiable Formal Parameters with Varargs.
JDBC
The ability to use a try-with-resources statement to automatically close resources of type Connection, ResultSet, and Statement. RowSet 1.1: The introduction of the RowSetFactory interface and the RowSetProvider class, which enable you to create all types of rowsets supported by your JDBC driver.
Types of RowSet.
CachedRowSet
ResultSet rs = stmt.executeQuery("SELECT * FROM EMPLOYEES"); CachedRowSetImpl crs = new CachedRowSetImpl(); crs.populate(rs); while (crs.next()) { String name = crs.getString(1); }
FilteredRowSet
FilteredRowSet frs = new FilteredRowSetImpl(); frs.populate(rs); Range name = new Range("Alpha", "Bravo"); frs.setFilter(name); frs.next();
JdbcRowSet
JdbcRowSetImpl jrs = new JdbcRowSetImpl(); jrs.setCommand("SELECT * FROM TITLES"); jrs.setURL("jdbc:myDriver:myAttribute"); jrs.setUsername("cervantes"); jrs.setPassword("sancho"); jrs.execute();
WebRowSet
JoinRowSet
JoinRowSet jrs = new JoinRowSetImpl(); ResultSet rs1 = stmt.executeQuery("SELECT * FROM EMPLOYEES"); CachedRowSet empl = new CachedRowSetImpl(); empl.populate(rs1); empl.setMatchColumn(1); jrs.addRowSet(empl); ResultSet rs2 = stmt.executeQuery("SELECT * FROM OFFICE_BONUS_PLAN"); CachedRowSet bonus = new CachedRowSetImpl(); bonus.populate(rs2); bonus.setMatchColumn(1); jrs.addRowSet(bonus);
Not allowed
Not Allowed Not Allowed Not Allowed Not Allowed
Allowed
Allowed Allowed Allowed Allowed
JDBC version
4.0
4.1
References
http://www.oracle.com http://www.javagava.com
Questions?
Thank You