Recent Notes

Displaying keyword search results 1 - 11
Created by Fang on September 07, 2009 20:44:15    Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app : <project> <modelVersion>4.0.0</modelVersion>... Create a directory named ear under javaee-app . Create pom.xml under ear : <project> <modelVersion>4.0.0</modelVersion>... Modify pom.xml in the webapp directory so that it looks like this: <project> <modelVersion>4.0.0</modelVersion> ... Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by meiu on February 09, 2010 03:26:14    Last update: March 31, 2011 09:00:19
Simple JDBC code for Oracle. import java.sql.*; public class JDBCHelloWo...
Created by Dr. Xi on September 20, 2009 16:52:19    Last update: March 22, 2010 01:28:49
When I assemble a session bean without the proprietary deployment descriptor ( orion-ejb-jar.xml ), OC4J generates one like this (as can be seen from the OC4J management console): <?xml version="1.0" encoding="utf-8"?> <ori... So I use this code to lookup the EJB: import javax.naming.Context; import javax.namin... OC4J throws ClassCastException : java.lang.ClassCastException: com.evermind[Oracle ... The JNDI browser (OC4J container home -> Administration -> JNDI browser) shows that the name simpleEjb_SimpleBeanLocal is bound to: com.evermind.server.ejb.StatelessSessionDefaultLocalHomeImpl Solution: Change the local name in the OC4J generated orion-ejb-jar.xml to simpleEjb_SimpleBeanLocal2 and put it in the EJB package. Redeploy. The JNDI browser shows that simpleEjb_SimpleBeanLocal is still bound to com.evermind.server.ejb.StatelessSessionDefaultLocalHomeImpl . But simpleEjb_SimpleBeanLocal2 is bound to the right proxy: SimpleBean_LocalProxy_5f4b5e5 .
Created by Dr. Xi on January 07, 2010 23:40:28    Last update: February 09, 2010 03:24:35
This is a utility to generate SQL insert statements for Oracle for one table, or a set of tables. It doesn't cover all possibilities but should be good enough for most cases. import java.io.*; import java.sql.*; import ... To generate insert statements for multiple tables, simply put the table names in a file, one per line, and use the -f switch.
Created by Dr. Xi on January 07, 2010 23:56:00    Last update: January 07, 2010 23:56:00
This is a utility that generates a script to grant privileges for an existing schema for Oracle. import java.io.*; import java.sql.*; pub...
Created by Dr. Xi on January 07, 2010 23:51:44    Last update: January 07, 2010 23:53:57
This is a utility to generate a "create synonym" script for Oracle for an existing schema. import java.io.*; import java.sql.*; pub...
Created by Dr. Xi on January 07, 2010 23:47:36    Last update: January 07, 2010 23:47:36
This is a utility to generate a "create role" script for Oracle for an existing schema. import java.io.*; import java.sql.*; pub...
Created by Dr. Xi on October 24, 2008 22:24:46    Last update: October 24, 2008 22:24:46
This script creates a PL/SQL script to recreate currently defined oracle jobs. Good for exporting jobs definitions from one instance and import into another instance, or as a master script to create job definitions from scratch. declare what user_jobs.what%TYPE; interv...
Created by Dr. Xi on September 10, 2008 03:37:17    Last update: September 10, 2008 15:48:31
Suppose you have a file with these lines: -- contents of update_contact.sql update co... You can execute this script from the SQL prompt by entering: @update_contact.sql And it would execute fine. Now you get the contents of the script into the SQL buffer by: GET update_contact.sql and use the / command to execute the buffer, you get ORA-00911 invalid character error for the semicolon at the first line. Confusing, right? It turned out that the semicolon is used by SQL*Plus to signify the end of a SQL command. When you enter SQL commands into SQL*Plus, it strips the trailing semicolon before sending the SQL command to the database. But when you import the contents of a file with the GET command, the semicolon is...
Created by Dr. Xi on April 06, 2008 15:17:03    Last update: September 06, 2008 17:18:07
If you create a model like the following: from django.db import models class Person(m... Django creates the corresponding table like this: CREATE TABLE person ( "id" number(11,0) NOT... Since Oracle doesn't have IDENTITY or AUTO_INCREMENT column, how does Django create the primary key when you insert a new person? In fact, when you run python manage.py syncdb with an empty database, Django also creates a sequence and a trigger: create sequence person_sq; create or replace TR... However, if you have an existing Person table and are creating a Django model for it, the sequence and trigger won't be created when you syncdb . You have to manually create them in order for inserts to work.
Created by Dr. Xi on September 04, 2008 19:14:06    Last update: September 04, 2008 19:14:22
import java.sql.*; import java.io.*; pub...