Tuesday October 13, 2009
Oracle Open World 2009 – Day 3 Report

Day 3 of Oracle Open World 2009 (Day 1, Day 2) started on an adventurous note for me. The San Francisco Bay Area got hit with the strongest October storm in 47 years and so the ride from home to Moscone Center took almost 30 extra minutes, because of flooded roads, strong winds, other accidents, and hydroplaning multiple times. Anyway only missed first few minutes of Thomas Kurian's keynote. Kurian is no stranger to the Java crowd because he is a regular keynote speaker at JavaOne. However it was totally impressive to see customer endorsements (both quality and quantity) and how they are using Oracle to solve operational problems.
Some more observations from the floor:
I spent some time on the Java EE 6 booth talking about the technology and showcasing GlassFish features such as monitoring and Rails deployment.
Enjoy videos of marketing gimmicks by some vendors at the show floor:
The evening ended with the OOW Bloggers Meetup at LJ's Martini Club & Grill. It was good to meet fellow bloggers from Oracle and other companies. OTN folks arranged a game to promote social networking. Basically, everybody was given a tee-shirt to wear and whoever has the most signatures from other bloggers wins an HP notebook. A MacBook would've been a better incentive to compete for me ;-) Anyway there was beer and muchies to keep the bloggers happy. Thanks to Justin (aka "King of OTN") for picking the bill!Here are some pictures from earlier today:
|
|
|
|
|
|
|
|
|
|
|
|
If you are not able to attend in person, then you can follow OOW Blogs, Open World Live, @OpenWorld (twitter), Community tweets with #oow.
Looking forward to see Arnold Schwarzenegger discussing technology innovation with Larry Ellison tomorrow.
Technorati: conf oracle openworld oow glassfish javaee otn bloggers
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
| Hudson Webinar and Q&A – 10/14, 10am PT
Koshuke (aka "Mr Hudson") is giving a webinar and a live Q&A session on Hudson tomorrow.
Please register now!
Technorati: glassfish hudson webinar
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Monday October 12, 2009
Oracle Open World 2009 - Day 2 Report

Following from Day 1, the Day 2 started with Charles Phillips and Safra Catz keynote. The keynotes at Open World are significantly different from JavaOne or any other developer conference I've attended so far. Of course they are expected to be because Open World is not primarily a developer's conference. Oracle Develop (OD) certainly closely mimic any of the conferences I've typically attended. My "exhibitor" badge restricted me from attending any of the sessions at OD though :-(
Here are some interesting statistics about the conference:
5 content streams (Database, Applications, Industries, Management & Infrastructure, & Middleware)
314 demo kisosk
401 partners & customer exchibiting
1966 educational sessions (10% more than last year)
4500 Oracle developers/experts for you
81,266 hotel room nights
170,000 cups of coffee
182,000 online participation
Here are some interesting sightings from the Open World exhibitor pavilion:
On a personal front, everything that possibly could went wrong as part of the demo installation yesterday and rehearsal for my talks earlier today. NetBeans was not able to connect to the Oracle database (couple of machine restarts solved that), GlassFish Tools Bundle for Eclipse was timing out attempting to start GlassFish (removing workspace solved that problem), NetBeans's RESTful tooling not recognizing JPA entities, and also found a blocking bug (issue #10166) in deploying Rails app to latest GlassFish promoted build. These demos have worked seamlessly for me all the time time and fortunately worked well during the talk.
My talk at the Unconference on Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBeans/Eclipse went well. It was truly an unconference event with no projector or mic in the presentation room. But the small attendance allowed us to huddle around the table and luckily all the demos worked seamlessly. The slides are available at:
Several demos shown in the talk are available at:
The slides have pointers to several other demos as well. Also showed the simplicity of Java EE 6 development using Eclipse in Java Platform, Enterprise Edition: The Foundation and Future of Your Enterpise.
The day concluded with OTN Night in Howard St tent. Check out a brief video from the event:
Here are some pictures from earlier today:
|
|
|
|
|
|
|
|
|
|
|
If you are not able to attend in person, then you can follow OOW Blogs, Open World Live, @OpenWorld (twitter), Community tweets with #oow.
Back tomorrow on Day 3 with more pictures :-)
Technorati: conf oracle openworld oow glassfish javaee netbeans eclipse
Posted by Arun Gupta in General | Comments[1]
|
|
|
|
|
Sunday October 11, 2009
Oracle Open World 2009 - Day 1 Report

Sun Microsystems is the innovation sponsor of Oracle Open World 2009. And that's what was the theme of Scott McNealy's keynote on a "Sun"day. It's been a while that I've seen Scott on the keynote stage and it truly was an enjoyable experience. In his characteristic way, he gave top 10 reasons that "Engineers have gone wild" as:
10. Who needs thumb drive in the shape of sushi ?
9. "Noble prize" recently awards for gas mask bra - no more ridiculous than other noble prizes recently awarded
8. OS/2
7. Patent awarded for face mask with voice modification capability
6. I could do an entire top 10 of worlds strangest keyboards (strangest being iPhone, "Friends don't let friends type on iPhone")
5. Windows 7
4. Man uses SPARCstation for his ashses
3. New market in "family size' plots
2. Mainframe running Linux
1. Some one came up with this crazy idea for a 'Java Ring'
And then on a more serious note, and keeping with the keynote theme, top 10 innovations from Sun:
10. NFS/PC-NFS Technology (1983)
9. SPARC (1989)
8. Open Source Software (Berkeley Unix, "Red Hat of Berkeley Unix", #1 contributor to OSS community)
7. BSD + UNIX System 5 = Solaris
6. Java (Java card, EE/SE/ME, JavaFX)
5. E10K (64-way Solaris, no longer mainframe required)
4. ZFS/Open Storage/Flash (Exadata)
3. Project Blackbox, world's first modular datacenter
2. SunRay
1. Chip multithreading "CoolThreads"
And the biggest innovation from Sun:
Kicked Butt
Had Fun
Didn't CHeat
Loved our customers
Changed computing for ever
Scott explained why SPARC, Solaris, MySQL, Java are here to stay. "Kick Butt, Have Fun" is truly the spirit at Sun :-)
James Gosling, the father of Java, showed up on the stage to talk about Java's relevance for Oracle. Also showed "The Gospel of Java according to James" and the video is shown below:
John Fowler talked about several brand new Sun/Oracle world-record benchmarks. A key point from these benchmarks "Oracle and Sun were able to set the world record using 1/8th the hardware that IBM used for its largest benchmark". And we also announced F5100 Flash Array, the world's fastest solid-state flash array.
And here are some quotes from Larry Ellison's keynote appearance:
It totally reminded me of Scott McNealy's "dot-not" (as compared to .NET) and "c-flat" (for C#) quotes from JavaOne :-)
Check out related articles about Sun's presence at Open World:
Here are some pictures:
If you are not able to attend in person, then you can follow OOW Blogs, Open World Live, @OpenWorld (twitter), Community tweets with #oow.
On a personal note, this is my first Open World and am totally amazed by the size of attendees, and it's only a Sunday. The entire Howard St is shutdown and tents are installed to accommodate the conference. All 3 Moscone halls (North, South, and West) are used. A scale down replica of Larry's "Rising Sun" is also displayed on Howard Street. And for the first time in 10 years, I'm getting only an Exhibitor badge at Moscone :-)
Also installed GlassFish, NetBeans/Eclipse demos on the booth machine and ready to wow the audience with Java EE 6 in the exhibitor hall for the next 3 days! And of course, I'm talking at the Unconference tomorrow at 11am on Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBeans/Eclipse. Get ready to see lots and lots of demos!
Back tomorrow with more pictures :-)
Technorati: conf oracle openworld oow glassfish netbeans eclipse
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Thursday October 08, 2009
TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans
This Tip Of The Day explains how to expose an existing Oracle database table as a RESTful Web service endpoint using NetBeans tooling and deployed on GlassFish.
Lets get started!















Do you have the need to expose your Oracle database tables as RESTful entities ?
A complete archive of all the TOTDs is available here.
This and other similar applications will be demonstrated at the upcoming Oracle Open World.
Technorati: totd oracle database glassfish v3 netbeans javaee jax-rs jpa rest
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Wednesday October 07, 2009
TOTD #111: Rails Scaffold for a pre-existing table using Oracle and GlassFish
TOTD #110 explained how to create a brand new Rails application using Oracle database and run it using GlassFish v Gem. This Tip Of The Day explains how to create a scaffold for a sample schema that ships with Oracle database. Even though Rails Scaffold are good for, well, scaffolding but they do get you started easily. This blog will use the sample HR schema that comes along with Oracle database.
Lets get started!
development:
adapter: oracle_enhanced
host: localhost
database: orcl
username: hr
password: hr
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby script/reverse_scaffold departments department
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/departments
exists app/views/layouts/
exists test/functional/
exists test/unit/
create test/unit/helpers/
exists public/stylesheets/
create app/views/departments/index.html.erb
create app/views/departments/show.html.erb
create app/views/departments/new.html.erb
create app/views/departments/edit.html.erb
create app/views/layouts/departments.html.erb
create public/stylesheets/scaffold.css
create app/controllers/departments_controller.rb
create test/functional/departments_controller_test.rb
create app/helpers/departments_helper.rb
create test/unit/helpers/departments_helper_test.rb
route map.resources :departments
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/department.rb
create test/unit/department_test.rb
create test/fixtures/departments.yml
set_primary_key "department_id"
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby -S glassfish -l
Starting GlassFish server at: 129.145.133.197:3000 in development environment...
Writing log messages to: /Users/arungupta/samples/v3/rails/oracle/bookstore/log/development.log.
Press Ctrl+C to stop.
Oct 6, 2009 2:14:19 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3000
. . .
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby script/reverse_scaffold employees employee
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/employees
exists app/views/layouts/
exists test/functional/
exists test/unit/
exists test/unit/helpers/
exists public/stylesheets/
create app/views/employees/index.html.erb
create app/views/employees/show.html.erb
create app/views/employees/new.html.erb
create app/views/employees/edit.html.erb
create app/views/layouts/employees.html.erb
identical public/stylesheets/scaffold.css
create app/controllers/employees_controller.rb
create test/functional/employees_controller_test.rb
create app/helpers/employees_helper.rb
create test/unit/helpers/employees_helper_test.rb
route map.resources :employees
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/employee.rb
create test/unit/employee_test.rb
create test/fixtures/employees.yml
set_primary_key "employee_id"

So we created a simple Rails CRUD application accessing information from a pre-existing table in the Oracle database server.
Thanks to @mediachk for all the help!
A complete archive of all the TOTDs is available here. The complete list of Rails blog entries are available here.
This and other similar applications will be demonstrated at the upcoming Oracle Open World.
Technorati: totd oracle database glassfish v3 jruby rails oow
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Tuesday October 06, 2009
TOTD #110: JRuby on Rails application using Oracle on GlassFish
GlassFish v3 is the Reference Implementation for Java EE 6. Following the "extensibility" principle of Java EE 6, it also allows Ruby-on-Rails, Groovy and Grails and Python/Django applications to be seamlessly deployed as well, without any additional packaging. This blog has published multiple entries on deploying a Rails application on GlassFish as given below:
All the existing applications have used JavaDB, SQLite3, or MySQL as the database so far. In the process of getting ready for the upcoming Oracle Open World 2009, this Tip Of The Day will show how to use an Oracle database with a JRuby-on-Rails application deployed on GlassFish v3.
Lets get started!
>./bin/jruby -S gem install glassfish
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed rack-1.0.0
Successfully installed glassfish-0.9.5-universal-java
2 gems installed
Installing ri documentation for rack-1.0.0...
Installing ri documentation for glassfish-0.9.5-universal-java...
Installing RDoc documentation for rack-1.0.0...
Installing RDoc documentation for glassfish-0.9.5-universal-java...
Macintosh-187:~ oracle$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Oct 1 12:32:33 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Release 10.2.0.4.0 - Production
SQL> CREATE USER glassfish IDENTIFIED BY glassfish DEFAULT tablespace users TEMPORARY tablespace temp;
User created.
SQL> GRANT CONNECT TO glassfish IDENTIFIED BY glassfish;
Grant succeeded.
SQL> GRANT UNLIMITED TABLESPACE TO glassfish;
Grant succeeded.
SQL> GRANT CREATE TABLE TO glassfish;
Grant succeeded.
SQL> GRANT CREATE SEQUENCE TO glassfish;
Grant succeeded.
SQL> exit
Disconnected from Oracle Database 10g Release 10.2.0.4.0 - Production
The user name and password are chosen as "glassfish" for simplicity. This is not a recommended setting for production usage though.
rails (2.3.4)
activerecord-jdbc-adapter (0.9.2)
glassfish (0.9.5)
jruby -S gem install rails activercord-jdbc-adapter glassfish
jruby -S rails bookstore -d oracle
ActionView::TemplateError (book_url failed to generate from {:controller=>"books", :action=>"show", :id=>#<Book id: #<BigDecimal:3feef1eb,'10000.0',1(8)>, title: "Ultramarathon Man", author: "Dean Karnazes", created_at: "2009-10-06 00:03:14", updated_at: "2009-10-06 00:03:14">}, expected: {:controller=>"books", :action=>"show"}, diff: {:id=>#<Book id: #<BigDecimal:459bdb65,'10000.0',1(8)>, title: "Ultramarathon Man", author: "Dean Karnazes", created_at: "2009-10-06 00:03:14", updated_at: "2009-10-06 00:03:14">}) on line #13 of app/views/books/index.html.erb:
bookstore >~/tools/jruby/bin/jruby -S gem install activerecord-oracle_enhanced-adapter
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed activerecord-oracle_enhanced-adapter-1.2.2
1 gem installed
Installing ri documentation for activerecord-oracle_enhanced-adapter-1.2.2...
Installing RDoc documentation for activerecord-oracle_enhanced-adapter-1.2.2...
development:
adapter: oracle_enhanced
host: localhost
database: orcl
username: glassfish
password: glassfish
bookstore >~/tools/jruby/bin/jruby script/generate scaffold book title:string author:string
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/books
exists app/views/layouts/
exists test/functional/
exists test/unit/
create test/unit/helpers/
exists public/stylesheets/
create app/views/books/index.html.erb
create app/views/books/show.html.erb
create app/views/books/new.html.erb
create app/views/books/edit.html.erb
create app/views/layouts/books.html.erb
create public/stylesheets/scaffold.css
create app/controllers/books_controller.rb
create test/functional/books_controller_test.rb
create app/helpers/books_helper.rb
create test/unit/helpers/books_helper_test.rb
route map.resources :books
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/book.rb
create test/unit/book_test.rb
create test/fixtures/books.yml
create db/migrate
create db/migrate/20091005233152_create_books.rb
bookstore >~/tools/jruby/bin/jruby script/generate jdbc
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
exists config/initializers
create config/initializers/jdbc.rb
exists lib/tasks
create lib/tasks/jdbc.rake
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby -S rake db:migrate
(in /Users/arungupta/samples/v3/rails/oracle/bookstore)
== CreateBooks: migrating ====================================================
-- create_table(:books)
-> 0.0740s
-> 0 rows
== CreateBooks: migrated (0.0750s) ===========================================
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby -S glassfish -l
Starting GlassFish server at: 129.145.133.197:3000 in development environment...
Writing log messages to: /Users/arungupta/samples/v3/rails/oracle/bookstore/log/development.log.
Press Ctrl+C to stop.
Oct 6, 2009 9:45:51 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3000
. . .






So we created a brand new JRuby/Rails application and ran it using GlassFish and Oracle backend. A subsequent blog entry will show how to create a similar application using an existing database.
A complete archive of all the TOTDs is available here. The complete list of Rails blog entries are available here.
This and other similar applications will be demonstrated at the upcoming Oracle Open World.
Technorati: totd oracle database glassfish v3 jruby rails oow
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
| Pictures from Rock'n'Roll San Jose Half Marathon 2009
Here are some pictures (courtesy ASI Photo) from my recently concluded Rock-n-Roll San Jose Half Marathon:
|
|
|
|
|
|
|
|
![]() |
|
|
![]() |
![]() |
![]() |
|
|
|
Technorati: running marathon rnrsj rocknroll sanjose results
Posted by Arun Gupta in Running | Comments[0]
|
|
|
|
|
Sunday October 04, 2009
Rock-n-Roll Half Marathon 2009 Completed - 6:57 pace, personal best!

I ran Rock 'n' Roll San Jose 1/2 marathon this morning - oh what a joy!
The race was very well organized, ample parking space in the San Jose Downtown, very well marked course, 14 lively local rock bands playing through out the course, gun time at each mile marker, short queues at porta potties, nice big sized medal, and last but not the least cheerful crowd at each turn was very pumping.
And all that contributed to run my personal best so far, the results and time splits are:

These are my best timings for 5K, 10K, 10 mile and 1/2 marathon so far. Its exciting to shave off 34 secs from the pace from little over 2 months ago in San Francisco 1/2 Marathon. Read previous marathon results.
The winner was Meb Keflezighi who completed in 1:01:00 at 4:40 pace, congratulations! I'm happy with my results :)
I followed a 1:30 pacer for the first 10 miles but then constant coughing slowed me down little bit. But, I still enjoyed running the wide streets of downtown!
Check out couple of pictures after the finish line:
Some friends and family members ran along with me which made the marathon a special event as well. As you can see, kids also ran in their own spirit. Completing 400 miles of training from Jul-Sep 2009 was not possible without family's support, many thanks to them!
Enjoy a small video clip of the start line and at 4.5 mile:
Some improvement suggestions ...
Over all, I thoroughly loved and will most likely run it again next year, hopefully with a better timing :)
UPDATED: More detailed results (compared to other runners) are now available:
Fully searchable results and leader board is also available:

Read more detailed story listing the records made etc. here.
Technorati: running marathon rnrsj rocknroll sanjose results
Posted by Arun Gupta in Running | Comments[1]
|
|
|
|
| Silicon Valley Code Code Camp 2009 Trip Report
The Foothill college was sprawling with developers, architects, engineers, et al from all over the San Francisco Bay Area to attend the Silicon Valley Code Camp 2009. This was my third speaking engagement (2008, 2007) and the code camp has certainly matured over the last years. The attendance is steadily growing and the quality of sessions is become more mature as well.
I presented on Java EE 6, GlassFish, and Eclipse Tooling for GlassFish/Java EE 6 and the slides are available below:
and
Both the talks were demo intensive and showed Deploy-on-Save, Preserving session state across deployments, Java EE 6 wizards in NetBeans (1, 2, 3, 4, 5) and Eclipse (1, 2, 3), Metro JAX-WS Web services development in Eclipse, GlassFish v3 Monitoring, GlassFish v3 REST interface to management and monitoring and many others. All the demos are available as screencasts and/or blog entries and the complete set of links are listed in the presentations.
Here are some pictures from the event:
That's it folks, see ya next year!
Technorati: siliconvalleycodecamp svcc glassfish javaee eclipse
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Friday October 02, 2009
TOTD #109: How to convert a JSF managed bean to JSR 299 bean (Web Beans) ?
This entry is a follow up to TOTD #95 and shows how to use the recent integrations of JSR 299 in GlassFish v3 to convert a JSF managed bean to a JSR 299 bean (aka Web Beans). The TOTD #95 describes a simple Java EE 6 web application that uses Java Server Faces 2.0 components for displaying the results of a database query conducted by EJB 3.1 and JPA 2.0 classes.
The EJB class, which also acts as the JSF managed bean, looks like:
@javax.ejb.Stateless
@ManagedBean
public class StateList {
@PersistenceUnit
EntityManagerFactory emf;
public List getStates() {
return emf.createEntityManager().createNamedQuery(”States.findAll”).getResultList();
}
}
Three changes are required to convert this class into a JSR 299 compliant bean (Web Bean) as listed below:
@PersistenceUnit
EntityManagerFactory emf;
EntityManager emf = Persistence.createEntityManagerFactory("HelloEclipseLinkPU");

That's it, re-deploy your application and now you are using the Web Beans integration in GlassFish v3 instead of JSF managed bean. The output is available at "http://localhost:8080/HelloEclipseLink/forwardToJSF.jsp" as shown:
This is the exact same output as shown in TOTD #95.
Now, one-by-one, JPA, EJB, Transactions and other components will start working. Read Roger's blog for another example of Web Beans in GlassFish.
A complete archive of all the tips is available here.
Technorati: totd glassfish v3 mysql javaee6 javaserverfaces webbeans jsr299 netbeans
Posted by Arun Gupta in General | Comments[2]
|
|
|
|
|
Thursday October 01, 2009
TOTD #106 explained how to install Oracle database 10g R2 on Mac OS X. TOTD #107 explained how to connect this Oracle database using NetBeans. This Tip Of The Day will explain how to use the sample HR database (that comes with Oracle database server) to write a simple Java EE 6 application.
This application will use Java Server Faces 2.0 for displaying the results, Enterprise Java Beans 3.1 + Java Persistence API 2.0 for middle tier, and Oracle database server + GlassFish v3 as the backend. The latest promoted build (65 of this writing) will not work because of the issue #9885 so this blog will use build 63 instead.
Several improvements have been made over NetBeans 6.8 M1 build and this blog is using the nightly build of 9/27. The environment used in this blog is:
Lets get started!
./bin/asadmin start-domain --verbose &
./bin/asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --restype javax.sql.DataSource --property "User=hr:Password=hr:URL=jdbc\:oracle\:thin\:@localhost\:1521\:orcl" jdbc/hr
./bin/asadmin ping-connection-pool jdbc/hr
./bin/asadmin create-jdbc-resource --connectionpoolid jdbc/hr jdbc/hr









@javax.ejb.Stateless
@javax.faces.bean.ManagedBean
@PersistenceUnit
EntityManagerFactory emf;
public List getEmployees() {
return em.createNamedQuery("Employees.findAll").getResultList();
}
@Stateless
@ManagedBean
public class EmployeesBean {
@PersistenceContext
EntityManager em;
public List getEmployees() {
return em.createNamedQuery("Employees.findAll").getResultList();
}
}
<h1>First Java EE 6 app using Oracle database</>
<h:dataTable var="emp" value="#{employeesBean.employees}" border="1">
<h:column><h:outputText value="#{emp.lastName}"/>, <h:outputText value="#{emp.firstName}"/></h:column>
<h:column><h:outputText value="#{emp.email}"/></h:column>
<h:column><h:outputText value="#{emp.hireDate}"/></h:column>
</h:dataTable>

So we can easily create a Java EE 6 application using NetBeans, Oracle, and GlassFish.
A complete archive of all the TOTDs is available here.
This and other similar applications will be demonstrated at the upcoming Oracle Open World.
Technorati: totd oracle database glassfish v3 javaee javaserverfaces ejb jpa netbeans oow
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
| Running Summary Q3 2009 – 400 miles, 80% of running days
Here is the summary of my running logs from Q3 2009 (Jul - Sep):

Even though 3 days of less running than Q2, but the overall mileage was increased. Barely hit that 400 miles mark in Q3 and it did took some extra efforts to reach there ;-) But now tapering for the upcoming Rock-n-Roll 1/2 Marathon this weekend.

5 miles was the most favorite distance being run 17 times and 19.7 miles and 17.4 miles were run only once.
Would you like to generate similar charts for your running logs as well ?
This can be easily achieved using a Rails application or a Wicket application on GlassFish.
Technorati: rails wicket glassfish running rnrsj
Posted by Arun Gupta in Running | Comments[0]
|
|
|
|
|
Wednesday September 30, 2009
TOTD #107: Connect to Oracle database using NetBeans
TOTD #106 explained how to install Oracle database 10g R2 on Mac OS X. This Tip Of The Day will explain how to connect Oracle database with NetBeans to leverage all the goodness provided by NetBeans for Java EE application development, Rails, and others.




ALTER USER HR IDENTIFIED BY hr ACCOUNT UNLOCK;
as explained in TOTD #106. 






A complete archive of all the TOTDs is available here.
Subsequent blogs will show how to write a Java EE application to access the Oracle database.
Technorati: totd oracle database netbeans
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Monday September 28, 2009
TOTD #106: How to install Oracle Database 10g on Mac OS X (Intel) ?
This Tip Of The Day (TOTD) will explain how to install Oracle Database 10g on Mac OS X.
The official documentation is available here and is very well suited for folks with lots of time and patience. But all I wanted was to install Oracle database server up & running on my localhost so that I can start experimenting with it. All my previous entries have used either JavaDB or MySQL so far, but it's about time ;-)
I started preparing a brief tutorial after following the lengthy documentation but then found this excellent blog entry. And realized the content is looking exactly similar :-) Anyway, below are the instructions I followed and additionally also provide a snapshot of the installer windows.
For the brave of heart, complete installation guide is available in HTML and PDF. Read on for an abbreviated, and yet working version, of the instructions.
# dscl . -create /groups/oinstall
# dscl . -append /groups/oinstall gid 100
# dscl . -append /groups/oinstall passwd "*"
# dscl . -create /users/oracle
# dscl . -append /users/oracle uid uid_number
# dscl . -append /users/oracle gid oinstall_gid
# dscl . -append /users/oracle shell /bin/bash
# dscl . -append /users/oracle home /Users/oracle
# dscl . -append /users/oracle realname "Oracle software owner"
# mkdir /Users/oracle
# chown oracle:oinstall /Users/oracle
# passwd oracle
kern.sysv.semmsl=87381
kern.sysv.semmns=87381
kern.sysv.semmni=87381
kern.sysv.semmnu=87381
kern.sysv.semume=10
kernel.shmall=2097152
kernel.sys.shmmax=2147483648
kernel.sys.shmmni=4096
kern.maxfiles=65536
kern.maxfilesperproc=65536
net.inet.ip.portrange.first=1024
net.inet.ip.portrange.last=65000
kern.corefile=core
kern.maxproc=2068
kern.maxprocperuid=2068
and reboot the machine for these parameters to take effect.
export DISPLAY=:0.0
export ORACLE_BASE=$HOME
export ORACLE_SID=orcl
umask 022
ulimit -Hn 65536
ulimit -Sn 65536


~ > sudo /Users/oracle/oraInventory/orainstRoot.sh
Changing permissions of /Users/oracle/oraInventory to 770.
Changing groupname of /Users/oracle/oraInventory to oinstall.
The execution of the script is complete
~ > sudo /Users/oracle/product/10.2.0/db_1/root.sh
Running Oracle 10g root.sh script ...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /Users/oracle/oracle/product/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
export ORACLE_HOME=/Users/oracle/oracle/product/10.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export DYLD_LIBRARY_PATH=$ORACLE_HOME/lib
Not setting DYLD_LIBRARY_PATH gives the following error:
~ oracle$ lsnrctl start
dyld: Library not loaded: /b/227/network/lib/libnnz10.dylib
Referenced from: /Users/oracle/oracle/product/10.2.0/db_1/bin/lsnrctl
Reason: image not found
Trace/BPT trap
This was not obvious but Googling helped. Make sure to relogin for these changes to take effect. ~ oracle$ lsnrctl start
LSNRCTL for MacOS X Server: Version 10.2.0.4.0 - Production on 28-SEP-2009 14:48:49
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /Users/oracle/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for MacOS X Server: Version 10.2.0.4.0 - Production
System parameter file is /Users/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /Users/oracle/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dhcp-usca14-133-197.SFBay.Sun.COM)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
MacOS X Server Error: 49: Can't assign requested address
Listener failed to start. See the error message(s) above...
# listener.ora Network Configuration File: /Users/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
# tnsnames.ora Network Configuration File: /Users/oracle/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
The changes are highlighted in bold. And here as well change the value of HOST key to "localhost". ~ oracle$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.4.0 - Production on Mon Sep 28 17:44:40 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 612368384 bytes
Fixed Size 2085872 bytes
Variable Size 167775248 bytes
Database Buffers 436207616 bytes
Redo Buffers 6299648 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
SQL> ALTER USER HR IDENTIFIED BY hr ACCOUNT UNLOCK;
User altered.
SQL> exit
Disconnected from Oracle Database 10g Release 10.2.0.4.0 - Production
The last step of unlocking the account should not be required because we explicitly unlocked the account during installation but that apparently didn't work. And I hit ORA-01033, ORA-01034, ORA-12514, ORA-12541, ORA-12547, and ORA-27101 trying different combinations to get the app working.
~ oracle$ sqlplus hr/hr@orcl
SQL*Plus: Release 10.2.0.4.0 - Production on Mon Sep 28 17:46:19 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Release 10.2.0.4.0 - Production
SQL> select table_name from user_tables;
TABLE_NAME
------------------------------
REGIONS
LOCATIONS
DEPARTMENTS
JOBS
COUNTRIES
EMPLOYEES
JOB_HISTORY
7 rows selected.
SQL> desc regions;
Name Null? Type
----------------------------------------- -------- ----------------------------
REGION_ID NOT NULL NUMBER
REGION_NAME VARCHAR2(25)
SQL> select * from regions;
REGION_ID REGION_NAME
---------- -------------------------
1 Europe
2 Americas
3 Asia
4 Middle East and Africa
A complete archive of all the tips is available here.
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Today's Page Hits: 559
Total # blog entries: 1007
| « December 2009 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
5 | ||||||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | ||
| Today | ||||||