---
title: "@project.name@"
menus: project
params: 
    version: @project.version@
    status: stable
    startdate: 2006-11-22
    date: @project.date@
    type: component
date: @publish.date@
draft: true
layout: "project"
---
ResX is a ResourceBundle implementation which makes use of a database connection
<!--more-->
This is by far the smallest component I made and does one simple thing: It overwrites java.util.ResourceBundle 
to get the internationalistation information from a datasource instead of a properties file or class. Having written 
java applications that extensively used a database, I did not find it very helpfull getting my resources from another source. 
It supprised me that there is hardly any performance loss noticable getting resources from the database

The implementation stays pretty close to the ResourceBundle implementation and will check first for
other types like `java.util.ListResourceBundle` and `java.util.PropertyResourceBundle`
before checking for the database. Unfortunatly the getBundle() methods in ResourceBundle are final and cannot be reimplemented. 
Therefor new methods where implemented getExtBundle(String) and getExtBundle(String,Locale) to get the information from the database.</p>

## usage
The use of ResX is simple: create the LOCALIZED_RESOURCE table from the scripts directory (there is a script for oracle and an ANSI-script). 
In your code add the appropriate JDBC connection information:
	```
	System.setProperty("sql.driver","oracle.jdbc.driver.OracleDriver");
	System.setProperty("sql.url", "jdbc:oracle:thin:@server:1521:database");
	System.setProperty("sql.user","SCOTT");
	System.setProperty("sql.password","TIGER");
	```

You can also use a properties-file called `connection.properties` in the directory you start your application from
which contains the properties as described above 

You can now load the resource bundle by simply calling:
	`ResourceBundle rb = ExtResourceBundle.getExtBundle("bundleName")`
The getExtBundle() methods return a normal ResourceBundle which can be used as any other resource bundle

## language
java jdk 8+

## references
- [Examples for reimplementing ExtResourceBundle](resx-overwrite-howto.html)
- Track
- Babel

## dependencies
- None


