Thursday, April 26, 2012

Google App Engine 1.6.5 released

Google has launched a new version of App Engine. Version 1.6.5 has some improvements on a.o. datastore,  Images API and Task Queues.

Read Google's blogpost here.

Thursday, April 19, 2012

Make the web faster using SPDY

Google Developers has announced they have launched a version of mod_spdy, an Apache mod that adds SPDY support to your Apache HTTPD server. To get started, download mod_spdy and follow the install guidelines.

By default, Chrome, Chrome for Android and the most recent versions of Firefox support the SPDY protocol. It's not likely Microsoft's Internet Explorer will support SPDY in the near future.

Tuesday, April 17, 2012

Google Drive to launch next week

According to The Next Web, Google will launch Google Drive somewhere in the next week. Basically, Google Drive is just another cloud storage solution, but then again, it's Google. I should integrate nicely with their already existing products, such as Google Docs, Google Apps, Picasa and Android. Every user is entitled to receive 5GB for free, with the option to pay for more. It's not as much as the 50GB I blogged about earlier, but that was a limited offer.

After Box, DropBox, SugarSync and many, many others, this seems to be like the thirteenth cloud storage provider in a dozen. Let's hope Google can really offer an added value. If you're a fan of Google and their products (like I am), this should be worth checking out. There aren't a lot of details known, but the launch is expected to be on Tuesday 24 or Wednsesday 25 April.

Monday, April 16, 2012

Find constraint in Oracle database

When you're developing web applications, you usually persist against a database. And sometimes, that database throws errors at you. One of them can be a foreign key or other constraint violation. If you manage the database yourself, the constraint names are of course very logical and tell you immediately where the problem is. But sometimes the DB management isn't in your hands, and then the constraint key can be some random combination of letters and numbers. Obviously, it's not easy to find the cause of the problem then... unless you know how to search!

You can query all constraints in an Oracle database. Usually, the error you get from the database will be somewhere in your logs, or even displayed on the screen, so you have the name of the constraint that is violated. Once you have that, you can just run this simple query:

select constraint_name, table_name
from all_constraints
WHERE constraint_name = 'Faulted_Constraint_Name';


Now you know which table causes the error, and you can start solving the problem.

Of course, the 'all_constraints' table has more fields than just constraint_name and table_name. To find out what more you can query, just use following command:

desc all_constraints

This will give you a list of all queryable fields.

Friday, April 13, 2012

ADF 11g: Using Application Module outside ADF Application context

Earlier this week, I had to refactor an existing project, and extract some functionality. The goal was that this code could run outside of our Weblogic server, in a crontab job. So I created a new project, containing a class with a main method. The original code was based on Business Components, so I wanted to use this Oracle ADF specific technology as well.

After all the extraction was done, I created a JAR file of my new project and tried to run my main class. The fist problem I encountered was not having all the necessary JARs on my classpath. Therefor, I created a batch-script (could be Unix as well, but I was working in a Windows environment), setting all necessary JARs on my classpath and launching my main method

set JAVA_HOME=C:\Oracle\Middleware\jdk160_18\jre

set PATH=%JAVA_HOME%\bin;%PATH%
set CLASSPATH= YOUR_CLASSPATH

java -classpath %CLASSPATH% my.MainClass


Where YOUR_CLASSPATH is a semicolon-seperated list of all JARs you need. Now the code would compile! But then I ran into the next issue: creating an application module.

I used the default way of creating an Application Module, ie. Configuration.createRootApplicationModule(). While this works inside an ADF application, running a JAR standalone does not provide you with enough context. So I tried a new approach, and manually initialized a context:

String jdbcURL = "jdbc:oracle:thin:@HOST:PORT:SID";

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);

Context ic = new InitialContext(env);


But of course, creating a Context isn't enough to use the Application Module. We need to create that as well, and I did that in the following manner:

// 'defName' is the JNDI name for the application module
// definition from which the root application module is to
// be created
String defName = "my.AppModule";

ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup(defName);
ApplicationModule = (ApplicationModule)home.create();
mbApplicationModule.getTransaction().connect(jdbcURL, dbUser, dbPassword);


DefName is the JNDI name of your application module. This can be found in bc4j.xcfg. Now we can use the ApplicationModule just like we would in an ADF Application context!

Wednesday, April 4, 2012

Test your PL/SQL skills!

The best way to deepen your knowledge of a certain topic is to practice it. Play with it, take quizzes about it, just be 'into it'. And when you can win prizes, that's always a nice extra.

Now there is a PL/SQL Challenge. It's completely free, and you can win (e-)books and Amazon gift cards. But apart from that, it's a great way to test, deepen and maintain your PL/SQL skills.

Find the PL/SQL Challenge at http://www.plsqlchallenge.com/ .