Can I use JDev eSDK to parse Oracle SQL?

Is it possible to use oracle.javatools.db and oracle.javatools.db.sql to parse a sql?
import oracle.javatools.db.*;
import oracle.javatools.db.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
public class TestParser
public static void main(String[] args)
Connection conn = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:sample", "sample", "sample");
Database db = DatabaseFactory.findOrCreateDatabase("sample", conn);
Schema schema = db.getDefaultSchema();
SQLQuery sql = SQLQueryBuilderFactory.createQuery(db, schema, args[0]);
catch (Exception e) {
e.printStackTrace();
} finally {
try {
     if (conn != null)
     conn.close();
catch (Exception se) {
Now if run it with a select * from foo, the program will pass, but as soon as I list column names in the select list, like "select bar from foo", the program will fail with the following stack trace:
Exception in thread "main" java.lang.StackOverflowError
at java.lang.StringBuffer.<init>(StringBuffer.java:80)
at oracle.jdbc.dbaccess.DBError.getMsgKey(DBError.java:1358)
at oracle.jdbc.dbaccess.DBError.findMessage(DBError.java:786)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:176)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.getMetaData(OracleConnection.java:1593)
at oracle.javatools.db.AbstractDatabase.getConnection(AbstractDatabase.java:171)
at oracle.javatools.db.DatabaseFactory.createConnection(DatabaseFactory.java:149)
at oracle.javatools.db.AbstractDatabase.reconnect(AbstractDatabase.java:197)
at oracle.javatools.db.AbstractDatabase.getConnection(AbstractDatabase.java:175)
... Repeat the last three lines
Can someone help me with this issue?
Thanks,

I think I understand the issue as any call to oracle.javatools.db.Database would close the java.sql.Connection it contains and thus causing later calls to try to reconnect and for whatever reason, reconnect always fails.
My question is why is the Connection object closed in the first place?

Similar Messages

  • Can i use Jdev freely because of Oracle embedded license

    Hi,
    In our company we have one Avaya IVR v8 that contains a Oracle embedded.
    A college told us that if we have a license of the database we have the right to use other JDev without paying royalties. Is this true?
    Thanks very much,
    Lorenzo Jiménez

    Just FYI, even it did come included with the regular database, you would not be licensed to use it according to the terms of the embedded license (as far as I can tell).
    We have a third party application that has an embedded license, and we were told we can only read from the reporting views set up.

  • Can we use DB REPLAY feature in oracle 10.2.0.3 as I got in few documents that this feature is available in 10..2.0.4 onwards

    can we use DB REPLAY feature in oracle 10.2.0.3 as I got in few documents that this feature is available in 10..2.0.4 onwards

    The subtitle of this forum is: Do Not Post Product-Related Questions Here
    Mod: locking

  • Can i Use two qery hints in one SQL(Oracle)?

    Hi,
    Can i Use two Query hints in one SQL(Oracle)? USE_HASH and No_Merge
    Thanks

    user10916886 wrote:
    Can I use like
    /*+ USE_HASH(X,Y) NO_MERGE(X) */
    will this work?Not really: NO_MERGE relates to mergeable views, not base tables. So whilst the USE_HASH may result in a hash join between the tables X and Y, USE_MERGE will be ignored for X.
    As hoek says, however, HINTs should be a last resort only, and if they're to be used at all you're best to stay with those that don't involve explicit objects, like ALL_ROWS, FIRST_ROWS_10, etc.
    user10916886 wrote:
    Im my database, if i don't use query hints. The expalin plan uses Nested loops, hence the query takes a lot of time.You would be better trying the ALL_ROWS hint here, instead of USE_HASH.
    Edit
    The optimizer, however, will have chosen NESTED LOOPs where it did because it believed that to be the most efficient data retrieval path with the information that it had to hand. So, if your statistics are comprehensive and up-to-date, yet the optimizer is continually opting for the less efficient plan, there's something else wrong, and HINTs are only masking that problem in the short-term.

  • Wether "CREATE TABLE"  can be used in storage procedure of Oracle?

    I am migrating MS SQL 2000 Database to Oracle 8.1.7. But I encounter a trouble, the defind sentences of temporary table in storage procedure of MS SQL can't be migrate to oracle.
    I have try two kinds of syntax to defind temporary table, but both of them can't pass the compiler of pl/sql. Two syntax that I have try as follows:
    1.CREATE TEMP TABLE chanp1(chanpid varchar(50))
    2.CREATE GLOBAL TEMPORARY TABLE chanp1(chanpid varchar(50))
    Now, I want to know whether "CREATE TABLE" sentence can be used in storage procedure of Oracle.

    you could use EXECUTE IMMEDIATE (Oracle8i above) or DBMS_SQL pacakge to do dynamic SQL.
    since you are already on Oracle8i 8.1.7 using EXECUTE IMMEDIATE may be more easy.

  • Can i use App schema from another Oracle database.

    Hi everyone,
    can i use application schema from another Oracle database and how can we do this. the reason is that current database where apex is installed is get very slow because of the size of database and application usage.
    Regards,
    Kashif.

    user10485983 wrote:
    Please update your forum profile with a real handle instead of "user10485983".
    can i use application schema from another Oracle database and how can we do this. the reason is that current database where apex is installed is get very slow because of the size of database and application usage.
    You can (using database links), but this will generally result in even poorer performance (unless by "another Oracle database" you mean using RAC?)
    It sounds more like you either need to upgrade your systems, or refactor your applications to have a smaller performance footprint.

  • Can i use case in query in oracle form 6i

    sir can i use case in query in oracle form 6i
    such as
    select empno, case when deptno=10 then dptno end from emp;
    please gice me

    Hello,
    Does this code compile ?
    If not, I'm afraid that the PL/SQL engine of Forms6i does not recognize this syntax.
    Francois

  • [svn] 2216: Changed InterfaceCompiler to public so that it can be used directly for mxml parsing by other tools .

    Revision: 2216
    Author: [email protected]
    Date: 2008-06-24 13:34:15 -0700 (Tue, 24 Jun 2008)
    Log Message:
    Changed InterfaceCompiler to public so that it can be used directly for mxml parsing by other tools. Also change parseMxml to public.
    Reviewed by: Paul
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java

    Before I read this helpful post, I changed my Google search key words from "change location Firefox profiles" to "change path Firefox Profiles" and found this link: http://kb.mozillazine.org/Thunderbird_:_FAQs_:_Changing_Profile_Folder_Location. This brought me to the article "Moving Your Firefox Profile" which answered my question. Your suggested link would have ultimately led me to the same solution.
    The problem was that I had copied my Firefox profile to the new location and then modified "profiles.ini" to point to the new location and saved it there as a replacement to the original "profiles.ini" that I had renamed "profiles.iniOld." Even though I had changed "IsRelative" from "=1" to "=0" I got error messages. I had used this procedure successfully before, but it would not work this time. When I used Profile Manager to move the Firefox Profiles everything worked fine the first time I tried it, and it took only a few minutes.
    Thank you, cor-el.

  • How to use a Sybase table in Oracle SQL statement?

    How to use a Sybase table in Oracle SQL statement?
    Sybase version : 11.9.2.4
    Oracle version : 10.2.05
    Thanks.

    user12088323 wrote:
    How to use a Sybase table in Oracle SQL statement?
    Sybase version : 11.9.2.4
    Oracle version : 10.2.05
    Thanks.Any Oracle client connected to the Oracle database can access Sybase data through the <font style="background-color: #FFFFCC">Database Gateway for Sybase</font> (it requires an additional license) or the <font style="background-color: #FFFFCC">Database gateway for ODBC</font> (it's free).
    The Oracle client and the Oracle database can reside on different machines. The gateway accepts connections only from the Oracle database.
    A connection to the gateway is established through a database link when it is first used in an Oracle session. In this context, a connection refers to the connection between the Oracle database and the gateway. The connection remains established until the Oracle session ends. Another session or user can access the same database link and get a distinct connection to the gateway and Sybase database.
    Database links are active for the duration of a gateway session. If you want to close a database link during a session, you can do so with the ALTER SESSION statement.
    To access the Sybase server, you must create a <font style="background-color: #FFFFCC">database link</font>. A public database link is the most common of database links.
    SQL> CREATE PUBLIC DATABASE LINK dblink CONNECT TO
    2  "user" IDENTIFIED BY "password" USING 'tns_name_entry';
    --dblink is the complete database link name.
    --tns_name_entry specifies the Oracle Net connect descriptor specified in the tnsnames.ora file that identifies the gatewayAfter the database link is created you can verify the connection to the Sybase database, as follows:
    SQL> SELECT * FROM DUAL@dblink;
    Configuring Oracle Database Gateway for Sybase
    <font style="background-color: #FFFFCC">{message:id=10649126}</font>

  • Can I use the `deny` statements is a SQL database

    I have a web-app that I will need to scale to large proportions. In this web-app, I have a database in which some clients should not have access to specif tables. Can I use `deny` statements on an Azure SQL databases? Like this:
    deny select on a_table to a_user

    Hi James,
    Yes you can use DENY statements. Please see
    this link for more information on the usage of DENY statements.
    Thanks
    Silvia Doomra

  • Can i use a environment variable inside a *.sql file?

    Hello,
    I want to create a external table.
    So i am using the command
    create or replace directory abc as 'C:\folder'.... inside a sql file.
    Now i want the path "C:\folder" to be dynamic as i am using this path in many other places also inside the sql file.So i thought to create a environment variable and put this value there.I tried using as %PATH% but it gives error..... where %PATH%=C:\folder.
    Can i use a environment variable inside a *.sql file?
    But how to do that or is there any other way.
    Thanks
    Swapna
    Edited by: user11018268 on Feb 19, 2010 1:03 AM

    user11018268 wrote:
    Actually what i want is the path "C:\folder" is not fixed it can be anything which i may not know the user may decide it later. Not supported. A directory object refers to a specific physical location (directory/folder) on a file system. Not a path.
    You can work around it by (creating and) using a function (running under a super user schema with authid definer privs). The caller (e.g. schema scott ) calls it with a physical path. E.g. GetDirectoryObject( 'C:\folder\2010\feb\week4' ).
    This function determines if there is an existing directory object for the path. If not, it uses a wildcard search to determine if there are any directory objects for parents in the path (e.g. for C:\folder\2010\feb or C:\folder\2010 or C:\folder ).
    If it finds a directory object, it interrogates the data dictionary to determine if the caller, schema scott for example, has read/write access on that directory object. If it has, it creates a new directory object and grants the caller read/write access to it. The function then returns the name of the directory object to the caller.
    The caller thus do not deal directly with directory objects. The function returns the object name given a physical path as input. Also, only a single base directory needs to be created (e.g. for C:\folder ) and access granted to the schema on it. Any sub-directory in that base directory can now be dynamically accessed by the schema.

  • App developed using Jdev 3.2 and oracle 9.2: oracle internal error

    Good morning,
    I have developed a JSP application using Jdeveloper 3.2.3.
    Everything works fine under Oracle 8.x.
    One of our customers, a few days ago, decided to migrate to oracle 9.2, but he can't use our application anymore, because every time a javabean accesses the database, Oracle returns:
    ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], [], [], [], [], []
    What I should do, in order to let my customer use my JSP application under any ctual version of Oracle?
    1) Have I to install a newer version of Jdeveloper and simply recompile my application?
    2) Have I to download a special package to deliver to the customer using Oracle 9.2?
    3) Anything else?
    Thank you for your advices.

    Giambattista,
    Check your JDBC driver version.
    You will get this ORA-600:[ttcgcshnd-1] error if you have the JDBC driver 8.1.7.1 or earlier, and you try to connect to an Oracle 9.0.1 or later database.
    So, your app will work when connected to an Oracle8i database, but fail when trying to Oracle9i.
    The solution is to upgrade to the patched 8.1.7.2 JDBC driver, or better yet, use the latest JDBC driver that comes with JDeveloper 9.0.3 (which is JDBC 9.0.1 version).

  • Can We use FDM as ETL tool between SQL and Oracle

    I want to use FDM as ETL tool between SQL and Oracle. Can it be possible. I didn,t found any target adapter for oracle database.My source system is SQL and Target system is Oracle database.
    Rahul
    Edited by: user12190125 on Nov 9, 2009 4:23 AM

    Rahul,
    I believe this is possible to do, but not an easy one and there are a few considerations:
    How much data are you processing? FDM has a lot of features which support the business process. While this is great for users and audit trail etc. it slows down performance if you want to process a lot of data. It also depends on the type of mappings you use (Like mappings are slower than explicit mappings).
    How familiar are you with VBScript? There is no explicit target adapter for Oracle, but there is a data mart adapter which can be used for anything. You have to implement everything yourself though, mainly the Export and Load actions. In there you will also have to handle the the connections to the MSSQL and Oracle databases.
    Check the data mart adapter and see if you feel comfortable with defining the vb code in there. There are reasons for and against this approach. ODI would probably be the better choice unless you really need to have FDM's process support.
    Regards,
    Matt

  • How can I use the FTP server on Oracle XML DB for plain text files?

    Hi,
    I need to generate comma separated files for download via FTP. The files are generated from Oracle Table data and should be published on a FTP Server. Would it be able to use the FTP Server on Oracle XML DB?
    If not, any suggestions?
    Thanks
    Frederik Christensen

    You can create a temporary CLOB with your CSV content, and then folder the CLOB into the XDB repository with DBMS_XDB.createRESOURCE()...
    This would work fine....

  • MS Access is unable to parse Oracle SQL

    I wish to execute an outer join query in Reports 3.0 using MS
    Access at back end. Since MS Access has a different syntax of
    outer query than Oracle Sql, it is unable to parse it.
    What could be the alternative or probable solution to it.
    null

    Hi,
    Unless, you are writing dynamic queries, you might want to
    define your outerj SQL in MS Access and then issue a simple
    SELECT in Reports against the outerj MS Access query (to MS
    Access this query is just another pseudo table).
    TP.
    Bramanathan K (guest) wrote:
    : Rajeev Grover (guest) wrote:
    : : I wish to execute an outer join query in Reports 3.0 using
    MS
    : : Access at back end. Since MS Access has a different syntax
    of
    : : outer query than Oracle Sql, it is unable to parse it.
    : : What could be the alternative or probable solution to it.
    : Instead of outer join why don't you try with Union, I think
    Union
    : will go with both
    null

Maybe you are looking for

  • Crystal Report not working when posting the report to the Crystal Server.

    Hi All,   I created a report using Crystal Reports 2008 with two ODBC connections (User DSN's). When I run the report in Crystal Reports (where I originally created it) it runs fine with no problems.    I am now trying to load it on Crystal Server 20

  • Resetting a front panel button

    I'm using a record button on the front panel, in "switch when pressed" mode. I run the VI, then press the record button. After stopping the VI, the button stays on. How do I make the button automatically return to the OFF state when running the VI th

  • Soap Fault mapping issue

    Hi, I have a synchronous scenario of (request) Proxy --> XI --> SOAP and (response) SOAP --> XI --> Proxy.  I am having an issue returning the application soap faults back to the sender system.  When I enter invalid data while testing this webservice

  • Export sequence of still images (JPGs, TIFFs) from FCP timeline into DVD without interlaced issues using Compressor

    Hi, How to export a sequence with stills (jpg) into a DVD format by using Compressor without having the interlaced issue on the outcome? The stills in the Canvas look crisp but once exported to DVD format, the outcome images look interlaced. How can

  • Avoiding if/else in a JTree

    I have Tree in which each TreeNode behaves differently. Suppose, if I right-click on Node1, it will show a popup menu and if i right-click on Node2, it will open a new Frame. Currently, what I am doing is if (theTree.getSelectionMode.getSelectedItem(