Error in connecting Oracle Database from JAVA application!!!

Hi,
I am trying to connect to the Oracle11g database server from the client machine using JAVA eclipse. I have installed the oracle client in the client machine. Once i try to execute the below code it was throwing below error:
public class Dbconnect {
public static void main (String[] args)throws Exception {
try {
Class.forName ("oracle.jdbc.driver.OracleDriver");
String connectString = "jdbc:oracle:thin:@<IP Address>:1521:orcl";
OracleDriver drivers = new OracleDriver();
System.out.println(drivers);
Connection connection = null;
connection = (OracleConnection)DriverManager.getConnection(connectString,"ADMIN", "admin");
System.out.println(connection);
System.out.println("Connected to the database");
Error:
java.sql.SQLException: The Network Adapter could not establish the connection
     at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
     at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
     at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
     at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
     at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
     at java.sql.DriverManager.getConnection(Unknown Source)
     at java.sql.DriverManager.getConnection(Unknown Source)
     at DBConnect.main(DBConnect.java:15)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
     at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:359)
     at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
     at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:672)
     at oracle.net.ns.NSProtocol.connect(NSProtocol.java:237)
     at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
     at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
     ... 7 more
Caused by: java.net.ConnectException: Connection refused: connect
     at java.net.PlainSocketImpl.socketConnect(Native Method)
     at java.net.PlainSocketImpl.doConnect(Unknown Source)
     at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
     at java.net.PlainSocketImpl.connect(Unknown Source)
     at java.net.SocksSocketImpl.connect(Unknown Source)
     at java.net.Socket.connect(Unknown Source)
     at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:141)
     at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
     at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:337)
     ... 12 more
I am unable to connect using sqlplus as well ORA-12560: TNS:protocol adapter error
Please advise me on how to resolve this issue..
Thanks

Prabhu wrote:
We are not able to connect from SQLplus as we.. If i issue this command in Sqlplus from client machine 'sqlplus admin/admin@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<Ip Adddress>)(PORT=1521)))(CONNECT_DATA=(SID=orcl)))'' it was throwing the below error.
Error: ORA-12541: TNS:no listener
Do i need add get any config details in the client machine..
Could please tell me what is the general procedure to access the DB server from client machine..on DB Server issue following OS commands
lsnrctl start
lsnrctl status
lsnrctl service
COPT commands & results, then PASTE all back here

Similar Messages

  • How to connect to  Oracle database from webdynprojava application

    Hi
    How to connect to  Oracle database from webdynprojava application. where can we provide the code to connect to database.?
    Thank You.

    Hi,
    You need to create  Java Bean model. The bean is a typical java bean with default constructor, getter and setter. You can have additional methods for query etc. The attributes in the class will be your model node and attributes.
    However you need to configure the connection and create JNDI using visual administrator before writing the code.
    You can also consider writing Session EJB with oracle and using them in WD.
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/dcaa4f05535591e10000000a1553f7/frameset.htm
    Srini

  • How to connect oracle database from tuxedo

    Hi,
    How to connect oracle database from tuxedo.
    If any one can help me.
    Regards,

    it depends on configuration your going to choose, there are two ways--
    - Using X/Open standards, for this
    you have to make an entry of Resource manager in $TUXDIR/udataobj/RM file.
    Then in UBBConfig file in GROUPS section u have to set Openinfo.
    It also depend on which database you are going to use.
    In your service now you need to call tpopen() API from tpsvrinit() function.
    - Other possibility is, take an implicit connection using Pro*C or Pro*Cobol whatever platform you are using.
    EXEC SQL Connect ...

  • How to connect oracle database with JAVA

    how to connect oracle database with JAVA....
    using j2sdk and Jcreator . which connector to use .. what are the code for that ..

    PLEASE .... Ask in an Oracle Java forum.
    And read the documentaiton. There is a whole document devoted to doing that. http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/toc.htm has examples.
    PLEASE ... do not ask product questions in a forum which clearly has a title saying it is devoted to assisting with download problems.

  • How to connect Oracle database from Active Server page

    Hi
    This is srinivas aluri
    I have developed an application using ASP and MS-SQL7.
    Now i want to port this application to Oracle 8i database
    I have written my connection in seperate file called
    connection.inc using SQL OLEDB provider
    If i have to connect oracle database what will be my provider
    and what is the exact code for this connection string
    Here i am giving the code of SQL databse connection string
    strcon= Provider=SQLOLEDB.1;Persist Security Info=False;User
    ID=sa;Initial Catalog=prjdb;Data Source=servername
    i have tried by changing the provider name from SQLOLEDB.1 to
    OraOLEDB.oracle
    but i could not able connect the database.
    It is giving provider not found or not properly installed error.
    But the same code is perfectly working from Visual Basic code.

    it depends on configuration your going to choose, there are two ways--
    - Using X/Open standards, for this
    you have to make an entry of Resource manager in $TUXDIR/udataobj/RM file.
    Then in UBBConfig file in GROUPS section u have to set Openinfo.
    It also depend on which database you are going to use.
    In your service now you need to call tpopen() API from tpsvrinit() function.
    - Other possibility is, take an implicit connection using Pro*C or Pro*Cobol whatever platform you are using.
    EXEC SQL Connect ...

  • How to Connect Oracle database from excel

    I have installed oracle 11g on Windows 8 64 bit OS  on my laptop. I have Microsoft excel 2013. I can connect to database from SQL and from TOAD. Now  i want - from excel to connect to database.
    Please guide me the steps.
    Thanks

    Below link may be helpful to you :
    http://khalidali-oracledba.blogspot.in/2013/09/connection-between-ms-excel-to-oracle.html
    And if you are getting 32 bit vs 64 bit ODBC driver issue then :
    https://social.technet.microsoft.com/Forums/office/en-US/2234554e-e93c-438b-990a-6739df19da44/odbc-connection-problem-in-excel-2013-64-bit-windows-8-os-and-x64-processor-oracle-8i?forum=excel
    And still you are not able then post the question in :
    ODBC
    Regards
    Girish Sharma

  • Unable to establish connection with SQLServer from Java Application

    Dear All,
    I am facing the issue of establishing connection with SQL Server from Java project developed in NWDS. I am writing a jaas plug-in, as a part of that I am writing a login module to authenticate a web application through jaas, and I got need of fetching some data from SQL Server which is located in remote host. I am getting error in the line of code
    <b>Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver")</b>
    I also added the 3 jar files (msbase.jar,mssqlserver.jar,and msutil.jar) to my login module project and copied the same files at C:\usr\sap\J2E\JC01\j2ee\cluster\server0\bin\ext\MSSQL.
    My MI Landscape is j2ee stack + abap stack +WAS 6.40 with MAXDb as a database.
    Could anyone please let me know the solution if you are aware of it.
    Thanks and Regards,
    Kishore

    I solved it by writing the following code
    Connection con;
    Statement stmt;
    DataSource ds;
    Context ctx;
    ctx = new InitialContext();
    if(ctx == null)     throw new Exception("Boom - No Context");
    ds=(DataSource)ctx.lookup("jdbc/SQLDB");     
    con = ds.getConnection();
    stmt = con.createStatement();
    String query = "SELECT * FROM SubjectBIR where Subject_ID='" + user + "'";
    ResultSet result  = stmt.executeQuery(query);
    stmt.close();
    con.close();

  • OCI-21500 error when upgrading Oracle database from 10.2 to 11.2

    We have been running some test upgrades from 10.2 to 11.2 before running it on our production server. During one of these tests, the post-upgrade script utlu112s.sql generated the following output:
    Oracle Database 11.2 Post-Upgrade Status Tool 12-12-2011 21:12:54
    Component Status Version HH:MM:SS
    Oracle Server
    . VALID 11.2.0.2.0 00:53:59
    JServer JAVA Virtual Machine
    . VALID 11.2.0.2.0 00:31:25
    Oracle Real Application Clusters
    . INVALID 11.2.0.2.0 00:00:03
    Oracle Enterprise Manager
    . VALID 11.2.0.2.0 00:33:44
    Oracle XDK
    . VALID 11.2.0.2.0 00:13:00
    Oracle Text
    . VALID 11.2.0.2.0 00:05:19
    Oracle XML Database
    . OCI-21500: internal error code, arguments:
    [KODDBG_PUSH_80IMGPTR:dbgecPushPtr
    . failed], [0], [0xFFFFFFFF7FFF55E8], [0xFFFFFFFF7F22E2B8], [1], [], [], []
    . OCI-21500: internal error code, arguments:
    [KODDBG_PUSH_80IMGPTR:dbgecPushPtr
    . failed], [0], [0xFFFFFFFF7FFF55E8], [0xFFFFFFFF7F22E2B8], [1], [], [], []
    . OCI-21500: internal error code, arguments:
    [KODDBG_PUSH_80IMGPTR:dbgecPushPtr
    . failed], [0], [0xFFFFFFFF7FFF55E8], [0xFFFFFFFF7F22E2B8], [1], [], [], []
    . VALID 11.2.0.2.0 00:20:49
    Oracle Database Java Packages
    . VALID 11.2.0.2.0 00:00:53
    Oracle Multimedia
    . VALID 11.2.0.2.0 00:13:00
    Spatial
    . VALID 11.2.0.2.0 00:20:00
    Gathering Statistics
    . 00:24:39
    Total Upgrade Time: 03:37:02
    PL/SQL procedure successfully completed.
    As far as we can tell, everything appears to be up and running, but the OCI-21500 internal errors are troubling. I have not been able to find anything on metalink regarding this error, and I am wondering if anyone else has come across it before. Thanks for your help!
    Simeon

    The OS is Solaris 10 (SunOS 5.10) and the source DB version was 10.2.0.4. We are running the upgrade manually (NOT with DBUA). The upgrade log does not have any ORA-xxxx errors, but it does show a few instances of the same error, such as this example:
    SQL> desc XDB.XDB$RESOURCE_T;
    ERROR: OCI-21500: internal error code, arguments: [KODDBG_PUSH_80IMGPTR:dbgecPushPtr failed], [0], [0xFFFFFFFF7FFF55E8], [0xFFFFFFFF7F22E2B8], [1], [], [], []
    Regards,
    Simeon

  • Ora-12154 when trying to connect to database from fortran application

    I am trying to connect to database and run an simple select query to a table(without any where clause) using pro*fortran code.
    the connect strng is like
    exec sql connect :uidpwd
    where uidpwd = username/password@SID
    SID and tnsnames connect string are the same.
    The fortran (profortran) code is placed in the database server and there are no errors when make is run.
    Tnsping is working fine, also i am able to conect using sql*plus and run the same query.
    Please help
    Thanks and Regards
    Nitin

    Hi Nitin
    Thanks for the helpful! With your point I'm now Pro! Great thanks.
    By the way have your seen that?
    Files such as LISTENER.ORA, TNSNAMES.ORA, SQLNET.ORA, if configured manually, or copied and edited from earlier releases of Oracle Database may have record attributes that are incompatible with Oracle Database 10g release 2. The software cannot read such files. The required record format is stream_lf and the record attributes are carriage_control and carriage_return.
    This may result in:
    Inability to start the listener
    Services not registered with the listener
    Inability to connect to other databases
    ORA-12154: TNS:could not resolve service name
    Run the following command on each file affected:
    $ DIR/FULL filename
    An output similar to the following may be displayed:
    Record format: Variable length, maximum 255 bytes
    Record attributes: Carriage return carriage control
    If the output includes the preceding entries, then run the following command:
    $ CONVERT/FDL=SYS$INPUT filename filename
    RECORD
    CARRIAGE_CONTROL CARRIAGE_RETURN
    FORMAT STREAM_LF
    ^Z
    Otherwise herewith an interesting metalink note. Doc ID:      Note:437597.1
    Subject:      Ora-12154 When Executing Pro*Fortran Code Compiled With Oracle 10g.
    Hope this will also help you...
    Cheers
    Hubert

  • How to connect oracle database from solaris platform

    I have installed oracle9i client on solaris8, how can I configure to connect other oracle database?
    thanks for your assistance!!

    If the database is remote you would need to setup a sqlnet.ora and a tnsnames.ora file. Their locations are platform dependent. On AIX the files are in /etc while on some platforms you find the files in /var/opt/oracle and on others $ORACLE_HOME/network/admin. We have a Sun Sparc running SunOS 5.6 that has them in /var/opt/oracle.
    Configuation can be done through the installer as part of the install process, probably using a gui tool, or manually. We vote for manually.
    See your install README files and the ORANET manuals for details. Or once you know where the files belong copy them from a platform that can access the db you want to reach and just remove unnecessary lines for other databases.
    HTH -- Mark D Powell --

  • Problems connecting with database from java API

    I've benn using XSQLRequest and I found a problem with
    connections, because it can't connect from Java to database, but
    if I access to a .xsql it works.
    And also if I link to a .xsql first and after that I try to
    access to Database form my servlet it works. So I think my
    problem is to initialize the XSQLConfig.xml file in OC4J server.
    Thanks in advance

    Would you provide the way you deploy your XSQL app to OC4J and
    how you get JDBC connection using JAVA? I execute the next code more or less:
    miXSQLRequest = new XSQLRequest(XSQLQuery.getDOM
    (),null);
    miXSQLRequest.process(htParamsIn, pWriter, pErrors);
    but and it's probabily my mistake I don't get any conecction
    from the session or something similar because I thought that
    it's made by XSQLRequest, and the XSQLRequest class takes the
    default values of the connection pool from the file
    XSQLConfig.xml (I put this file inside the lib directory of
    OC4J) as the XSQLServlet.
    Thanks for your help

  • Calling oracle reports from java applications

    Hi:
    I was wondering if anyone can tell me how to invoke an oracle report from a java application.

    yes it is possible. There is a cgi script called viewreport.cgi. Have the jsp page call it (GET or POST method) and place the user parameters inside the form.

  • Problem in storing  as Blob in Oracle Database from java Program

    Hi All,
    Am trying to store an image of size 80000bytes into Oracle database using setBytes() anndsetBinaryStream() method but I'm unable to store in database.can u please tell me what are the various methods to store the Blob data into the database?
    the ways i'm trying to store in Database :
    1) cstmt.setBinaryStream(2, new ByteArrayInputStream(ltImageArr
    .get(i)), ltImageArr.get(i).length);
    2) cstmt.setBytes(2, ltImageArr.get(i)) ;
    waiting for reply
    please help me out

    hi !
    it seems to be a bug under Oracle 10.2, for which i used this workaround :
    PreparedStatement pstmt =
    con.prepareStatement("INSERT INTO blobtable VALUES (?)");
    Blob blob = BLOB.createTemporary(con, true, BLOB.DURATION_SESSION);
    OutputStream out = blob.setBinaryStream(0);
    out.write(byteValues);
    pstmt.setBlob(1, blob);
    i hope it will help you
    bye !

  • Error to Connect Oracle Files from Mac Os10  using smb protocol .

    I connect my MacOs10 to oracle Workspaces using smb protocol but when I try to copy a file into a folder the system show me "error -36".
    From the finder I type "apple -k" and then I write "smb://nomeserver". The system show me "User name" and "Password" and after the authentication I see "MyHome" resource on my desktop.
    I navigate into MyWorkspaces folders and than I copy a file from a local directory. After a few second the system show me "error -36" and the file is not transferred from local to server.
    Any idea?
    Thanks

    In OCS10g SMB protocol not supported, use FTP or WebDav.

  • Error when connecting to database from connection manager

    New installation of JDeveloper 11r2.
    java.lang.NullPointerException
         at oracle.dms.context.DMSContextManager.getContext(DMSContextManager.java:437)
         at oracle.dms.context.ExecutionContext.get(ExecutionContext.java:445)
         at oracle.dms.context.ExecutionContext.get(ExecutionContext.java:492)
         at oracle.dms.instrument.Noun.<init>(Noun.java:188)
         at oracle.dms.instrument.Noun.create(Noun.java:275)
         at oracle.dms.instrument.NounFactory.create(NounFactory.java:66)
         at oracle.jdbc.driver.DMSFactory.createNoun(DMSFactory.java:69)
         at oracle.jdbc.driver.PhysicalConnection.createDMSSensors(PhysicalConnection.java:2253)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:617)
         at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:132)
         at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:54)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:413)
         at oracle.jdeveloper.db.adapter.AbstractConnectionCreator.getConnection(AbstractConnectionCreator.java:117)
         at oracle.jdeveloper.db.adapter.DatabaseProvider.getConnection(DatabaseProvider.java:174)
         at oracle.jdeveloper.db.adapter.DatabaseProvider.getConnection(DatabaseProvider.java:143)
         at oracle.jdevimpl.db.adapter.CADatabaseFactory.createConnectionImpl(CADatabaseFactory.java:44)
         at oracle.javatools.db.DatabaseFactory.createConnection(DatabaseFactory.java:352)
         at oracle.javatools.db.DatabaseFactory.createDatabase(DatabaseFactory.java:148)
         at oracle.jdeveloper.db.DatabaseConnections.getDatabase(DatabaseConnections.java:504)
         at oracle.jdeveloper.db.DatabaseConnections.getDatabase(DatabaseConnections.java:440)
         at oracle.dbtools.raptor.utils.Connections$ConnectionInfo$ConnectRunnable.doWork(Connections.java:1051)
         at oracle.ide.dialogs.ProgressRunnable.run(ProgressRunnable.java:156)
         at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:612)
         at java.lang.Thread.run(Thread.java:595)
    Occurs with both thin and oci8 connections.
    Any ideas?
    Conection name: tryit
    Connection type: Oracle (JDBC)
    username: me
    password: mine
    save password: ticked
    Driver: thin (also tried oci8)
    Host Name: myhost
    SID: my10gdb (also tried service name).

    yes, when we install oracle 8i in windows professionel we have this problem, before installing 8i we connected to the database without problem
    thank you

Maybe you are looking for

  • How do i change a pdf photo to jpeg

    I need some help please i am trying to change some photos i down loaded from internet to a jpeg file to use on my web page HELP

  • Blue background behind text

    Often when we print from a third party application the PDF comes out with a dark blue background that is very hard to read. Any fix for this?

  • Open dataset (UNICODE) for english en polish characters

    Hi, I have a problem on my multi language project on where I need to manage English language and polish language. I have a table (that we can call TABLE) I manage the translation on it. When I am connected in English I can see some squares instead so

  • Where to find the 3G software for Portege R500

    I've just purchased an R500 with inbuilt 3G and applied the XP downgrade CD. I've inserted a valid Telstra 3G sim card, but cannot find the software to make the modem connection. The modem in Control Panel appears to be operating OK. I tried installi

  • Third party billing-MIRO

    At the time of doing MIRO -the error message is coming  as "Tax code VN in procedure company code xy is not valid" How can we solve that