Boleto Bancario impression with bar code

Perguntas relacionadas a questões técnicas do Oracle EBS. Criação de Concorrentes, Value Sets, Alerts, Forms Personalizations, Configurações, etc
Post Reply
marlonpasquali
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 248
Joined: Fri, 06 Feb 2009 3:02 pm
Location: ERECHIM - RS

Good morning friends,
work with Oracle Applications 11i (Forms and Reports, PLSQL) and I am studying to develop banking billet for Banco do Brasil in Laser printer, with bar code. Our server is Linux RedHat.
I have many doubts, if anyone can help me.
- Do you have to install a source for the bar code on the server?
- What source is this?
- In the Concurrent Register, what format I put? PDF, PCL?
- What style? A4, Landwide?
- Do you have to set something on the DESFORTAT parameter in Report?
Someone can give me a tip please.
Thank you very much,
Marlon
alexrsilva
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 153
Joined: Tue, 27 May 2008 1:31 pm
Location: Rio de Janeiro - RJ
Alex Silva
Analista de Sistemas
11i.10 Applications Developer Implementation Champion
11i.10 E-Business Suite Integration Champion

Marlon,
Good morning.
We have made a ticket implementation that uses the barcode.
We have a Java Stored Procedure JSP that generates the bar code.
He returns an image where, in Reports you position according to the Bank Layout of Brazil.
Search in Glufke for a topic called Banking Boleto.

Sincerely,
User avatar
madmax
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 293
Joined: Wed, 13 Dec 2006 5:02 pm
Location: São Paulo
Contact:
________________________________
Douglas - Madmax.

Personal.

I need to make a label report with bar code, and a friend informed me that the bar code folder must be registered somewhere. ???

Having this, just draw the field in Report, and choose the correct source.

Someone already did it?

The source of the bar code and bcode128.ttf

any tip and valid.

ABS.
alexrsilva
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 153
Joined: Tue, 27 May 2008 1:31 pm
Location: Rio de Janeiro - RJ
Alex Silva
Analista de Sistemas
11i.10 Applications Developer Implementation Champion
11i.10 E-Business Suite Integration Champion

Sorry Douglas,
Register the bar code folder?
She must have spoken about this file Link
or [url=http://download.oracle.com/docs/cd/E12839_01/bi.1111/b32122/orbr_barcode002.htm]outro Ink
.
Take a look [url=http://en.glufke.net/oracle/viewtopic.php?t=5741]aqui Ambem.

Sincerely,
User avatar
madmax
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 293
Joined: Wed, 13 Dec 2006 5:02 pm
Location: São Paulo
Contact:
________________________________
Douglas - Madmax.

Great Alex.

Thanks I'll take a look yes.

ABS ..
marlonpasquali
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 248
Joined: Fri, 06 Feb 2009 3:02 pm
Location: ERECHIM - RS

Alex,
would be very difficult for you to send me an example of this report and that java routine. I have no experience in this type of development and I still have many doubts. If it does not cause you no bother of course .... Anyway thank you for the tips.

Thanks,
Marlon
E-mail:
marlon.pasquali@peccin.com.br
alexrsilva
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 153
Joined: Tue, 27 May 2008 1:31 pm
Location: Rio de Janeiro - RJ
Alex Silva
Analista de Sistemas
11i.10 Applications Developer Implementation Champion
11i.10 E-Business Suite Integration Champion

After the [url=http://jbars.sourceforge.net/]jbars is added oracle, compile this code

Select all

 
create or replace and compile java source named barcode as 
import java.io.*; 
import javax.swing.*; 
import org.jbars.*; 
import java.awt.image.*; 
import java.awt.*; 
import oracle.sql.*; 
import oracle.jdbc.*; 
class Barcode { 
	public Barcode() { 
		super(); 
	} 
public static BLOB code(String code,String type, String sizeY) throws java.sql.SQLException, Exception{ 
    OracleConnection conn = (OracleConnection) new OracleDriver().defaultConnection(); 
    conn.setAutoCommit(false); 
    BLOB blob = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION); 
		String imageFormat = Barcode.JPG; 
		String quietZone = null; 
		// Create Barcode 
		Barcode barcode = null; 
		if (type.equalsIgnoreCase("CODE128")) { 
			barcode = new Barcode128(); 
		} 
		if (type.equalsIgnoreCase("CODE93")) { 
			barcode = new Barcode93(); 
		} 
		if (type.equalsIgnoreCase("INTER25")) { 
			barcode = new BarcodeInter25(); 
		} 
		if (barcode == null) { 
			System.out.println("Unknow barcode type: " + type); 
			System.exit(1); 
		} 
                Color barColorColor; 
                        barColorColor = Color.black; 
                Color textColorColor; 
                        textColorColor = Color.black; 
                double angle = 0; 
                barcode.setFontSize(10); 
		barcode.setTextAlignment(Barcode.ALIGN_CENTER); 
		barcode.setCode(code); 
			byte[] file=null; 
			if(imageFormat.equals(Barcode.PNG)){ 
				file= barcode.createPNG(Integer.parseInt(sizeY), 
					barColorColor, textColorColor, angle); 
			} 
			else if(imageFormat.equals(Barcode.JPG)){ 
				file= barcode.createJPG(Integer.parseInt(sizeY), 
						barColorColor, textColorColor, angle); 
			} 
			else{ 
				System.out.println("Unknow image format: " + imageFormat); 
				System.exit(1); 
			} 
			//FileOutputStream os = new FileOutputStream(new File(fileName)); 
                        OutputStream os = blob.getBinaryOutputStream(); 
			os.write(file); 
			os.flush(); 
			os.close(); 
           return blob; 
	} 
} 
can call it thus

Select all

 
FUNCTION generate_barcode( p_code IN VARCHAR2  -- Números do código de barras 
                                  , p_tipo IN VARCHAR2  --'CODE128','CODE93' ou 'INTER25' 
                                                       --passe CODE128 
                                  , p_size IN VARCHAR2 -- Tamanho da imagem, eu utilizo 50 
         ) RETURN BLOB 
AS LANGUAGE JAVA NAME 'Barcode.code(java.lang.String, java.lang.String,java.lang.String ) return oracle.sql.BLOB'; 
He returns to image of barcode.
senger
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 9
Joined: Fri, 16 Apr 2010 5:19 pm
Location: SC

And how do you call the function and include the image in Report (Generate_BarCode) in ReportS6i, is it a BLOB type field?
alexrsilva
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 153
Joined: Tue, 27 May 2008 1:31 pm
Location: Rio de Janeiro - RJ
Alex Silva
Analista de Sistemas
11i.10 Applications Developer Implementation Champion
11i.10 E-Business Suite Integration Champion

At the time was recorded the field image of the Boleto table of the BLOB type.
Na Reports Query, seeks this dice.
Then puts a field of type Binary Lob and the source the field on your query.

Sincerely,
senger
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 9
Joined: Fri, 16 Apr 2010 5:19 pm
Location: SC

Thanks for the response ...

When I perform via SQLPlus or in Reports:

Error at Line 2:
ORA-29532: Java Call Terminated by Uncaught Java Exception: java.lang.nullpointerexception

I used the loadjava and was like this:
org / jars / barcode128
org / jars / barcode
org / jars / barcode93

and I created BarCode2.java ... with the code you posted here. That's how it's done ? What could be wrong.

Thanks.
senger
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 9
Joined: Fri, 16 Apr 2010 5:19 pm
Location: SC

Has anyone been able to implement Oracle 9?
==
When you run from the error in the rows of the type:

Select all

setFont(new Font("Helvetica", Font.PLAIN, 20));  
and

Select all

Graphics2D g = (Graphics2D) image.createGraphics();
99] The error is as follows: ORA-29532:
Java Call Terminated by Uncaught Java Exception: java.lang.nullpointerexception
When I commented the line defining The source for example passed, but further erred in line ref. to Graphics2D
alexrsilva
Rank: Analista Sênior
Rank: Analista Sênior
Posts: 153
Joined: Tue, 27 May 2008 1:31 pm
Location: Rio de Janeiro - RJ
Alex Silva
Analista de Sistemas
11i.10 Applications Developer Implementation Champion
11i.10 E-Business Suite Integration Champion

I'm doing a tutorial and sending it to the admin post here.
I have a 10g bank. But there is no difference from 10 to 9 in relation to Java.
rcd_tech@hotmail.com
Rank: Programador Pleno
Rank: Programador Pleno
Posts: 42
Joined: Thu, 08 Sep 2011 1:13 pm
Location: SP

Alex,

as I say to add JBARS libraries in Oracle.

to create a procedure to generate the bar code for my ticket.

With much effort I was able to implement a means that the algorithms for barcode generation (numbering) and digital line (numbering).

Now you need to generate the barcode image for the ticket I drew in Reports.

I downloaded the JBARS library just do not know how to add it to this to be able to use.

Can I give me some tips?

Att,
Ricardo Miranda
rcd_tech@hotmail.com
Rank: Programador Pleno
Rank: Programador Pleno
Posts: 42
Joined: Thu, 08 Sep 2011 1:13 pm
Location: SP

Nobody?
diegolenhardt
Moderador
Moderador
Posts: 1177
Joined: Thu, 15 Oct 2009 10:28 am
Location: Recife

Search for Loadjava

This utility carries the .jar or .class pro bank.

: D
vagner.rigo
Rank: Estagiário Júnior
Rank: Estagiário Júnior
Posts: 1
Joined: Tue, 27 Sep 2011 8:00 pm
Location: Assis - SP

Good evening,

I have doubts in the development of bar code for Banco Itau, I saw in the forum that you implemented using JSP, if possible could send me and add me on msn to exchange information .

Alex follows my email:

vagner.rigo@hotmail.com


]Hug
User avatar
bessa_lucas
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 55
Joined: Fri, 17 Oct 2014 3:02 pm
Lucas Bessa
Analista de Sistemas

lucas.bessa@obers.com.br
lucas.bessa.ti@gmail.com

Personnel,

I am also needing to develop Banco Itau's ticket in Report6i.
In fact I already have but I am in trouble generating the PDF with the source code 2/5 interleaved.

Can anyone send me these tips?
lucas.bessa@obers.com.br
User avatar
bessa_lucas
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 55
Joined: Fri, 17 Oct 2014 3:02 pm
Lucas Bessa
Analista de Sistemas

lucas.bessa@obers.com.br
lucas.bessa.ti@gmail.com

Hello everyone,

After the help of Alex Silva, I managed to create a class in Java and generate the hexadecimal file, from that I transform it on RAW to generate it on the screen.

I generated hexadecimal in NetBeans and performed other procedures in Report6i, the problem is at the time of running the last method "Gethex" it has the comparison ("and" commercial) I could not yet An alternative.

Select all

create or replace and compile java source named GerarBarcode as 
/* 
 * To change this license header, choose License Headers in Project Properties. 
 * To change this template file, choose Tools | Templates 
 * and open the template in the editor. 
 */ 
 
 
import org.jbars.*; 
import java.awt.*; 
import java.io.*; 
import java.sql.Blob; 
 
class GerarBarcode { 
 
    public GerarBarcode() { 
        super(); 
    } 
     
    public String code(String codigo, String type, String sizeY,String extensao) throws java.sql.SQLException, Exception { 
 
        Blob blob = null; 
        byte[] file = null; 
 
        String imageFormat = "barcode128.JPG"; 
 
        if (type.equalsIgnoreCase("CODE128")) { 
            Barcode128 barcode128 = new Barcode128(); 
 
            Color barColorColor; 
            barColorColor = Color.black; 
            Color textColorColor; 
            textColorColor = Color.black; 
            double angle = 0; 
 
            barcode128.setFontSize(10); 
            barcode128.setTextAlignment(barcode128.ALIGN_CENTER); 
            barcode128.setCode(codigo); 
 
            if (imageFormat.equals("barcode128.PNG")) { 
                file = barcode128.createPNG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else if (imageFormat.equals("barcode128.JPG")) { 
                file = barcode128.createJPG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else { 
                System.out.println("Unknow image format: " + imageFormat); 
                System.exit(1); 
            } 
 
        } 
         
        if (type.equalsIgnoreCase("CODE93")) { 
            Barcode93 barcode93 = new Barcode93(); 
 
            Color barColorColor; 
            barColorColor = Color.black; 
            Color textColorColor; 
            textColorColor = Color.black; 
            double angle = 0; 
 
            barcode93.setFontSize(10); 
            barcode93.setTextAlignment(barcode93.ALIGN_CENTER); 
            barcode93.setCode(codigo); 
 
            if (imageFormat.equals("barcode93.PNG")) { 
                file = barcode93.createPNG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else if (imageFormat.equals("barcode93.JPG")) { 
                file = barcode93.createJPG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else { 
                System.out.println("Unknow image format: " + imageFormat); 
                System.exit(1); 
            } 
 
        } 
         
        if (type.equalsIgnoreCase("INTER25")) { 
            BarcodeInter25 barcode25 = new BarcodeInter25(); 
 
            Color barColorColor; 
            barColorColor = Color.black; 
            Color textColorColor; 
            textColorColor = Color.black; 
            double angle = 0; 
 
            barcode25.setFontSize(10); 
            barcode25.setTextAlignment(barcode25.ALIGN_CENTER); 
            barcode25.setCode(codigo); 
 
            if (imageFormat.equals("barcode25.PNG")) { 
                file = barcode25.createPNG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else if (imageFormat.equals("barcode25.JPG")) { 
                file = barcode25.createJPG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else { 
                System.out.println("Unknow image format: " + imageFormat); 
                System.exit(1); 
            } 
 
        } 
                 
                 
        GerarBarcode conversor = new GerarBarcode(); 
        String retorno = conversor.getHex(file); 
 
        return retorno; 
    } 
     
     
    public String getHex(byte[] raw) { 
        String HEXES = "0123456789ABCDEF"; 
        if (raw == null) { 
            return null; 
        } 
        final StringBuilder hex = new StringBuilder(2 * raw.length); 
        for (final byte b : raw) { 
            hex.append(HEXES.charAt((b & 0xF0) >> 4)) 
                    .append(HEXES.charAt((b & 0x0F))); 
        } 
        return hex.toString(); 
    } 
 
} 
 
User avatar
bessa_lucas
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 55
Joined: Fri, 17 Oct 2014 3:02 pm
Lucas Bessa
Analista de Sistemas

lucas.bessa@obers.com.br
lucas.bessa.ti@gmail.com

Code update staff.

I saw that generating in hexadecimal for me was not a good choice.

now generate it in blob

Select all

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED SYS.GERARBARCODE as import org.jbars.*; 
import java.awt.*; 
import java.io.*; 
import java.sql.Blob; 
import oracle.jdbc.*; 
import oracle.sql.*; 
 
 
 
class GerarBarcode { 
 
    public GerarBarcode() { 
        super(); 
    } 
     
    public static Blob code(String codigo, String tipo, String sizeY,String extensao) throws java.sql.SQLException, Exception { 
        OracleConnection conn = (OracleConnection) new OracleDriver().defaultConnection(); 
        conn.setAutoCommit(false); 
        BLOB blob = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION); 
 
        byte[] file = null; 
 
        String imageFormat = "barcode128.JPG"; 
 
        if (tipo.equalsIgnoreCase("CODE128")) { 
            Barcode128 barcode128 = new Barcode128(); 
 
            Color barColorColor; 
            barColorColor = Color.black; 
            Color textColorColor; 
            textColorColor = Color.black; 
            double angle = 0; 
 
            barcode128.setFontSize(10); 
            barcode128.setTextAlignment(barcode128.ALIGN_CENTER); 
            barcode128.setCode(codigo); 
 
            if (imageFormat.equals("barcode128.PNG")) { 
                file = barcode128.createPNG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else if (imageFormat.equals("barcode128.JPG")) { 
                file = barcode128.createJPG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else { 
                System.out.println("Unknow image format: " + imageFormat); 
                System.exit(1); 
            } 
 
        } 
         
        if (tipo.equalsIgnoreCase("CODE93")) { 
            Barcode93 barcode93 = new Barcode93(); 
 
            Color barColorColor; 
            barColorColor = Color.black; 
            Color textColorColor; 
            textColorColor = Color.black; 
            double angle = 0; 
 
            barcode93.setFontSize(10); 
            barcode93.setTextAlignment(barcode93.ALIGN_CENTER); 
            barcode93.setCode(codigo); 
 
            if (imageFormat.equals("barcode93.PNG")) { 
                file = barcode93.createPNG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else if (imageFormat.equals("barcode93.JPG")) { 
                file = barcode93.createJPG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else { 
                System.out.println("Unknow image format: " + imageFormat); 
                System.exit(1); 
            } 
 
        } 
         
        if (tipo.equalsIgnoreCase("INTER25")) { 
            BarcodeInter25 barcode25 = new BarcodeInter25(); 
 
            Color barColorColor; 
            barColorColor = Color.black; 
            Color textColorColor; 
            textColorColor = Color.black; 
            double angle = 0; 
 
            barcode25.setFontSize(10); 
            barcode25.setTextAlignment(barcode25.ALIGN_CENTER); 
            barcode25.setCode(codigo); 
 
            if (imageFormat.equals("barcode25.PNG")) { 
                file = barcode25.createPNG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else if (imageFormat.equals("barcode25.JPG")) { 
                file = barcode25.createJPG(Integer.parseInt(sizeY), 
                        barColorColor, textColorColor, angle); 
            } else { 
                System.out.println("Unknow image format: " + imageFormat); 
                System.exit(1); 
            } 
 
        } 
 
         OutputStream os = blob.getBinaryOutputStream(); 
         os.write(file); 
         os.flush(); 
         os.close(); 
 
         return blob; 
 
    } 
 
} 
and to call use the function

Select all

create or replace FUNCTION generate_barcode( codigo IN VARCHAR2  -- Números do código de barras 
                                  , tipo IN VARCHAR2  --'CODE128','CODE93' ou 'INTER25' 
                                  , tamanho IN VARCHAR2 -- Tamanho da imagem, eu utilizo 50 
                                  , extensao IN VARCHAR2 -- 'barcode.JPG' ou 'barcode.PNG' 
                                    ) RETURN BLOB 
AS LANGUAGE JAVA NAME 'GerarBarcode.code(java.lang.String,java.lang.String, java.lang.String,java.lang.String)return oracle.sql.BLOB';
I rode everything in sys, I have a permission problem, but it works! : D

Note: remember to import the Jai_CODEC and JBARS library
Any questions I am at your disposal
User avatar
Porva
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 342
Joined: Mon, 29 Jan 2007 7:36 am
Location: São Paulo/SP
Rafael S. Nunes
São Paulo/SP

Ancient topic here,

"Note: remember to import the Jai_CODEC and JBARS library

but as I do to import these libraries to The bank using the PL / SQL Developer to then use the Java class and the procedure to generate the barcode?
User avatar
Porva
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 342
Joined: Mon, 29 Jan 2007 7:36 am
Location: São Paulo/SP
Rafael S. Nunes
São Paulo/SP

I got here using this tip:

before compiling the Java class in the bank, you will need to load the files jai_codec.jar and jars.jar ] to the bank.
http://www.dba-oracle.com/tips_oracle_sqlj_loadjava.htm

I copied the files jai_codec.jar and jars.jar into the UNIX via FTP , then loaded them to the database using the command below:

Select all

C:\oracle9i\bin>loadjava -user <user>/<password> jai_codec.jar
and

Select all

C:\oracle9i\bin>loadjava -user <user>/<password> JBARS.jar
Obs.: Replace the path c: \ oracle9i \ bin> of the example, by your Windows or UNIX directory.

Then I followed the steps shown in the previous messages to compile the Java class in the bank and create the function that will call this class and return the barcode.

Everything is right, you can test like this:

Select all

SELECT generate_barcode_f( p_code  => '64731136' -- Numeros do código de barras 
                          ,p_tipo  => 'CODE93'   -- 'CODE128','CODE93' ou 'INTER25' 
                          ,p_sizeY => '50')      -- Tamanho da imagem (altura), ex: 50 
  FROM DUAL;
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

You can import a Java class using the Loadjava command from the operating system.

Here is an example: http://www.dba-oracle.com/tips_oracle_sqlj_loadjava.htm
The SQLJ Loadjava Utility
The Loadjava Utility (in Oracle 8.1.5 and up) loads Java Source and Class Files Into The Database. When Class Files are created in the conventional Manner, Outside The Database, Loadjava is Used to get Them Into The Database.

Loadjava Requires Two Database Privileges To Load Java Objects Into Your Own Schema: Create Procedure and Create Table. To Load Java Objects Into Schema Other Than The Currently Connected User, Create Any Procedure and Create Any Table Oracle privileges are required for the loadjava user.

This example will use Simple Java Program That Will Be Compiled Outside of Oracle and Then Loaded Into The Database.

See Loadjava Script Download

The Class File Is Now Loaded Into The Database and Visible From The DBA_Objects View With An Object Type Of Java Class.

from SQL * Plus, Create The PL / SQL Wrapper to Invoke The Newly Loaded Java Class:

Select all

SQL> create or replace procedure call_simplejava 
2 as language java  
3 name 'SimpleJava.showMessage()'; 
4 /  
 
Execute the code from SQL*Plus: 
 
SQL> set serveroutput on; 
SQL> call dbms_java.set_output(50); 
 
Call completed. 
 
SQL> execute call_simplejava; 
Here we are 
 
PL/SQL procedure successfully completed.
In This Example, The Java Class File Was Loaded Into The Database. The Java Source File Can Also Be Loaded. Butt, Both The Source and Class Files Cannot Be Loaded at The Same Time.

Select all

C:\oracle9i\bin>loadjava -user scott/tiger SimpleJava.java
IF Loading Many Java Class Files at One Time, It Is Advisable To Put Them In A Jar File And Load Them Into The Database at One Time, Since the Loadjava Program Will Also Load Jar Files. Loadjava Provides Many Command Line Options for the Java Developer. The Complete List Can Be Viewed by Typing Loadjava at the Command Line.

Just As Loadjava Loads The Database With Our Java Files or Classes, The Dropjava Utility Deletes Them. In the Example Below, The Class File That Was Loaded With Loadjava is removed. And Just Like Loadjava, It Will Drop Java Source, Java Classes, or Jar Files.

Select all

C:\oracle9i\bin>dropjava -u scott/tiger SimpleJava.class
Alternatively, Instead of Using the Command Line Utility, You Can Call A Package That Will do The Same Thing:

Select all

SQL> call dbms_java.dropjava('... options...');
]

Dropjava Can Be Used to Delete Java Objects from The Database. Theese Java Objects May Have Been Loaded Into The Database Through The Loadjava Utility. The Next Utility Also Loads Code Into The Database; Only Instead of Java, IT Loads to PL / SQL Server Page (PSP).

Select all

loadjava script download 
The SQLJ Utility Loading and Dropping Java Objects

The Loadjava Utility (Oracle 8.1.5 and up) loads Java Source and Class Files Into The Database. When Class Files are created in the conventional Manner, Outside The Database, Loadjava is Used to get Them Into The Database.

Loadjava Requires Two Database Privileges To Load Java Objects Into Your Own Schema: Create Procedure and Create Table. To Load Java Objects Into Schema Other Than The Currently Connected User, Create Any Procedure and Create Any Table Privileges are required.

This example will use Simple Java Program That Will Be Compiled Outside of Oracle and Then Loaded Into The Database.

Select all

public class SimpleJava { 
 
public void main(String[] args) { 
System.out.println("Here we are");  
}


from or UNIX:

Select all

C:\oracle9i\bin>javac SimpleJava.java 
 
C:\oracle9i\bin>loadjava -user scott/tiger SimpleJava.class
The Class File Is Now Loaded Into The Database and Visible from The DBA_Objects View With An Object Type of Java Class.

from SQL * Plus, Create the PL / SQL Wrapper to Invoke The Newly Loaded Java Class:


Execute The Code from SQL * Plus:

Select all

SQL> set serveroutput on; 
SQL> call dbms_java.set_output(50); 
 
Call completed. 
 
SQL> execute call_simplejava; 
Here we are 
 
PL/SQL procedure successfully completed.
In this example, The Java Class File Was Loaded Into The Database. The Java Source File Can Also Be Loaded. Butt, Both The Source and Class Files Cannot Be Loaded at The Same Time.

Select all

C:\oracle9i\bin>loadjava -user scott/tiger SimpleJava.java
IF Loading Many Java Class Files at One Time, IT IS ADVISABLE TO PUT THEM IN A JAR FILE AND LOAD THEM INTO THE DATABASE AT ONE TIME, Since the Loadjava Program Will Also Load Jar Files. A JAR FILE IS A GROUP OF Java Class Files Lumped Into One File, format similar to TAR (on UNIX) and WinZip. The Contents of A Jar File Can Be Viewed Using These Popular Utilities. Java Developers Preferred to Distribute Few Jar Files Rather Than Many Individual Java Class Files.

Loadjava Provides Many Command Line Options for the Java Developer. The Complete List Can Be Viewed by Typing Loadjava at the Command Line.

Just As Loadjava Loads The Database With Our Java Files or Classes, The Dropjava Utility Deletes Them. In the Example Below, The Class File That Was Loaded With Loadjava is removed. And Just Like Loadjava, It Will Drop Java Source, Java Classes, or Jar Files.

Select all

C:\oracle9i\bin>dropjava -u scott/tiger SimpleJava.class
Alternatively, Instead of Using The Command Line Utility, You Can Call A Package That Will Do The Same Thing:

Select all

SQL> call dbms_java.dropjava('... options...');
]

Dropjava Can Be Used to Delete Java Objects from The Database. Theese Java Objects May Have Been Loaded Into The Database Through The Loadjava Utility. The Next Utility Also Loads Code Into The Database; Only Instead of Java, IT Loads to PL / SQL Server Page (PSP).
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests