You are looking for a articles about J2EE, JavaPro magazine put online a nice tool to search and view all the published articles:
Groovy, Java's New Scripting Language
Groovy, Java's New Scripting Language by Ian F. Darwin -- When some Java developers hear about Groovy, their first reaction is often, "Oh, no, not another scripting language for Java." Ian Darwin had the same reaction, until he took a good look at Groovy.
Good taste tool: del.icio.us
I am starting to use del.icio.us. A great way to manage your own bookmarks but also to share them with others...
It is fun to see how many people are sharing the same bookmarks as you, and help you to find information related to the different categories...
Also the integration with Firefox using the delicious plugin make the usage of the bookmark manager very easy. You can also use the Apple Mac OS X client for del.icio.us.
Sample Code: BLOB insertion in Oracle10g
Responding to a customer question about Blob insertion in Oracle 10g DB using the JDBC 3.0 driver. Very Simple application. Download Java Source See insertBlob method.
package demo;
import java.sql.*;import java.io.*;import java.sql.PreparedStatement;import java.util.*;
import oracle.jdbc.driver.*;import oracle.sql.BLOB;
/*** Insert record in the MEDIA table* MEDIA (file_name varchar2(256), file_content BLOB);*/public class BlobOracle{ private final static String hostname = "localhost"; private final static String port = "1521"; private final static String sid = "ORCL"; private final static String username = "scott"; private final static String password = "tiger"; private static String fileLocation; private static Connection connection;
public BlobOracle() { }
/** * * @param args */ public static void main(String[] args) { try { if (args.length == 0) { System.out.println("\n\n Usage demo.BlobOracle "); System.exit(0); }
fileLocation = args[0];
setConnection(); insertBLOB();
} catch (Exception ex) { ex.printStackTrace(); } finally { } }
private static void setConnection() throws SQLException { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); connection = DriverManager.getConnection("jdbc:oracle:thin:@"+hostname+ ":"+ port +":"+ sid , username , password); connection.setAutoCommit(false); // we must control the commit }
private static void insertBLOB() throws SQLException, Exception { BLOB blob; File file ; FileInputStream is; OutputStream os;
long ts1 = System.currentTimeMillis();
//Create a statement. PreparedStatement pstmt = connection.prepareStatement("insert into media (file_name, file_content) values (?,empty_blob())"); file = new File(fileLocation); String fileName = file.getName(); //Set the file name and execute the query pstmt.setString(1, fileName); pstmt.execute();
//Take back the record for update (we will insert the blob) //supposely the file name is the PK pstmt = connection.prepareStatement("select file_content from media where file_name = ? for update"); pstmt.setString(1, fileName);
//Execute the query, and we must have one record so take it ResultSet rset = pstmt.executeQuery(); rset.next();
//Use the OracleDriver resultset, we take the blob locator blob = ((OracleResultSet)rset).getBLOB("file_content");
is = new FileInputStream(file); //Create a stream from the file // JDBC 2.0 //os = blob.getBinaryOutputStream(); //get the output stream from the Blob to insert it // JDBC 3.0 os = blob.setBinaryStream(0); //get the output stream from the Blob to insert it
//Read the file by chuncks and insert them in the Blob. The chunk size come from the blob byte[] chunk = new byte[blob.getChunkSize()]; int i=-1; System.out.println("Inserting the Blob"); while((i = is.read(chunk))!=-1) { os.write(chunk,0,i); //Write the chunk System.out.print('.'); // print progression }
// When done close the streams is.close(); os.close();
//Close the statement and commit pstmt.close(); long ts2 = System.currentTimeMillis();
connection.commit(); connection.close();
System.out.println("\n"+ (ts2 - ts1) +" ms" );
}
}
Struts or JSF by Craig McClanahan
Craig McClanahan has started a blog... and his second post -after a quick introduction- is about the 'hot' subject of the usage of Struts or JSF.
Quote:
For new development, here's the best strategy for determining what to do:
- Evaluate the two technologies individually, to see if they satisfy your requirements.
- If one or the other technology is sufficient, go ahead and use it (it's easier to learn and use one technology rather than two where possible); keeping in mind, however, the caveats about Struts HTML tags mentioned above.
- If your requirements include unique features supported only by Struts (such as Tiles or client side validation support), feel free to use the two frameworks together.
Persistence reconciliation for POJO....
Sun has sent a letter to the Java Community to start a single POJO persistence model, this will be done under the EJB 3.0 specification (JSR-220).
You can see comments from the community on TheServerSide Web site.
Oracle Application Server 10g Sets World Record SPECjAppServer 2002 Performance Result on Fujitsu PRIMEPOWER Servers
Oracle and Fujistu just announced new SpecJ2002 results, establishing a new record of 5,991.73 TOPS@MultipleNode (total operations per second) with a price-performance of 654.20 Euros/TOPS@MultipleNode. This was realized using Oracle Application Server 10g running on Fujitsu servers.
The results are available on the Spec Web site, the Press Release here.
O/R Mapping Benchmark: new Oracle Toplink results
The Middleware company has created an initiative to test the different Object-Relational mapping tools, this test is named Torpedo. You can find the announcement of this O-R benchmark initiative on TSS Web site.
Oracle Toplink just posted news results that you can read and comment here.
Portlet Development Book and Web Site
Portalbook.com is the site of Jeff Linwood and Dave Minter, authors of the book Building Portals with the Java Portlet API.
If you are interested in Portlet development, bookmark this site and buy the aPress book !
I did not have a chance to read the book yet, so feel free to give your feedback as comment.
Have we lost the Groove ?
Like lot of Java developers I was very excited about the announcement of the creation of the JSR-241... But where are we now ?
The JSR mailing list (http://news.gmane.org/gmane.comp.lang.groovy.jsr ) is very quiet... No meeting, not a lot of question/response. And like Patrick M. I have friends that have asked to be part of the Expert Group and never had any response.
I think that the Groovy Language is really a nice way of putting Java to the next level, easier to learn, to use and still powerful... I will not go in an enumeration of the benefits of Groovy here... but just asking what the Expert Group is doing ? What is the next step for the Groovy Language and the JCP ?