Compiling a java source in pl/sql developer - problems

Hi,
i'm using pl/sql developer and i created a javasource like this:
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
create or replace and compile java source named Test as
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;
import persistencia.JdbcDaoFactory;
* @author igor.simoes
public class ProcessoRelController {
the problem is: when i compile the source, an error is displayed(canno't find symbol) in the first line (import net.sf.jasperreports.engine.JRException;)
i wanna know how can i make the oracle JVM see the package(.jar) that contains net.sf.jasperreports.engine.JRException class, and the others classes in the import statement..
thank's
Igor Simões

Hi,
Refer the 'Implementing the report service' section in the following article: http://java.dzone.com/articles/java-reporting-part-2
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.export.JRXlsExporter;
public static Connection establishConnection()
Connection connection = null;
try
Class.forName("oracle.jdbc.driver.OracleDriver");
String oracleURL = "jdbc:oracle:thin:@localhost:1521:mySID";
connection = DriverManager.getConnection(oracleURL,"username","password");
connection.setAutoCommit(false);
catch(SQLException exception)
exception.printStackTrace();
return connection;
-Priyanka

Similar Messages

  • How to browse Java Source in PL/SQL Developer

    As I use PL/SQL Developer for developing, for the first time I've just tried to write and compile a java source.
    After compiling the java source succesfully, I can see it by selecting it from the system table USER_SOURCE where it's defined as TYPE JAVA SOURCE, but I'd like to know where and if it's possible to browse it in the left window list of the panel of PL/SQL Developer like it happens for Procedures, Packages, ... I mean is there a way to edit the java source created without selecting it from USER_SOURCE but in a better way as it's possibile for the procedures in PL/SQL Developer?
    Thanks

    Yes, It is possible. Check the option Tools->Browser. Then in the browser you can find it.

  • Unable to compile the java class in the SQL PLUS

    Hi Team,
    I am unable to compile the java class in the SQL PLUS in dev1 and dev2. It is giving the following error.
    But the same class get Compiled in the Toad(Tool) without any error and working fine. Could someone help me
    What to do for this for your reference ,Attaching the java class file.
    “ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 28.
    Was expecting one of:
    ----------------------Here is the Java class Code.....................
    create or replace and compile java source named "XXVM_ZipFileUtil_Ela"
    as
    import java.math.BigDecimal;
    import java.util.zip.Deflater;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import java.sql.*;
    import java.io.*;
    public class XXVM_ZipFileUtil_Ela
    public static oracle.sql.BLOB getZipFile(
    oracle.sql.CHAR zipFilePathCHAR, oracle.sql.CHAR zipFileNameCHAR,
    int fileBufferSize, int zipFileBufferSize,
    boolean deleteZipFile, java.sql.Array fileNames, java.sql.Array fileContents, java.sql.Array fileContentsLength)
    throws IllegalArgumentException, FileNotFoundException, IOException, java.sql.SQLException
    String zipFilePath = (zipFilePathCHAR == null) ? null : zipFilePathCHAR.stringValue();
    String zipFileName = (zipFileNameCHAR == null) ? null : zipFileNameCHAR.stringValue();
    String zipPathAndFileName = new String(
    new String(zipFilePath == null || zipFilePath == "" ? "/tmp/" : zipFilePath) +
    new String(zipFileName == null || zipFileName == "" ? System.currentTimeMillis() + ".zip" : zipFileName));
    byte[] buffer = new byte[fileBufferSize == 0 ? 100000000 : fileBufferSize];
    try
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    oracle.sql.CLOB[] fileContentsCLOB = (oracle.sql.CLOB[])fileContents.getArray();
    String[] fileNamesString = (String[])fileNames.getArray();
    BigDecimal[] fileContentsLengthNumber = (BigDecimal[])fileContentsLength.getArray();
    ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipPathAndFileName));
    zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
    for (int i = 0; i < fileNamesString.length; i++) {
    System.out.println(i);
    zipOut.putNextEntry(new ZipEntry(fileNamesString));
    InputStream asciiStream = fileContentsCLOB[i].getAsciiStream(1L);
    int asciiReadCount = asciiStream.read(buffer,0,fileContentsLengthNumber[i].intValue());
    zipOut.write(buffer, 0, fileContentsLengthNumber[i].intValue());
    zipOut.closeEntry();
    zipOut.close();
    byte zipFileContents[] = new byte[zipFileBufferSize == 0 ? 100000000 : zipFileBufferSize];
    FileInputStream zipIn = new FileInputStream(zipPathAndFileName);
    int byteCount = zipIn.read(zipFileContents);
    zipIn.close();
    byte returnFileContents[] = new byte[byteCount];
    System.arraycopy(zipFileContents,0,returnFileContents,0,byteCount);
    String returnFileContentsString = new String(returnFileContents);
    if (deleteZipFile)
    boolean deletedFile = (new File(zipPathAndFileName)).delete();
    oracle.sql.BLOB returnFileContentsBLOB = null;
    returnFileContentsBLOB = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
    returnFileContentsBLOB.open(BLOB.MODE_READWRITE);
    //OutputStream tempBlobWriter = returnFileContentsBLOB.getBinaryOutputStream();
    OutputStream tempBlobWriter = returnFileContentsBLOB.setBinaryStream(1);
    tempBlobWriter.write(returnFileContents);
    tempBlobWriter.flush();
    tempBlobWriter.close();
    returnFileContentsBLOB.close();
    return returnFileContentsBLOB;
    catch (IllegalArgumentException ex) {
    ex.printStackTrace();
    throw ex;
    catch (FileNotFoundException ex) {
    ex.printStackTrace();
    throw ex;
    catch (IOException ex)
    ex.printStackTrace();
    throw ex;
    catch (java.sql.SQLException ex)
    ex.printStackTrace();
    throw ex;

    860411 wrote:
    Hi Team,
    I am unable to compile the java class in the SQL PLUS in dev1 and dev2. It is giving the following error.
    But the same class get Compiled in the Toad(Tool) without any error and working fine. Could someone help me
    What to do for this for your reference ,Attaching the java class file.
    “ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 28.
    Was expecting one of:
    I believe the error message is clear and self-explanatory.
    ----------------------Here is the Java class Code.....................
    create or replace and compile java source named "XXVM_ZipFileUtil_Ela"
    as
    import java.math.BigDecimal;
    import java.util.zip.Deflater;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import java.sql.*;
    import java.io.*;
    public class XXVM_ZipFileUtil_Ela
    public static oracle.sql.BLOB getZipFile(
    oracle.sql.CHAR zipFilePathCHAR, oracle.sql.CHAR zipFileNameCHAR,
    int fileBufferSize, int zipFileBufferSize,
    boolean deleteZipFile, java.sql.Array fileNames, java.sql.Array fileContents, java.sql.Array fileContentsLength)
    throws IllegalArgumentException, FileNotFoundException, IOException, java.sql.SQLException
    String zipFilePath = (zipFilePathCHAR == null) ? null : zipFilePathCHAR.stringValue();
    String zipFileName = (zipFileNameCHAR == null) ? null : zipFileNameCHAR.stringValue();
    String zipPathAndFileName = new String(
    new String(zipFilePath == null || zipFilePath == "" ? "/tmp/" : zipFilePath) +
    new String(zipFileName == null || zipFileName == "" ? System.currentTimeMillis() + ".zip" : zipFileName));
    byte[] buffer = new byte[fileBufferSize == 0 ? 100000000 : fileBufferSize];
    try
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    oracle.sql.CLOB[] fileContentsCLOB = (oracle.sql.CLOB[])fileContents.getArray();
    String[] fileNamesString = (String[])fileNames.getArray();
    BigDecimal[] fileContentsLengthNumber = (BigDecimal[])fileContentsLength.getArray();
    ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipPathAndFileName));
    zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
    for (int i = 0; i < fileNamesString.length; i++) {
    System.out.println(i);
    zipOut.putNextEntry(new ZipEntry(fileNamesString));
    InputStream asciiStream = fileContentsCLOB[i].getAsciiStream(1L);
    int asciiReadCount = asciiStream.read(buffer,0,fileContentsLengthNumber[i].intValue());
    zipOut.write(buffer, 0, fileContentsLengthNumber[i].intValue());
    zipOut.closeEntry();
    zipOut.close();
    byte zipFileContents[] = new byte[zipFileBufferSize == 0 ? 100000000 : zipFileBufferSize];
    FileInputStream zipIn = new FileInputStream(zipPathAndFileName);
    int byteCount = zipIn.read(zipFileContents);
    zipIn.close();
    byte returnFileContents[] = new byte[byteCount];
    System.arraycopy(zipFileContents,0,returnFileContents,0,byteCount);
    String returnFileContentsString = new String(returnFileContents);
    if (deleteZipFile)
    boolean deletedFile = (new File(zipPathAndFileName)).delete();
    oracle.sql.BLOB returnFileContentsBLOB = null;
    returnFileContentsBLOB = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
    returnFileContentsBLOB.open(BLOB.MODE_READWRITE);
    //OutputStream tempBlobWriter = returnFileContentsBLOB.getBinaryOutputStream();
    OutputStream tempBlobWriter = returnFileContentsBLOB.setBinaryStream(1);
    tempBlobWriter.write(returnFileContents);
    tempBlobWriter.flush();
    tempBlobWriter.close();
    returnFileContentsBLOB.close();
    return returnFileContentsBLOB;
    catch (IllegalArgumentException ex) {
    ex.printStackTrace();
    throw ex;
    catch (FileNotFoundException ex) {
    ex.printStackTrace();
    throw ex;
    catch (IOException ex)
    ex.printStackTrace();
    throw ex;
    catch (java.sql.SQLException ex)
    ex.printStackTrace();
    throw ex;
    The last two lines above should be
    /Srini

  • How to compile a java source from a java program

    Hi .
    I would like to know how to compile my java source from inside an execution of a java program.
    Is there another way than rather use :
    Runtime.getRuntime().exec("javac myFile"); ?

    you can and cann't use the source code of javac... or maybe use jikes...

  • No oci jdbc11 in java.librar.path for SQL Developer 2.1 EAI

    Just migrated my connections from 1.5.5 and tested.
    I have the one with the JDK built-in.
    I browsed to it and it comes up.
    However when I access a connection I get the below:
    no oci jdbc11 in java.librar.path for SQL Developer 2.1 EAI

    I got it to work using a BASIC call instead of my normal TNS call.
    We use MS SMS to package the Oracle client and SQL Developer and push it out to users so we don't have people visiting desktops. Also, we use OID to store the entries instead of a tnsnames file so that we don't have to maintain a TNSNAMES file.
    I am testing 2.1 as we would eventually upgrade when it goes GA.
    2.1 seems to be built on Oracle 11g. Issue will be that since 99% of our databases are 10gr2 as well as 100% of our client population will be be forced to upgrade the Oracle client to use 2.1 as we do today without lots of changes for the end user?
    We don't broadcast the information the average user requires for a BASIC connection so that is out for non technical users..
    We have SQL Developer 1.5.5 right now and this is not and issue.
    Hopefully, this will be resolved during EAI for 2.1.

  • Running/Compiling *.java file in Oracle Sql Developer

    I want to compile/run java 5.0 files in Oracle sql developer1.1.2.25 on Fedora 5 platform.
    I have added javac as an enternal tool to compile java programs. Tools-->External Tools-->New
    I have also added java: /usr/java/jre1.5.0_10/bin/java as an external tool to run the complied programs
    I am able to compile the java programs, but i am not able to run them.
    I am providing ${file.name.no.ext} as an argument to java.
    Java-Log Output is:
    /usr/java/jre1.5.0_10/bin/java Writer2
    Exception in thread "main" java.lang.NoClassDefFoundError: Writer2
    However, if i run the same program in Linux terminal, i get the correct output:
    [root@localhost java]# which java
    /usr/java/jre1.5.0_10/bin/java
    [root@localhost java]# /usr/java/jre1.5.0_10/bin/java Writer2
    12
    howdy
    folks
    How can i make Oracle Sql Developer run the java program?

    I will echo the use jdev comment..
    Regardless, you may want to check the execute in directory.. or add a -cp parameter.
    Eric

  • Problem in deploying Java Extension to ORacle SQL Developer

    Hi all,
    I have developed a simple Java extension using Oracle Jdeveloper. This extension creates a preference in Tools->Preferences.
    I have deployed it on Jdeveloper and it works fine. But when I deploy it on Oracle SQL Developer its functionality does not work
    I am using JDeveloper 11.1.1.4
    and Oracle SQL Developer 3.2.20.09 (Latest Version).

    Hello,
    You are giving few informations. Is the extension listed in the extensions tab in the 'About' tab? Are you able to deploy any extension to SQLD?
    Joop

  • How to compile in Java Source???

    Hello,
    I'm studying a way to compile java files to class files in the java source. I have use the sun.tools.javac.Main to do this, but I have noticed that it aint recomended to use. I also wan't to get the possible errors from the compiler (if java file was wrongly made). The problem using the sun.tools.javac.Main is that it won't guarantee that it works in every platform or in future releases of JDK. Does the JDK 1.4 even support it? (My IDE environment prevents to use JDK 1.4). So the question is: is there a way to compile on the fly (to memory or to class files)? Do I really have to run some external process that compiles the file and then try to get somehow possible errors? That seems to me litle too indecent to use. Any suggestions?
    Thanks,
    Petri Tuomaala

    Hi guys,
    I have also needed to compile Java source from within a Java application. Here is the best solution I came up with:
    Process proc = Runtime.getRuntime().exec( "
    C:\\Temp\\Jikes -bootclasspath C:\\jdk\\jre\\lib\\rt.jar C:\\Java\\com\\sts\\utility\\Utility.java" );
    BufferedReader br = new BufferedReader( new InputStreamReader( proc.getErrorStream() ) );
    String line = null;
    while( (line = br.readLine()) != null ) {
    System.out.println( line );
    proc.waitFor();
    I used Jikes http://oss.software.ibm.com/developerworks/opensource/jikes/ because it compiled my source quicker than Javac did - 250 millseconds for Jikes compared to 2750 milliseconds for Javac.

  • Java files open in SQL Developer instead of JDeveloper

    JDEV 10.1.3
    Windows XP
    When I double click a java file, it opens in SQL Developer instead of JDeveloper.
    When I right click a java file, and select 'Open With'->jdeveloper, the java file always opens in SQL Developer instead of JDeveloper.
    I've tried browsing and choosing all the different executables: jdevw.exe, jdev.exe, jdeveloper.exe. No luck on any of them.
    Any help here? Thanks!

    Thanks, but that didn't work. I noticed that the "open" action for java file extension is, in fact, set to use the jdeveloper.exe (I also tried jdev.exe and jdevW.exe).
    Note: even if I run the jdeveloper.exe on the command line, with a java file as the argument, the java file still opens in SQL Developer, if it is running. (Otherwise it uses JDeveloper)
    It's as if JDeveloper and SQL Developer are somehow coupled in the opening of files.

  • Missing Java Classes in Oracle SQL Developer

    Hello,
    I'm pretty new to Oracle (As a DBA) and very new to Java. I just refreshed our training environment and after the refresh, noticed under the Java folder within Oracle SQL Devloper that the Java Classes were missing.
    Can someone tell me how I can repopulate these classes?
    Any information would be much appreciated.
    Thank you.

    Thank you K,
    The Java Classes are not present under the SYS user and I'm not sure how to get them back. They do exist within our production and development environments.

  • Error "no ocijdbc11 in java.library.path" in SQL Developer 4

    Hi!
    I have just installed the latest version of Oracle 12c and the latest SQL Developer (4.0.0.12). I have also JDK 7u25 installed. I run everything on Windows 7 64bit. When I create a local connection in SQL Developer and test or try to connect I get the error: no ocijdbc11 in java.library.path
    If I try the exact same thing in SQL Developer 3.2.2 (the one bundled with the latest Oracle 12c) it works fine. In both versions of SQL Developer I have done no configuration and all the settings are the defaults.
    I have read all the posts that relate to this error message, but they are all based on older versions or other platforms.
    Is there a problem in the default configuration of SQL Developer 4 or a compatibility problem with Oracle 12c? Any ideas of how to fix this?
    When I compare the properties of the two versions of SQL Developer I see that most of them are identical, but the java.library.path points to the sqldeveloper/bin directory in v4 and to the sqldeveloper root folder in v3. I don't know if that is significant.
    Also the setting "Use OCI/Thick Driver"  under "Database: Advanced" is unchecked, so it seems strange that it tries to use it anyway.
    /nikos

    Nikos:
    You should search that ocijdbc11 is installed in a path similar to C:\Oracle32bit\product\11.2.0\client32bit\bin and that this path (or C:\Oracle32bit\product\11.2.0\client32bit) is in your java.library.path.
    If you click on Help|About and the Extensions tab you will see a list of some of these.
    Click on the Export button and copy the contents to a file or clipboard.  Open the file (or Ctrl/V) in an editor and search for java.library.path.  This is the list of ;-separated folders that SQL looks in. Ensure that this list includes the one where your ocijdbc11 was found.
    HTH

  • Forte compile error java source files must have a .java suffix

    Hello Guru's,
    I am using Forte for Java release 2.0 build 1160, and Java SDK 1.3.1.
    When I try to compile a project in Forte I get the following error :
    "fastjavac: java source files must have a .java suffix C:\Program"
    I have looked at the source files and they do hav .java suffix!
    If this is not the correct form can someone point me in the right direction. If this is a correct forum then help is very much appreciated.
    Cheers...Harki

    Hi,
    Try to compile like this:
    javac yourfile.java
    Hope this helps you.
    Cheers.....Dinesh

  • Which Java download needed for SQL Developer

    I am running Windows 7 Professional, (64) and have downloaded and unzipped sqldeveloper64-3.2.20.09.87-no-jre.zip. When I execute sqldeveloper.exe I enter this path to the Java JDK: C:\Program Files (x86)\Java\jdk1.6.0_37\bin\java.exe and a message responds:
    Oracle SQL Developer
    Unable to launch the Java Virtual Machine Located at path C:\Program Files (x86)\Java\jdk1.6.0_37\bin\msvcr71.dll
    I am going with a 32 bit version of Java because I use Chrome (32) and the 1.6 JDK because the SQLDev info says it must be south of 1.7. The last time I installed SQLDev getting the right version of Java was a big pain too. Could someone give me then name of the package to download and the URL to access it?
    The jdk I installed: jdk-6u37-windows-i586.exe.
    I would have hoped that Oracle bundled the SQLDev with the Java.
    Your help would be much appreciataed.
    Edited by: user606303 on Nov 30, 2012 2:34 PM
    Edited by: user606303 on Nov 30, 2012 2:35 PM

    Hi,
    I would have hoped that Oracle bundled the SQLDev with the Java.Note that the very first download offered is Windows 32-bit - zip file includes the JDK1.6.0_35 (also 32-bit). See here...
    http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
    Since you opted to
    downloaded and unzipped sqldeveloper64-3.2.20.09.87-no-jre.zipyou are expected to specify a 64-bit JDK, which gets installed to
    C:\Program Files\Java\jdk1.6.0_37\binrather than
    C:\Program Files (x86)\Java\jdk1.6.0_37\binThe basic rules:
    1. 32-bit JDK/App on 32-bit Windows;
    2. 32-bit JDK/App (runs under WoW64) or 64-bit Java/App on 64-bit Windows.
    Regards,
    Gary
    SQL Developer Team

  • SQL Developer Problems and Feature Requests

    I’m in the process of comparing TOAD to SQL Developer and noticed the following bugs/features in SQL Developer:
    1. An error message is correctly displayed when a database password has expired, but there isn’t a way to go back into the database and change the password for that account. Can this critical feature be added?
    2. There is no option to connect as sysdba or sysoper.
    3. In the “New / Select Database Connection” window, I get the following error when double clicking on an existing connection defined using a TNS Network Alias: Status: Failure – no ocijdbc10 in java.library.path. Any ideas? Connection was initially defined using the Network Alias button. I can connect under the “Connections” window, but not in the “New / Select Database Connection” window. Any ideas?
    4. When displaying data in a table, the filter is not user friendly. You need to enter column names and the correct SQL syntax. It also does not allow you to cut and paste in column names. It would be very helpful/useful if it was more user friendly (GUI based) such as how Sorting is done and/or how it is done in TOAD.
    5. When viewing referential constraints on a child table, it shows you information on the parent, but not if the parent is a child to something else. If you were a parent, it would be nice to see all child and their children’s children. TOAD does a nice job showing parent and child tables via a tree structure.
    6. Comparing metadata between schemas would also be a very nice feature.
    I’m not sure if this is the place to post this but thought I would start here. Any feedback would be appreciated.
    Thanks,
    Ken

    1: You can always right click and have it open an sql*plus window and that will prompt for the new password. But I do agree that support for this should be built in.
    2: This is a developer tool.. Use OEM for the dba stuff. I think that the worst thing that could happen to SQL Dev is to try to become everything for everyone like TOAD tries to.
    3: Search the forum. Other users ran into this and I believe there is a workaround.
    4: I like the current filtering on tables. So much simpler than most tools. I do agree that maybe there should be an advanced button with a filter builder and agree that column names should be copyable but would cringe if the free-form field disappeared. How many other tools can you write an inline query into the table viewer? Great feature IMHO
    Eric

  • Re: SQL Developer Problems and Feature Requests

    "no ocijdbc10 in java.library.path"... What should i do with it?
    I get it on the simplest of operations: changing (in fact setting) the connection password for the existing connection (defined by TNS/Connect Identifier). Oh, yes, there're workarounds, particularly export-edit-import, but don't you find it a bit weird?
    BTW, i do not find a Save button there either, won't it be just appropriate? (Not allways a connection one's setting up for is already available on the spot).
    Environment : OS: RHEL4, SQL Developer version: 1.0.0.15.57 (at least that's what About says), java - just stright form Sun, 1.5.0_09_b01; this was one i told SQL Developer to use. The default java in the system is Red Hat 3.4.6-3, though, i haven't changed that - should i?
    TIA,
    Uldis

    I have had this issue with the Connection window with the TNS Connection Identifier method, but it appears to be related in some way to the other Oracle installations you have. For me (I am on Win XP), the error went away after installing the Oracle 10g client with Discoverer 10g Administrator. It then came back when I needed to rebuild my computer and installed my Oracle clients (I have three for various different products) in a different order, but was fixed that time by reordering my Oracle Homes via the Universal Installer and making my 10g Client first (Oracle Universal Installer -> Installed Products -> Environment)
    Alternatives are to switch back to the TNS Network Alias method to record the password (unfortunately, even when entering the connection as a Network Alias it is saved as a Connection Identifier) or to just use the Basic tab instead of the TNS tab.

Maybe you are looking for