Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Monday, 7 May 2012

Check the Version of JavaDB

Duke WavingHow do you check the version of JavaDB you are currently using?



Use the sysinfo utility included with JavaDB depending on the situation, it will be in the following locations on a Windows system.



c:\Program Files\Java\jdk1.7.0_03\db\bin>sysinfo

or

c:\Program Files\glassfish-3.1.1\javadb\bin>sysinfo



Of course it will be a little different OS X or Linux, but you get the gist of it.

Thursday, 2 June 2011

Berkeley DB, SQLite and Java

Duke WavingI learned a few things about the Berkeley DB which is developed by my employer, Oracle. So let me share. Berkeley DB first came to my attention as an option for MySQL. But it is much more than it, it can store data for projects that range in size from kilobytes to petabytes. In addition, it can used as an embedded database, an XML Database or an SQL database. You can read about the all the possibilities on the overview page.



Berkeley DB Overview

Note: Before I forget, Berkeley DB is distributed with an open source license. You can use it for free for personal use or as a part of an open source project. If you wish to distribute your own DBs for profit, you can get a commercial license from Oracle.



Two things really jumped out at me. First, the latest version of Berkeley DB comes with an SQLite front end. So if you are familiar with SQLite, you can jump write in and try it out. You will find online documentation here:



Getting Started with the Oracle Berkeley DB SQL APIs



Second, Berkeley DB includes a Java embeddable flavor that allows you to persist collection structures in the database. Check out the tutorial here:



Berkeley DB Java Edition Collections Tutorial



Cool stuff.

Monday, 13 September 2010

javax.naming.NamingException: Lookup failed for 'jdbc/dbname' in SerialContext

Duke WavingWhile trying to deploy a Java EE6 Web application with NetBeans and Glassfish V3, the application deployment fails with the following error.



SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/dbname' in SerialContext [Root exception is javax.naming.NameNotFoundException: dbname not found]


What does this mean? Basically, you have not defined the JDBC resource in the Web Application. In my case, neither the Database Connection Pool nor the JDBC resource had been defined. Once the persistence resources are defined, the application should deploy without any errors.



When first analyzing the problem, I thought, incorrectly, that since the persistence resources were defined in an included library, no definition was required in the Web application. This is not the case.



Update

A reader made a fair point that no pointers on how to create the JDBC resource or Connection Pool are included in this post. Here are the steps assuming you already have a Java EE project created. Right click your project and select the following menu options.

  • Connection Pool New -> Other -> Glassfish -> JDBC Connection Pool

  • JDBC Resource New -> Other -> Glassfish -> JDBC Resource

The wizard for each will walk you through the setup. Hope that helps.