Java Class to connect to oracle

Hi all,
I am a new in Java in database...
I have written a java class to connect to oracle and to get some information from the databse. In the class i use the driver oracle.jdbc.driver.OracleDriver.
When I exeute the code in JDeveloper it works fine.
I have loaded the classes to database (10gR2), have written the wrapper function. That all was compilled without errors.
But when I execute the wrapper function I get in SQL*Plus my custom Error-Message from Java Code "Not able to connect to oracle".
The oracle driver classes are owned by sys. Should SYS grant to the user any special rights with dbms_java.grant_permission?
Or is it any other way to connect to the database, in which the java classes are loaded? The user is connected with SQL*Plus. The Java Classes are owned by the user. Should I use JDBC to connect to the same database?
Best regards,

Hi
You don't need to re-connect... Have a look here...
http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/ssid.htm#i1024903
HTH
Chris

Similar Messages

  • Accessing MS Sql Server with Java classes - problem connecting to socket

    I found an example at this location which uses java classes to connected to MS Sql Server.
    http://search400.techtarget.com/tip/1,289483,sid3_gci1065992,00.html
    --bummer - it is a login location - so I will include the article
    Anyway, the example is using Websphere, but I am still on Jbuilder (will get wsad soon). So I planted the classes from the example in
    C:\Borland\JBuilder\jkd1.4\jre\lib\ext\...the classes
    Then I copied the code from the example to my jpx project and got an error that it could not connect to the socket. The only thing I changed in the code was the connection string:
    --original string from example:
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://1433", "");
    I was getting an error with the 2 argument version of DriverManager - and the second argument here was empty (properties argument). Here was my connection string:
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://Myserver:1433;User=sa;Password=");
    I am only using the 1 argument version of DriverManager. Note that the password=" is blank because my RnD workstation is standalone - no one accesses the sql server except me - so no password. I also left out the last semicolon I noticed. Any suggestions appreciated how I could fix this.
    Thanks
    source of article:
    http://search400.techtarget.com/tip/1,289483,sid3_gci1065992,00.html
    iSeries 400 Tips:
    TIPS & NEWSLETTERS TOPICS SUBMIT A TIP HALL OF FAME
    Search for: in All Tips All search400 Full TargetSearch with Google
    PROGRAMMER
    Sample code: Accessing MS SQL Server database from the iSeries
    Eitan Rosenberg
    09 Mar 2005
    Rating: --- (out of 5)
    Nowadays with the help of Java the iSeries can be integrated with other databases quite easy. This tip shows you how. The code included here uses the free Microsoft driver that can be downloaded from here. (SQL Server 2000 Driver for JDBC Service Pack 3)
    If your SQL server does not include the Northwind Sample Database you can find it here.
    http://www.microsoft.com/downloads/details.aspx?familyid=07287b11-0502-461a-b138-2aa54bfdc03a&displaylang=en
    The download contains the following files:
    msbase.jar
    mssqlserver.jar
    msutil.jar
    Those files needs to be copied to the iSeries directories (/home/r_eitan/ExternalJARs).
    Here's the directory structure (on the iSeries) for this sample:
    /home/r_eitan/ExternalJARs - Microsoft files (msbase.jar,mssqlserver.jar,msutil.jar)
    /home/r_eitan/JdbcTest02 - My code (Main.java,Main.class)
    The Java code
    import java.sql.*;
    import java.io.*;
    class Main {
    * Connect to Microsoft SQL server and download file northWind.products as tab
    * seperated file. (products.txt)
    public static void main(String args[]) {
    try {
    PrintStream outPut = new PrintStream(new BufferedOutputStream(new FileOutputStream("products.txt")));
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    //Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://1433", "");
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://Myserver:1433;User=sa;Password=");
    System.out.println("Connection Done");
    connection.setCatalog("northWind");
    String sqlCmdString = "select * from products";
    Statement statement = connection.createStatement();
    ResultSet resultSet = statement.executeQuery(sqlCmdString);
    ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
    int columnCount = resultSetMetaData.getColumnCount();
    // Iterate throught the rows in resultSet and
    // output the columns for each row.
    while (resultSet.next()) {
    for (int index = 1; index <=columnCount; ++index)
    String value;
    switch(resultSetMetaData.getColumnType(index))
    case 2 :
    case 3 :
    value = resultSet.getString(index);
    break;
    default :
    value = """ + resultSet.getString(index) + """;
    break;
    outPut.print(value + (index < columnCount ? "t" : ""));
    outPut.println();
    outPut.close();
    resultSet.close();
    connection.close();
    System.out.println("Done");
    catch (SQLException exception)
    exception.printStackTrace();
    catch (Exception exception)
    exception.printStackTrace();
    --------------------------------------------------------------------------------------------------

    My guess is that the server's host name isn't right. It necessarily (or even usually) the "windows name" of the computer. Try with the numeric IP address instead (type "ipconfig" to see it).
    First aid check list for "connection refused":
    - Check host name in connect string.
    - Check port number in connect string.
    - Try numeric IP address of server host in connect string, in case name server is hosed.
    - Are there any firewalls between client and server blocking the port.
    - Check that the db server is running.
    - Check that the db server is listening to the port. On the server, try: "telnet localhost the-port-number". Or "netstat -an", there should be a listening entry for the port.
    - Try "telnet serverhost the-port-number" from the client, to see if firewalls are blocking it.
    - If "telnet" fails: try it with the numeric ip address.
    - If "telnet" fails: does it fail immediately or after an obvious timeout? How long is the timeout?
    - Does the server respond to "ping serverhost" or "telnet serverhost" or "ssh serverhost"?

  • The java class is not found:  oracle/aurora/util/Wrapper

    When I try and load my Java class file using 'loadjava' into Oracle I'm getting the error:
    The java class is not found: oracle/aurora/util/Wrapper
    What is causing this?

    On which machine should ORACLE_SID be set to solve this problem, server or client. I run into this error when run loadjava

  • The java class is not found:  oracle.apex.APEXExport

    Hi,
    when i run java oracle.apex.APEXExport
    i have the error
    The java class is not found: oracle.apex.APEXExport
    CLASSPATH=/opt/ora/admin/Apex_Backup/class/classes12.zip:/opt/ora/admin/Apex_Backup/APEXExport.class
    also
    CLASSPATH=/opt/ora/admin/Apex_Backup/class/classes12.zip
    causes the error
    Can somebody help he out of this?

    Hello,
    Take a look at my blog post on Backing Up Your Applications, available here -
    http://jes.blogs.shellprompt.net/2006/12/12/backing-up-your-applications/
    I run through all the steps you need to do to get it working.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Problem Using Java Store Procedure (java class) to connect to sybase

    Hi, I'm trying to use a java class to obtain some data from another databse (SYBASE) in another server.. here are the code
    package pkg;
    import com.sybase.jdbcx.SybDriver;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class clsTest
    public clsTest()
    public static void main(String[] args)
    testConn("");
    private static void testConn()
    Connection _con= null;
    String host = "XXX";
    String port= "XXX";
    String url = host + ":" + port;
    Statement _stmt= null;
    int timeout = 10;
    boolean needsReconnect = true;
    SybDriver sybDriver = null;
    try
    Class c = Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
    sybDriver = (SybDriver) c.newInstance();
    DriverManager.registerDriver((Driver) sybDriver);
    catch (Exception e)
    System.err.print("Unable to load the Sybase JDBC driver. "
    + e.toString());
    e.printStackTrace(System.out);
    if (needsReconnect)
    try
    if (_con != null)
    _con.close();
    url="jdbc:sybase:Tds:BDSERVER:PORT/BD";
    System.err.println("Trying to connect to: " + url);
    DriverManager.setLoginTimeout(timeout);
    con = DriverManager.getConnection(url,"usrquery","mundial");
    _stmt = _con.createStatement();
    boolean results = _stmt.execute("select count(*) from TABLA");
    if (results)
    ResultSet rs= _stmt.getResultSet();
    rs.next();
    System.err.println(rs.getString(1));
    _con.close();
    catch (SQLException sqle)
    System.err.println(sqle.toString() + " Restart connection.");
    return;
    catch (Exception e)
    e.printStackTrace();
    System.err.println("Unexpected Exception: " + e.toString());
    return;
    When I run the proyect using the IDE JDeveloper I have no problem, but when I make de use loadjava I receive these error message
    creating : resource META-INF/MANIFEST.MF
    loading : resource META-INF/MANIFEST.MF
    Error while creating resource META-INF/MANIFEST.MF
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    creating : class pkg/clsTest
    loading : class pkg/clsTest
    creating : resource jconn3.jar
    loading : resource jconn3.jar
    Error while creating resource jconn3.jar
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    granting : execute on class pkg/clsTest to public
    Error while computing shortname of pkg/clsSybaseLAE
    ORA-06550: line 1, column 13:
    PLS-00201: identifier 'DBMS_JAVA.SHORTNAME' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    resolving: class pkg/clsTest
    errors : class pkg/clsTest
    ORA-29521: referenced name java/lang/StringBuffer could not be found
    ORA-29521: referenced name java/lang/Class could not be found
    ORA-29521: referenced name com/sybase/jdbcx/SybDriver could not be found
    ORA-29521: referenced name java/sql/Driver could not be found
    ORA-29521: referenced name java/sql/DriverManager could not be found
    ORA-29521: referenced name java/lang/System could not be found
    ORA-29521: referenced name java/lang/Exception could not be found
    ORA-29521: referenced name java/io/PrintStream could not be found
    ORA-29521: referenced name java/sql/Connection could not be found
    ORA-29521: referenced name java/sql/Statement could not be found
    ORA-29521: referenced name java/sql/ResultSet could not be found
    ORA-29521: referenced name java/sql/SQLException could not be found
    ORA-29521: referenced name java/lang/Object could not be found
    ORA-29521: referenced name java/lang/String could not be found
    synonym : pkg/clsTest
    The following operations failed
    resource META-INF/MANIFEST.MF: creation
    class pkg/clsTest: resolution
    resource jconn3.jar: creation
    exiting : Failures occurred during processing
    Please some one help me!.. Thank's a lot

    Thanks, you was right, but I have another problem
    The following operations failed
    class cl/bcch/clsSyBase: resolution
    source cl/bcch/clsSyBase: creation (createFailed)
    oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
         at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:1057)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:124)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:53)
         at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:98)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:503)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:381)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:300)
         at oracle.jdevimpl.deploy.StoredProcProfileDt$Action$1.run(StoredProcProfileDt.java:598)
    #### Export incomplete. #### 09-01-2008 02:28:39 PM
    *** Note ***
    One possibility for the database export failure is that the target Database may not support JDK version 1.4. Updating your Project Properties compiler Source & Target to an earlier release could fix this problem.
    ************

  • Java Class for mail in oracle

    Hi,
    I created an Java program to import attachments from a exchange server mailbox using POP3S .It works fine when run as a java application.
    But when i put this inside Oracle11g using load java and while executing it gives an error at
    Multipart mp = (Multipart) message.getContent();
    Error:
    Content-Type: multipart/mixed;
    boundary="_002_A0C2E09A..................................."
    java.lang.ClassCastException
    at Newmail.mailPOP3(Newmail:71)
    Could someone explain why I am getting this error? What can I do to resolve this error?Any help would be much appreciated.
    Regards,
    Joseph

    Hai Matt,
    The actual class i am tested as follows,
    import java.util.Properties;
    import javax.mail.Authenticator;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.Store;
    import javax.mail.Part;
    import javax.mail.Multipart;
    import javax.mail.internet.MimeMultipart;
    import javax.mail.internet.MimeMessage;
    public class Newmail
    public Newmail()
    super();
    public static int mailPOP3(String phost,
    String pusername,
    String ppassword)
    Folder inbox =null;
    Store store =null;
    int result = 1;
    try
    String host=phost;
    final String username=pusername;
    final String password=ppassword;
    System.out.println("Authenticator");
    Authenticator auth=new Authenticator()
    protected PasswordAuthentication getPasswordAuthentication()
    return new PasswordAuthentication(username, password);
    System.out.println("Certificate");
    String filename="D:\\Certi\\jssecacerts";
    String password2 = "changeit";
    System.setProperty("javax.net.ssl.trustStore",filename);
    System.setProperty("javax.net.ssl.trustStorePassword",password2);
    Properties props = System.getProperties();
    System.out.println("host-----"+props);
    props.setProperty("mail.imaps.port", "993");
    props.setProperty("mail.imaps.starttls.enable","true");
    props.setProperty("mail.imaps.ssl.trust", "*");
    Session session = Session.getInstance(props,auth);
    session.setDebug(true);
    store = session.getStore("imaps");
    System.out.println("store------"+store);
    store.connect(host,username,password);
    System.out.println("Connected...");
    inbox = store.getDefaultFolder().getFolder("INBOX");
    inbox.open(Folder.READ_ONLY);
    Message[] msgs = inbox.getMessages();
    System.out.println("msgs.length-----"+msgs.length);
    result = 0;
    int no_of_messages = msgs.length;
    for ( int i=0; i < no_of_messages; i++)
    System.out.println("msgs.count-----"+i);
    System.out.println("Attachment....>"+msgs.getContentType());
    // Casting message to multipart
    *Multipart mp = (Multipart)msgs[i].getContent();* System.out.println("Casting Success" + mp.getContentType());
    catch(Exception e)
    e.printStackTrace();
    finally
    try
    if(inbox!=null)
    inbox.close(false);
    if(store!=null)
    store.close();
    return result;
    catch(Exception e)
    e.printStackTrace();
    return result;
    In this class when running from oracle using a procedure "Multipart mp = (Multipart)msgs[i].getContent();" throws exception..
    Error:
    Content-Type: multipart/mixed;
    boundary="_002_A0C2E09A..................................."
    java.lang.ClassCastException
    at Newmail.mailPOP3(Newmail:71)
    Thanks & Regards
    Joseph

  • Using Java + WEBDAV to connect to Oracle 10g Repository

    Hi,
    I could not connect to Oracle 10g Repository with WEBDAV protocol. I thought that Oracle should provide a client library to help Java application to connect to Repo but I could not find it out.
    Could you please show me how to connect to Repo with WEBDAV protocol?
    It's better if giving me some examples.
    Thanks a lot.

    Hi,
    Did you succeed??
    I am also searching for an example.
    Regards,
    Romano

  • Java applet to connect to Oracle Database?

    Hello,
    I need to make a standalone java applet where I can enter the following:
    database url:
    driver:
    database:
    user name:
    password:
    host name:
    port:
    and then click "ok" and it is supposed to connect me to my Oracle account set up at my school. Ive never done anything like this before. Can anyone please provide me with some code to get started? Thank soooo much!

    look into jdbc. You will find it a bit more tricky if you insist on using an applet (why not an app?), as they do not by default have permission to do this sort of stuff (security issues). You will need to create the applet, and then sign it using a certificate. You may be able to get a development-only certificate for free from some eastern european website... I would strongly urge you to use an app instead if you are in any way able to.

  • Java class to connect Windows server and excecuting bat file

    Hi All,
    Could some please provide or let me know how to connect windows server and executing bat file in windows box.
    All i have in hand to connect is Host name,Username and Password.
    Basically i am SOA guys and facing difficult in building class to do.
    I want to use Java code in my integration project in order to achieve the above case.
    I am using Linux OS. And i want to run Java code in Linux Box and to connect to Windows server
    Thanks in advanace
    Regards,
    Tarak.
    Edited by: Tarak on Aug 8, 2012 4:08 PM
    Edited by: Tarak on Aug 11, 2012 9:08 PM

    I'm afraid few if any of us are going to know anything more about connecting to Windows Server than you do. All I can suggest is to check if its client interface is publicly documented and try reverse engineering it from that.

  • Run a java class in Oracle db to connect to Sybase

    Hi All, I'm looking for a way to connect to Sybase database at no-license-cost (meaning Oracle Gateway or similar 3rd party products), first coming idea was JDBC, I know I can run a java class in Oracle, the simple idea is to write a java class which connects to Sybase via JDBC thin driver and return the resultset of given query in a java class, the resultset will be presented in Oracle Apex framework.  Does anyone know if this can be done or not, and how?  Any howto articles are welcomed.
    Henry

    Henry:
    To connect to Sysbase or MsSQL Server you could use jTDS open source driver.
    http://sourceforge.net/projects/jtds/
    upload above driver (jar file) using loadjava, and grants the port connection using dbms_java.grant_permission procedure.
    Because jTDS is pure java driver (mode 4) is possible to use directly inside the RDBMS.
    Best regards, Marcelo.
    PD: Latest jtds driver is compiled against 1.6 sources, but oldest version will work with 1.5 for 11g.

  • 32 bit compiled Java Program not connecting to 64 bit Oracle 11g

    Hi,
    I am using one java program to connect to Oracle 11g (64 bit version) using Oracle10g 32 bit client libraries using OCI calls. Below is the program. If I compile it using 64 bit Oracle 10g libraries ($ORACLE_HOME/lib and $ORACLE_HOME/rdbms/lib) , it perfectly connects to Oracle11g but when i compile it using $ORACLE_HOME/lib32 and $ORACLE_HOME/rdbms/lib32, it hangs and keeps trying and takes 100% cpu usage. it does nothing. Please suggest what is going wrong in the environment.
    ============================
    import java.sql.*;
    class dbAccess {
    public static void main (String args []) throws Exception
    Class.forName ("oracle.jdbc.OracleDriver");
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:oci8:@lvfd", "fde", "fde");
    // or oci7 @TNSNames_Entry, userid, password
    try {
    Statement stmt = conn.createStatement();
    try {
    ResultSet rset = stmt.executeQuery("select * from tab");
    try {
    while (rset.next())
    System.out.println (rset.getString(1)); // Print col 1
    } finally {
    try { rset.close(); } catch (Exception ignore) {}
    } finally {
    try { stmt.close(); } catch (Exception ignore) {}
    } finally {
    try { conn.close(); } catch (Exception ignore) {}
    ================================================

    >
    I am compiling like when LD_LIBRARY_PATH set to $ORACLE_HOME/lib32:$ORACLE_HOME/rdbms/lib32.
    javac -cp .:$ORACLE_HOME/jdbc/lib/ojdbc14.jar dbAccess.java
    as my program resides in current directory. I run it like :
    java -cp .:$ORACLE_HOME/jdbc/lib/ojdbc14.jar dbAccess
    Output: it hangs forever.
    I am compiling like when LD_LIBRARY_PATH set to $ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib
    javac -cp .:$ORACLE_HOME/jdbc/lib/ojdbc14.jar dbAccess.java
    as my program resides in current directory. I run it like :
    java -cp .:$ORACLE_HOME/jdbc/lib/ojdbc14.jar dbAccess
    Output: It gets connected and list all the tables as output.
    >
    The ojdbc14.jar file is for use with Java 1.4 VMs.
    Are you still using Java 1.4? If so, why?
    For Oracle 11g you should be using the latest JDBC jar file (ojdbc6.jar) and the latest version of Java 1.6.
    You are not only using an old JDBC driver and Java version but are also trying to mix 32 bit and 64 bit operations.
    I suggest you start using recommended practices and update your Java and JDBC versions and select EITHER 32 bit or 64 bit operations.
    See the Official JDBC FAQ for the details on the support available for various combinations of Oracle DB, Java and the JDBC drivers:
    http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html

  • Java Class - Oracle Stored Procedure - ABAP Program

    My client asked me to design a Java Class that calls a Oracle stored procedure. I was a Java developer so I can do that part. Now this Java Class will be called by a ABAP program. All the data that I got from Oracle Stored Procedure should be retuned to the calling ABAP program.
    In the past I did use JCA and SAP Connectors to get data from SAP R3 by calling BAPI programs.
    I would like to know if the ABAP program uses JCO or the latest JCA based SAP Connectors. Any advice on how I should structure my Java Program is welcome. I do know from pure Java side how to get data from Oracle database using JDBC.

    Hi venkat,
    This link(PDF) gives good info about JCO.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c63bca90-0201-0010-59ae-e0db32750209
    JCO is used as two way communication between JAVA and R/3. so for yours JCO may be the suitable one.
    regards,
    P.Venkat
    Message was edited by: venkataramanan

  • User permission issue in connecting to Oracle using java in Cent OS

    Hi ,
    I am facing a peculiar issue and since I am new to Cent OS, I hope somebody can help me.
    I am using Cent OS 4.2 and I installed Oracle client 10.2 in cent os 4.2.
    I am having a java application which connects to Oracle server in another Linux system using Oracle OCI driver which comes along with Oracle client
    I have a user called user1 which belongs to group group1 as primary group and my application runs under this user user1.
    This user is a member of oinstall group (which is the group for oracle uesr which has access to oracle client directories/files)
    But when my application tries to connect to Oracle server, I am getting connectivity error saying "Oracle driver not found" or "cannot load libocijdbc10.so". All environment variables like ORACLE_HOME, PATH,CLASSPATH, LD_LIBRARY_PATH are set properly.
    The permissions to Oracle folder/files are rwx for owner(oracle user) , rx for group(oinstall) and none for others
    What we observed are
    1. When the application is start under root user, it works
    2. When we give rx permission to others, it works
    3. When we make oinstall group as the primary group for my user user1, it works
    My questions here
    1. Why it is not working even though my user user1 is a member of oinstall group
    2. Why it is working when I make oinstall as the primary group
    3. Is there any difference in security policy of RHEL and Cent OS
    4. How can I access libraries from multiple folders which created by different user and belongs to different groups, if this is the case
    I never faced this issue in RHEL4
    Hope some body can help me.
    Regards
    Sunil

    Sorry, I should have been more specific. The error message I was referring to shows up in a pop-up windows when I try to run the program. The actual java error message (that shows up in the command prompt window) is as follows:
    "Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\WINNT\system32\ocijdbc8.dll: The specified procedure could not be found
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:832)
    at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:192)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:142)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:214)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:193)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at lookup.main(lookup.java:16)"
    I'm running the program through Windows 200 Pro command prompt, and the version of java is, as I mentioned in the previous message, 1.4.1:
    java -version
    java version "1.4.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
    Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

  • Execution problem a stored java class

    Hi,
    I loaded a java class ("ConvertisseurXMLPDF") in an oracle 8.1.7 database and in a specific schema "SCHEMA1".
    I loaded it with the loadjava command included the -synonym and the -grant attributes to create the public synonym on this class and the grant execute to a role "ROLE1".
    Problem :
    I connect with a user "USER1" which is associated to the role "ROLE1" (so, he should have the execution privilege on the class) and
    When I execute the procedure which launches the execution of the java class, I have the following error message :
    java.lang.illegalAccessException
    at java.lang.Class.newInstance0(Class.java)
    at java.lang.Class.newInstance(Class.java)
    at ConvertisseurXMLPDF.createParser(ConvertisseurXMLPDF.java:162)
    at ConvertisseurXMLPDF.converssion(ConvertisseurXMLPDF.java:162)
    It seems, it does not even achieve to instantiate the class!
    What could be the reason of this problem?
    Thanks in advance
    bye
    [email protected]
    null

    Make sure you have the following privileges:
    grant javasyspriv to schema1;
    grant javauserpriv to role1;
    Jack

  • Re-connection to ORACLE db after the ORACLE server was down

    Hi all,
    I have a problem i've been trying 2 solve for several weeks now.
    I'm running a Java Class which connects to an ORACLE database located
    on the server 'server'.
    Everything is working fine.
    the problem is that if when the class is first run and the server is
    down (not started), I get an SQLException:
    "Exception d'E/S: The network adapter could not establish the
    connection", so the class retries after a certain period,
    say 5 minutes (the server is up and running at that time),
    i still get the same exception whereas it should now connect correctly.
    here's the code:
    public void run()
        bool retry = false;
        try
         DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
              Cnn = DriverManager.getConnection("jdbc:oracle:thin:@server:1521:orcl", "username", "password");
        catch(SQLException e)
             if (e.getLocalizedMessage().compareTo("Exception d'E/S: The Network Adapter could not establish the connection") == 0)
         {     retry = true;     }
         else
         {     retry = false;     }
        finally
         try
            if (retry)
              Thread.sleep(300000);
                   System.out.println("Trying connection again...");
                   run();
            else
              //End
              return;
         catch(java.lang.InterruptedException e)
            return;
    }any help or suggestion would be appreciated,
    thanx,
    greg

    Greg,
    why not try separating the connection part into a separate method, and add a few more System.out.println()s so you can see where you are going:
    public void run()
       System.out.println("started run()");
       // Only need to do this once...
       DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
       // Keep trying until we're connected...
       while (!connect())
          Thread.sleep(300000);
          System.out.println("Trying connection again...");
       System.out.println("finished run()");
    * Connects to oracle.
    * @return Has connection been made?
    private boolean connect()
       System.out.println("started connect()");
       try
          cnn = DriverManager.getConnection("jdbc:oracle:thin:@server:1521:orcl", "username", "password");
       catch(SQLException e)
          System.err.println(e.getLocalisedMessage());
       System.out.println("finished connect()");
       return (cnn != null);
    }I'm assuming here that "cnn" (I changed the capitalisation..) is a class attribute, since it was not defined within run() in the original code.
    You could probably change the last line of connect() to: return (cnn instanceof oracle.jdbc.driver.OracleDriver);This doesn't change the flow of the program (except only registering the oracle driver once) but it should help you debug.
    Ben New
    [email protected]
    Leftclick Software Development
    http://www.leftclick.com.au/

Maybe you are looking for

  • Why have year-old messages started to reappear endlessly in my In-box?

    The same 5 messages from beginning of July LAST year, about three weeks ago started to re-appear repeatedly in my In mailbox. In addition a one message of 14 July THIS years is doing the same. The frequency is about one message ”burst” every 15 minut

  • Can't locate icloud on my mac

    why can icloud not be found on my mac

  • Webservices for file transfer using XI

    Dear all, I want to transfer 30gb of different files to my target system. Here no mapping is involved. can i use Webservices like megaupload etc,to upload the same using XI. If so kindly clarify ,how do I achieve the same. Thanks, Srinivasa

  • Disabling autoplay using an action

    Hi, I'm working on an interactive banner. The banner cycles and loops through 6 images on autoplay, each with a 3 sec delay between pictures. I would also like to add a "previous image" and "next image" arrow for people who want to skip some of the i

  • Failed iphone 5 setup

    Help! I would like to move my data from my iPhone 4 to my new iphone 5. I seem to have skipped the correct setup process and I'm not sure how to get back to the right place. Can anyone help?