How to fix VB application not running on Windows Vista, 7 or 8

Older VB application built on VB 5 or 6 may not work properly under the newer versions of Windows Vista, 7 or 8. The app may even require specific dll or other file to be registered on the system.

  1. You may need to register MSCOMCT2.OCX and/or COMCTL32.OCX
  2. For a 32bit system run as follows:
    [text]Regsvr32 MSCOMCT2.OCX[/text]
  3. For a 64bit system run this:
    [text]Regsvr32 c:\windows\SysWOW64\MSCOMCT2.OCX[/text]

Do the same for other files if needed.

How to install VB 6.0 with SP6 on Windows 7

1. Install Visual Basic 6.0 (as Administrator)

Select custom install as follows:

Microsoft VB 6.0
Active X
Data Access
Graphics

2. Skip MSDN and all other install options (Source Safe, VC++, etc).

3. Uncheck registration and complete the setup.

4. Run VB (should run fine).

Note: VB should run fine, but in some cases may need the vb6.exe set with compatibility settings on:

path: c:\Program Files\Microsoft Visual Studio\VB98\vb6.exe

R-click > Properties > Compatibility and check the following:

Run in Windows XP mode
Disable Visual Thems
Disable Desktop Composition
Disable display scalling on high DPI settings

5. Install VB 6.0 SP6 if needed (there should be no issues and previous SPs are not needed).

Note: MDAC 2.5 are NOT needed for Windows Vista and later.

credits: Ask the FortyPoundHead

How to install Oracle Forms and Reports 11g on windows 7 64bit

specs: Pentium Dual 2.2 64bit, 5 GB mem, Windows 7 64bit
reqs: Win7 x64, 1GB Memory, Administrator
time: Oracle Weblogic: 5 min, Fusion Middleware: 23 min setup, 16 min config

  1. Download Java JDK 6u25 x64 (jdk-6u25-windows-x64.exe)
  2. Download Weblogic Server 10.1.3.2 (11g) from here
    Tip: look for “Oracle WebLogic Server 11gR1 (10.3.2) – Package Installer” and select
    the x64 JVM installer package (about 1 GB)
  3. Download Fusion Middleware – Portal, Forms, Reports and Discoverer (11.1.1.2.0) from here
    Tip: look for “Portal, Forms, Reports and Discoverer (11.1.1.2.0)” download link and select
    the x64 zip files (about 2.5 GB in chunks of ~500MB).
  4. Make sure you have at least
    • a 64bit CPU and Windows system
    • 1 GB of memory
    • 5 GB of free disk space for a typical install (more…)

How to build a Java app and load it into an Oracle DB

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]

How to create a Servlet and use it from a JSP page (ADF 10g)

Create the Servlet

  1. Right-click on the package you need it for and select New…
  2. From the new gallery select Web-Tier > Servlets on the left and on the right select HTTP Servlet
  3. Click Next and give the Servlet:
  1. Class name (ImageServlet)
  2. the Package it will reside in
  3. select doGet() method to implement
  • click Next and set the Mapping details:
    1. Name: the name to use in the application
    2. Url pattern: the url path to use in jsp pages (/somePath)
  • Finish
  • In the class, complete the method doGet() with what the servlet should do. If it is a DB query i.e.:

    We need a connection to the DB to make a tranaction…

    [java]

    public static Connection getConnection() throws Exception {

    String amDef = “bc.datamodel.common”;
    String config = “ModelNameLocal”;
    Connection con = null;
    ApplicationModule am = null;

    try {
    am = Configuration.createRootApplicationModule(amDef, config);
    con = ((DBTransactionImpl)am.getTransaction()).getPersistManagerConnection();
    } finally {
    Configuration.releaseRootApplicationModule(am, true);
    }

    return con;

    }

    [/java] (more…)