aspose file tools*
The moose likes JDBC and the fly likes Oracle DBConnection Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle DBConnection Problem" Watch "Oracle DBConnection Problem" New topic
Author

Oracle DBConnection Problem

Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi Ranchers,

I trying to write DataBase connection for my applicaiton i am getting error like <identifier> expected ...and i am pasting my code here please chek it and tell what is the problem.
Evgeniy Bulanov
Greenhorn

Joined: Dec 19, 2005
Posts: 23
Post the details of the problem ...


Computers are like air conditioners - They stop working properly when you open Windows
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1134

Vardhan,
Others may be able to help you using the information provided, but I doubt it.
In order for me to help you, I need to see the actual stack trace you are getting.
Can you post it?
Also it is usually a good idea to also provide relevant details of your environment.
For your question this would include the following:
  • Oracle database version you are using
  • JDBC driver (and version) you are using
  • Java version you are using

  • Your database connection URL includes "localhost".
    Is the database server running on the local host?

    Good Luck,
    Avi.
    Reshma Reddy
    Ranch Hand

    Joined: Dec 21, 2006
    Posts: 197
    Hi thanks for your replys,
    and i am developing my application in JSF, and now also i am getting same error <identifier required>.and my db is running on remotely it need any jar files to support oracle connecter...



    Thanks,
    Vardhan

    [ August 21, 2008: Message edited by: vardhan g ]
    [ August 21, 2008: Message edited by: vardhan g ]
    Shailesh Chandra
    Ranch Hand

    Joined: Aug 13, 2004
    Posts: 1081

    Hi vardhan,

    Please refer to AVI's post.

    We will require actual stacktrace of error.



    Are you sure your oracle instance is running on port 8080 ?



    Thanks,
    Shailesh


    Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
    Jelle Klap
    Bartender

    Joined: Mar 10, 2008
    Posts: 1773
        
        7

    You might want to try (notice the capital 'C'):


    [ August 21, 2008: Message edited by: Jelle Klap ]

    Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
    Shailesh Chandra
    Ranch Hand

    Joined: Aug 13, 2004
    Posts: 1081

    can you share the actual reason of the problem, so that it help the other users of forum, who will refer to this post.

    Thanks,
    Shailesh
    Reshma Reddy
    Ranch Hand

    Joined: Dec 21, 2006
    Posts: 197
    Hi,
    i worte class.forName insted of Class.forName and one more thing my remote server name what ever i am trining is not correct that is also one porblem. and now i run this file it is showing ClassNotFoundException Exception
    check this ....




    init:
    deps-module-jar:
    deps-ear-jar:
    deps-jar:
    compile-single:
    run-main:
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at util.DatabaseConnection.getConnection(DatabaseConnection.java:41)
    at util.DatabaseConnection.main(DatabaseConnection.java:28)
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    connection created successfullynull
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at util.DatabaseConnection.getConnection(DatabaseConnection.java:41)
    at util.DatabaseConnection.main(DatabaseConnection.java:29)
    BUILD SUCCESSFUL (total time: 0 seconds)



    Regards,
    Vardhan.

    [ August 21, 2008: Message edited by: vardhan reddy ]

    [ August 21, 2008: Message edited by: vardhan reddy ]
    [ August 21, 2008: Message edited by: vardhan reddy ]
    Jelle Klap
    Bartender

    Joined: Mar 10, 2008
    Posts: 1773
        
        7

    You should take a look at the Oracle JDBC FAQ. Particularly the sections on installing the Thin driver and the form of the connection URL.
     
     
    subject: Oracle DBConnection Problem