Sunday Nov 09, 2008

Java DB and GlassFish v3 Prelude

GlassFish v3 Prelude launched recently and bundles Java DB, Sun's supported version of Apache Derby.

As you may already know, GlassFish v3's foundations are based on HK2, some Hundred Kilobytes Kernel with a module subsystem and component model that can run on top of OSGI.

Java DB modular architecture is similarly based on modules and services components and can also run as an OSGI bundle. Both GlassFish and Java DB can run embedded in some Java framework or as standalone applications in their own JVM process.

I thought I would highlight how you can get Java DB running in one command and start using it. Note that there is no change as far as how Java DB is run with previous versions of GlassFish.

To start a GlassFish server instance:
\*\* Hint: First make sure to set JAVA_HOME environment variable to point to Sun JDK6 root installation directory.
> cd glassfishv3-prelude (or wherever directory you have installed GlassFish)
> bin\\asadmin start-domain (to start the default domain instance)

Then all you have to do to start Java DB as a standalone server process is:
> bin\\asadmin start-database

Database started in Network Server mode on host 0.0.0.0 and port 1527.
--------- Derby Network Server Information --------
Version: CSS10020/10.2.2.1 - (538595)  Build: 538595  DRDA Product Id: CSS10020
-- listing properties --
derby.drda.traceDirectory=C:\\Apps\\glassfishv3-prelude\\glassfish...
derby.drda.maxThreads=0
derby.drda.keepAlive=true
derby.drda.minThreads=0
derby.drda.portNumber=1527
derby.drda.logConnections=false
derby.drda.timeSlice=0
derby.drda.startNetworkServer=false
derby.drda.host=0.0.0.0
derby.drda.traceAll=false
.......................................

Now, that GlassFish and Java DB have been started, you can test a ping connection via the GlassFish Administration console at:
http://localhost:4848/

Navigate to Resources> JDBC> Connection Pools> DerbyPool
which is a pre-defined sample JDBC connection pool.

You will be able to ping the running Java DB instance by clicking on the Ping button.

It will create some sun-appserv-samples GlassFish sample database by default under glassfishv3-prelude\\glassfish\\databases directory and derby.log will also be under that same location.

That's it. You can now access the sample database via the JDBC sample DerbyPool connection pool from your application.

You could also connect via IJ, Java DB's command-line tool as follows:
> set DERBY_INSTALL=C:\\glassfishv3-prelude\\javadb
> cd glassfishv3-prelude
> javadb\\frameworks\\NetworkServer\\bin\\ij
> ij version 10.2
   ij> connect 'jdbc:derby://localhost:1527/sun-appserv-samples;user=APP;password=APP';
   ij> select count(\*) COUNT from sys.systables;
        COUNT
        -----------
        19
   ij> exit;

To stop Java DB, simply run:
> bin\\asadmin stop-database
Connection obtained for host: 0.0.0.0, port number 1527.
Apache Derby Network Server - 10.2.2.1 - (538595) shutdown at 2008-11-09 08:48:43.312 GMT
Command stop-database executed successfully.

More information about GlassFish's admin start-database and stop-database commands.

Tuesday Jan 16, 2007

Java TV

Intriguing blog entry title eh? Well, no it's not a new product from Sun Microsystems, neither some TV that can run or deliver some Java...

It a is repository of video interviews around Java posted by Developpez.com, one of the biggest Java developers community in France.



Please note that a lot of the videos are in french but not all of them.

Most recently posted video interviews are of Marc Fleury (JBoss), Vincent Massol (XWiki) and myself (Java DB).

Friday Jan 05, 2007

First batch of JavaPolis 2006 slides available



The JavaPolis 2006 conference was a blast - There were more than 2,800 attendees and a lot of interesting presentations. I believe this is the biggest Java conference in Europe at the moment.

A first batch of some slides have been posted at the JavaPolis site.

Many thanks to Mr. JavaPolis, Stephan Janssen and his peers for organizing such a successful event.

The slides for the 2 Java DB quicky presentations I gave should be available in the next batch hopefully.

Tuesday Dec 05, 2006

Free and Open Source Java

For those who haven't seen it - Sun's webcast original announcement of Open Sourcing Java can be found here as well as some overview of the Open Source JDK project.

Thursday Nov 30, 2006

Java Remains No. 1 Programming Language

Interesting article from JDJ Java News Desk.

Java now holds the market penetration lead at 45%.

Note that Ajax grew (by 10%) to reach a total penetration level of 28%.

Sunday May 14, 2006

A slot car race powered by Java in real-time - is this cool or what?

If you're at JavaOne, I'd recommend participating in the slot card racing programming challenge.

You'll get to learn about the coolness of Netbeans and its plug-ins/modules as well as Sun's Java real-time system.

It does not take too much time to tune up the sample code that is provided and go off to racing...

Fun, entertaining and a great learning experience...It really is cool...

I can only recommend it. Having tried it myself... ;-)

Some cool pictures during the track set-up

About

forsini

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
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
   
       
Today
Bookmarks