Getting no results when connecting to Oracle DB.

Hello , I'm tryin to connect to an Oracle DB and I get no result excpet that the console prints the following :
oracle.jdbc.driver.OracleDriver
BUILD SUCCESSFUL (total time: 0 seconds)
why so? here is my code :
import java.sql.*;
public class ListMovies {
private static Connection getConnection()
    Connection con = null;
     try
        String driverName = "oracle.jdbc.driver.OracleDriver";
        Class.forName(driverName);
        String serverName = "172.16.100.120";
        String portNumber = "1521";
        String sid = "taddb";
        String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
        String user = "fundinfo";
        String pw = "tadapps";
        con = DriverManager.getConnection(url, user, pw);
     catch (ClassNotFoundException e) {
                                    System.out.println(e.getMessage());
                                    System.exit(0);
     catch (SQLException e) {
                              System.out.println(e.getMessage());
                              System.exit(0);
    return con;
    private static ResultSet getMovies() {
        Connection con = getConnection();
    try
         Statement stmt = con.createStatement();
         String select = "select title,year,price "+" from movie order by year";
         ResultSet rows;
         rows = stmt.executeQuery(select);
         return rows;
    catch(SQLException e) {
             System.out.println(e.getMessage());
        return null;
           private static class Movie
                      public String title;
                      public int year;
                      public double price;
                   public Movie(String title,int year , double price)
                                this.title = title;
                                this.year = year;
                                this.price = price;
                  private static Movie getMovie(ResultSet movies)
                                      try
                                         String title = movies.getString("title");
                                         int year = movies.getInt("year");
                                         double price = movies.getDouble("price");
                                         return new Movie(title,year,price);
                                          catch(SQLException e)
                                           System.out.println(e.getMessage());
                                      return null;
public static void main (String [] args)
    ResultSet movies = getMovies();
       try
           while(movies.next())
                    Movie m = getMovie(movies);
                    String msg = Integer.toString(m.year);
                    msg += ": "+ m.title;
                    msg += Double.toString(m.price);
                    System.out.println(msg);
       catch(SQLException e)
           System.out.println(e.getMessage());
}Thanks

That message is comiong from this
     catch (ClassNotFoundException e) {
                                    System.out.println(e.getMessage());
                                    System.exit(0);
                                      }fix your classpath and provide much better error indicators.

Similar Messages

  • OS X Lion gets kernel panic when connecting via CIFS

    A customer of ours has problems with OS X Lion clients that get kernel panic when connecting via CIFS (Novell OES server).
    Any new on this issue?
    Tycho Sjgren
    Apoio AB

    Originally Posted by tychosjogren
    Sorry for the late response - had to check a few things with the customer.
    They use the latest OES version with all the latest sp and patches applied. They have even tested with the an OES 11 beta with the same result. The OS run as a VM on VMware in 64 bit mode attached to a SAN. Has also been tested as a plain install without VMware. The Lion version is 10.7.2.
    This is how the problem occurs:
    1. Mount the CIFS share - no problems
    2. Use the share - no problems
    3. If the network connection drops you get a message that the CIFS volume has disappeared and you are asked to unmount it. When you do that you get a kernel panic. You can force the problem to happen by turning of WiFi.
    So it is OES2 but which version (SP1, SP2, or SP3)? Interesting as I'd only heard of this with NetWare 6.5.
    Do you (and anyone else experiencing this issue in this thread) know if this has recently started happening, perhaps after the latest November 2011 Scheduled Maintenance patches were installed?
    I'll hopefully be able to do some testing tomorrow but in the meantime I've asked Novell ...
    HTH.

  • 2009 24-inch iMac 3.06GHz (EMC no. 2267).   I don't get any audio when connecting my Sony HD TV to my iMac via mini DisplayPort. Is there a fix or hardware upgrade?  I'm using a Kanex Mini DisplayPort to HDMI cable w/ audio support.

    2009 24-inch iMac 3.06GHz (EMC no. 2267).   I don't get any audio when connecting my Sony HD TV to my iMac via mini DisplayPort. Is there a fix or hardware upgrade?  I'm using a Kanex Mini DisplayPort to HDMI cable w/ audio support.

    You can connect the audio from your iMac to your TV using a mini jack (like headphones plug) to rca (regular red and white audio connectors used on every TV,DVD, etc) cable.
    On your TV, you need to be able to set the audio for the HDMI input you will use to "analog" and connect the rca end of the cable to the analog inputs on your TV.

  • Since upgrading to Mavericks I am finding that I am lucky to get 2 hours (when connected to WiFi) of use from my macbook Pro.

    Since upgrading to Mavericks I am finding that I am lucky to get 2 hours (when connected to WiFi) of use from my Macbook Pro.  I have turned off Bluetooth ( which was not an issue previously), uninstalled Chrome, again not an issue before I upgraded, and have not seen any improvement.
    I was using an older OS system (Snow Leopard) on my 2010 Macbook Pro.  I am wondering now if the upgrade was an unwise move?

    jbuckworth,
    which apps do you run under battery power? Are any of them identified as “apps using significant energy” when you click on the battery icon in the menu bar? If you have a 15-inch or 17-inch model, are your apps using the discrete GPU (which consumes more power than the integrated GPU)?
    How many charge cycles has your battery accumulated?
    How long have you had Mavericks installed? Is Spotlight still reïndexing your boot drive? (It does that whenever your OS is upgraded, because so many files change in an OS upgrade.)

  • Keep getting carrier update when connecting my new iPad to Itunes

    keep getting carrier update when connecting my new iPad to Itunes even though I have updated it I am with o2

    iTunes - Error codes and messages - http://support.apple.com/kb/TS3694.

  • Why am I getting sound distortion when connecting iPad 2 to amplifier.

    I am getting sound distortion when connecting iPad or iPod thru amplifier using AirPlay or 3.5mm to rca cables. Also the sound has far too much bass. No problems when connected in car.

    It sounds like a mismatched impedence.  What are you connecting to?   the output from the jack is intended for headphones, and is not just an audio out.
    Try turning the volume on the pad way down, and use the gain on your amp, and see if that minimizes the issue.
    There is a pure audio signal for both channels on the 31 pin plug, but you would need a special cable to use it.  I would bet they are available if you google.  Although I have read that the 31 pin signal is not filtered like the headphone output, so while it is a pure audio output, there may be some noise in it that would need to be filtered.
    Try google for a 31 pin cable.  ( the input for the car is probably built to take a signal from a headphone output, while your amp may be expecting a lower power signal)

  • I get different result when I paste with mouse and shift+ins

    Sometimes I get different result when I paste the clipboard content with mouse and shift+insert key combination. Why? What can I do to stop this annoyance?

    Just to add a little to the above, there really is no universally applied standard (not even close) for how the primary, secondary, and clipboard buffers should be used.  Any X program can use them however they wish.  But there are some common patterns: selected text should be placed in the primary buffer, and X pastes from the primary buffer with either middle click or shift-ins by default.
    This default can (and unfortunately often is) overriden by clipboard managers - I don't know why they don't stay true to their name and just manage the clipboard buffer, but they often don't.
    <mini rant>with no clipboard tools installed, selected text in any program I have is in the primary selection, and shift+ins or middle click paste from this primary selection.  Ctrl-C/Ctrl-V post to/from the clipboard buffer.  No need for extra tools.  If I install any clipboard manager, this default sanity of X11 goes strait to s(&*Y.  I don't like clipboard managers </mini rant>  <mini praise> X11 is great without any of that cruft added </mini praise>
    Last edited by Trilby (2013-06-15 03:12:39)

  • How to get exact match when working with Oracle Text?

    Hi,
    I'm running Oracle9i Database R2.
    I would like to know how do I get exact match when working with Oracle Text.
    DROP TABLE T_TEST_1;
    CREATE TABLE T_TEST_1 (text VARCHAR2(30));
    INSERT INTO T_TEST_1 VALUES('Management');
    INSERT INTO T_TEST_1 VALUES('Busines Management Practice');
    INSERT INTO T_TEST_1 VALUES('Human Resource Management');
    COMMIT;
    DROP INDEX T_TEST_1;
    CREATE INDEX T_TEST_1_IDX ON T_TEST_1(text) INDEXTYPE IS CTXSYS.CONTEXT;
    SELECT * FROM T_TEST_1 WHERE CONTAINS(text, 'Management')>0;
    The above query will return 3 rows. How do I make Oracle Text to return me only the first row - which is exact match because sometimes my users need to look for exact match term.
    Please advise.
    Regards,
    Jap.

    But I would like to utilize the Oracle Text index. Don't know your db version, but if you slightly redefine your index you can achieve this (at least on my 11g instance) :
    SQL> create table t_test_1 (text varchar2(30))
      2  /
    Table created.
    SQL> insert into t_test_1 values ('Management')
      2  /
    1 row created.
    SQL> insert into t_test_1 values ('Busines Management Practice')
      2  /
    1 row created.
    SQL> insert into t_test_1 values ('Human Resource Management')
      2  /
    1 row created.
    SQL>
    SQL> create index t_test_1_idx on t_test_1(text) indextype is ctxsys.context filter by text
      2  /
    Index created.
    SQL> set autotrace on explain
    SQL>
    SQL> select text, score (1)
      2    from t_test_1
      3   where contains (text, 'Management and sdata(text="Management")', 1) > 0
      4  /
    TEXT                             SCORE(1)
    Management                              3
    Execution Plan
    Plan hash value: 4163886076
    | Id  | Operation                   | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |              |     1 |    29 |     4   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_TEST_1     |     1 |    29 |     4   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | T_TEST_1_IDX |       |       |     4   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("TEXT",'Management and
                  sdata(text="Management")',1)>0)
    Note
       - dynamic sampling used for this statementJust read that you indeed mentioned your db version in your first post.
    Not sure though if above method is already available in 9i ...
    Message was edited by:
    michaels

  • Getting error message when connecting to public wi-fi, why?

    Getting error message when connecting to public wi-fi, why?

    What error message?
    Are you sure that the network is really public?

  • I keep getting this error when connecting my phone (0xE8000001)

    I keep getting this error when connecting my phone (0xE8000001) to iTunes. Sometimes the phone will try and sync for a little bit then it disconnects. What gives?
    And yes, I do have the latest version of iTunes (7.3)

    i kept getting all the same errors and i just figured it out. after getting an iphone i went from pure excitment to anger as i plugged it in and realized i needed to upgrade to tiger. then i spent over an hour installing tiger and it still didnt work. i got the same itunes error of not recognizing. HERE IS THE FIX....TURN OFF THE IPHONE AND REMOVE FROM THE DOCK. DONT JUST PUT IT TO SLEEP, HOLD DOWN THE BUTTON UNTIL IT ASKS YOU TO SLIDE TO TURN OFF. THEN CLOSE ITUNES. NEXT TURN THE PHONE BACK ON BY RE-DOCKING. START UP ITUNES IF IT DOESNT START IMMEDIATELY. YOU SHOULD START HAVING FUN NOW, ALBEIT SLOW ON THE 1.1 USB.

  • Not getting any sound when connecting my hdmi on the tv only on the laptop, no option in sound settings for altering hdmi

    not getting any sound when connecting my hdmi on the tv only on the laptop, no option in sound settings for altering hdmi

    Solution may be found if you search in the "More Like This" section over in the right column. 

  • Can't get Microsoft FrontPage to connect to Oracle 9.2i

    After considerble discussion in the microsoft.public.frontpage.client newsgroup (subject: "Database | Results ... won't ... through Oracle ODBC"), we had to give up and conclude that there didn't seem to be a straightforward way to connect to Oracle 9.2i via the FrontPage database wizard.
    I tried a system Oracle ODBC DSN via MS Access and it worked; but, ` can't get the same DSN to work from FrontPage. From FrontPage it generates a user/password error, though the same user/password works from MS Access.
    I tried an OLEDB connection and still received the following:
    Server error: Unable to connect to a database from the web server using the
    connection string 'Provider=MSDAORA; PWD=myPwd; UID=Administrator; Data
    Source=glOdb.mikecoughlin.net'.
    The following error message comes from the database driver software; it may
    appear in a different language depending on how the driver is configured.
    ORA-01017: invalid username/password; logon denied
    Source: Microsoft OLE DB Provider for Oracle
    Number: -2147217843 (0x80040e4d)
    I'm certain that this user/password combination is valid e.g. it works in Enterprise Manager to view tables etc.
    So, my question is:
    Does anyone have a/the workaround to use FrontPage to connect to Oracle 9.2i ?
    thanks,

    Trying use ODBC driver of Oracle Client, available on this Web Site.

  • Error when connecting  to Oracle DataSource in a clustered environment

    Trying to connect to a ORACLE 9.1 datasource in a remote clustered environment. Getting the following exception. The code works fine when connecting to a local non-clustered server. Any help will be greatly appreciated.
    ---------------------Stack trace--------------
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Failed to generate
    class for weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_JTACon
    nection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_
    812_WLStub ] - with nested exception:
    [java.lang.reflect.InvocationTargetException - with target exception:
    [java.lang.ArrayIndexOutOfBoundsException: 164]]
    at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:8
    07)
    at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:7
    90)
    at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:79)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.resolveObject(RemoteObject
    Replacer.java:237)
    at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:142)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadResolve(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
    bjectInputStream.java:119)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.ja
    va:112)
    at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:159)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:285)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:244)
    at weblogic.jdbc.common.internal.RmiDataSource_812_WLStub.getConnection(
    Unknown Source)

    Trying to connect to a ORACLE 9.1 datasource in a remote clustered environment. Getting the following exception. The code works fine when connecting to a local non-clustered server. Any help will be greatly appreciated.
    ---------------------Stack trace--------------
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Failed to generate
    class for weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_JTACon
    nection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_
    812_WLStub ] - with nested exception:
    [java.lang.reflect.InvocationTargetException - with target exception:
    [java.lang.ArrayIndexOutOfBoundsException: 164]]
    at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:8
    07)
    at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:7
    90)
    at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:79)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.resolveObject(RemoteObject
    Replacer.java:237)
    at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:142)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadResolve(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
    bjectInputStream.java:119)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.ja
    va:112)
    at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:159)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:285)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:244)
    at weblogic.jdbc.common.internal.RmiDataSource_812_WLStub.getConnection(
    Unknown Source)

  • Error when connecting an oracle DB with Integration gateway

    I followed the steps from the blog How to connect an Oracle DB with Integration Gateway in SMP3 and the ojdbc was deployed successfully to SMP. Still, i'm getting "Driver class oracle.jdbc.driver.OracleDriver not found" error message when i try to test my connection. The first difference i saw when completing these steps was that I'm using SMP3 SP05, could this be the issue?

    Joao D Franco Net
    Could you share below information:
    Can you cross check if deployed driver are OSGi enabled? Refer this.
    Can you share screenshot of the destination settings and error ?
    note: The blog you followed is referring to SP03 (1st GA of SMP3)..You should not have any problem in connecting to Oracle DB being on any SP.
    Regards,
    JK

  • Error when connecting linux oracle dataabse for replication thru oms

    I have installed oracle 8.1.7 ee on Redhat linux 7.1 and 6.2 both and also on windows2000.
    When i try to access database of any oracle installed on linux machines from any of management server it gives following errors:
    ora-01034 oracle not available
    ora-27101 shared memory realm does not exist
    linux error:2: file or dir does not exist.
    if i try to access dataabse without login to any management server ( i.e thru dba studio) then it connects to it.
    i want to setup master replication with two linux machine database.
    if any person has solution for this then please help me.
    Thx in advance
    if possible mail me at [email protected]
    thx in advance
    pranav shah
    null

    1010056 wrote:
    When iam connecting getting the following error
    [rmancln@orawave ~]$ sqlplus '/as sysdba'
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jun 5 21:16:53 2013
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select status from v$instance;
    STATUS
    MOUNTED
    SQL> alter database open;
    alter database open
    ERROR at line 1:
    ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
    SQL> alter database open resetlogs;
    alter database open resetlogs
    ERROR at line 1:
    ORA-01152: file 1 was not restored from a sufficiently old backup
    ORA-01110: data file 1: '/u01/rmancln/oradata/CLN/system01.dbf'provide details on what events lead up to this situation.
    [oracle@localhost ~]$ oerr ora 1152
    01152, 00000, "file %s was not restored from a sufficiently old backup "
    // *Cause:  An incomplete recovery session was started, but an insufficient
    //         number of logs were applied to make the database consistent. This
    //         file is still in the future of the last log applied. The most
    //         likely cause of this error is forgetting to restore the file
    //         from a backup before doing incomplete recovery.
    // *Action: Either apply more logs until the database is consistent or
    //         restore the database file from an older backup and repeat recovery.

Maybe you are looking for

  • Bridge doesn't recognize processor

    Hello, I'm using Bridge CS3 2.1.1.9 under MS Vista Home Premium, Processor is a Intel Dual Core E8200. After starting Bridge, I get the message (copied from a different thread): Adobe Bridge This application requires an Intel Pentium 4, Intel Celeron

  • How do I put purchased songs in ringtones,

    How can I use Iphone 5 purchase songs for ringtones on my phone?

  • Webutil with 11gR2 64-bit ?

    Hi all, Please let me know about the avaibility of Webutil in 11gR2 64-bit Forms. Some said that Webutil can not be used with 11gR2 64-bit Forms. If yes, then what is the alternative ? Thanks.

  • Allone windows 8.1 can't open some email attachments

     Only a few weeks old a new purchased All One, windows 8.1, and cannot open some e-mail attachments. Please can you help me.  I don't know if there are any restrictions put in place or if I have to activate something on my computer. Thank you.

  • Trouble installing libraries

    I am struggling with installing the Gnu Bignum Library from source. I run the following generic install procedure: cd /path/to/gmp/ ./configure make make check sudo make install using GMP 4.2.2 as gotten from http://gmplib.org/. After installing, I p