Sep 25, 2013 | JDeveloper, Oracle, Recent
To add a Data Source from JDeveloper:
- View > Application Server Navigator
- Application Servers > IntegratedWebLogicServer
- R-click > Launch Administrative Console…
-that should be i.e. like “http://127.0.0.1:7101/console/login/LoginForm.jsp”
- Login with user/password
- From Domain Structure open Services > select Data Sources
- New > Generic Data Source
- Specify the connection properties:
- Name: MyConnectionDS (or whatever you defined in your Java app data source)
- JNDI Name: comp/env/jdbc/MyConnectionDS or jdbc/PoliceConnectionDS
- Database Type: Oracle
- > Next
- Database Driver: Oracle’s Driver (thin) for Instance Connections (versions 9.0.1 or later)
- > Next
- Supports Global Transactions
- One-phase commit
- > Next
- Type in: Database Name, Host Name, Port, Database User Name, Password
- > Next
- Test Database Connection screen > click Test Your Configuration
- if “Connection test succeeded.”, click Finish
Your new data source should be ready to use for local server run/debug.
Feb 27, 2013 | JDeveloper, oracle ADF
If you get the following or similar error:
OC4J – (SEVERE) Failed to set the internal configuration of the OC4J JMS Server with: XMLJMSServerConfig (jms.xml)
You may need to delete all contents within the “persistence” folder:
[text]jdev10.1.3.5.adf\jdev\system\oracle.j2ee.10.1.3.43.6\embedded-oc4j\persistence\[/text]
Jan 17, 2013 | JDeveloper
The reason you get some numbers next to file names of JDeveloper (or IPs on project names) is because subversioning is enable in your JDeveloper’s options.
To disable and continue to use your external subversioning system do as follows:
From within JDeveloper:
[text]Versioning > Configure…
Deselect “Versioning Support for Subversion…”[text]
Restart your JDeveloper and the revision numbering should go away.
Mar 8, 2012 | Databases, java, JDeveloper, Oracle, oracle pl/sql
Create the Java class
[java]public class Hello2 {
public static String hello() {
return “Hello World.”;
}
public static String hello(String name) {
return “Hello ” + name + “.”;
}
public static void main(String[] args) {
System.out.println(Hello2.hello());
System.out.println(Hello2.hello(“Java”));
}
}[/java]
Test the output (console):
[bash]java Hello[/bash]
Output:
[text]Hello World.
Hello Java.[/text]
After compilation, run the following (via puntty on DB server) to load it into the Database (console)
[bash]loadjava -r -f -o -user dbuser/dbpass HelloWorld2.class
# run dropjava to unload any loaded java app/class[/bash]
Calling it from JDeveloper:
[sql]–Create a db connection in JDev as SYS
–R-click on this new connection and select “SQL Worksheet”
–Enter the following in command window:
call dbms_java.LOADJAVA(‘/home/oracle/myapp.jar -verbose -force -grant SCOTT -resolve’);
–to Drop it:
call dbms_java.DROPJAVA(‘/home/oracle/myapp.jar -verbose’);[/sql]
Using a Package (see for Function further down):
[sql]–Create PL/SQL wrapper package bind to a Java class file
CREATE OR REPLACE PACKAGE hello2 AS
–Null argument function header
FUNCTION hello RETURN VARCHAR2;
–One argument function header
FUNCTION hello(who VARCHAR2) RETURN VARCHAR2;
END hello2;
/
–Package body
CREATE OR REPLACE PACKAGE BODY hello2 AS
–Null argument function body
FUNCTION hello RETURN VARCHAR2 IS
LANGUAGE JAVA NAME ‘Hello2.hello() return String’;
–One argument function body
FUNCTION hello(who VARCHAR2) RETURN VARCHAR2 IS
LANGUAGE JAVA NAME ‘Hello2.hello(java.lang.String) return String’;
END hello2;
/[/sql]
Now check that the objects are present (sql):
[sql]SELECT object_name, object_type, status
FROM user_objects
WHERE object_name IN (‘Hello2’, ‘HELLO2’);[/sql]
The output should be something like:
[text]OBJECT_NAME OBJECT_TYPE STATUS
———– ———— ——
HELLO2 PACKAGE VALID
HELLO2 PACKAGE BODY VALID
Hello2 JAVA CLASS VALID[/text]
Finally, test the package by calling:
[sql]SELECT hello2.hello(‘Mr Java’) FROM dual;[/sql]
Output:
[text]HELLO2.HELLO(‘MRJAVA’)
———————————–
Hello Mr Java.[/text]
Using a PL/SQL Function rather than a Package
[sql]create or replace function hello2 return varchar2 as
language java name ‘Hello2.hello() return java.lang.String’;[/sql]
To call the function, from sqlplus set a variable and dump the string in there:
[sql]variable tmp varchar2(20);
call hello2.hello() into :tmp;[/sql]
Output:
[text]tmp
———
Hello World.[/text]
Oct 31, 2011 | java, JDeveloper
System.out.println():
Netbeans: sout -> Tab
Eclipse: syso -> Ctrl + Space
JDeveloper: sop -> Ctrl + Enter
System.err.println():
JDeveloper: sep -> Ctrl + Enter
some credits: Java-Servlet-Jsp Blog
Mar 28, 2011 | java, JDeveloper
JDeveloper picks-up the default locale language from the OS.
To change this and force JDev to a specific language:
- Open JDEV_HOME/jdev/bin/jdev.conf
- Add the following lines for English:
AddVMOption -Duser.language=en
AddVMOption -Duser.country=US
This will show all warnings and message details in English.
credit: OraTransplant.nl
Comments