Home » Developer & Programmer » JDeveloper, Java & XML » Problem with connecting oracle to Java !
Problem with connecting oracle to Java ! [message #92357] Mon, 14 June 2004 20:08 Go to next message
Amith p Jayanthilal
Messages: 5
Registered: June 2004
Junior Member
Hi,

i am trying to run this program(My code is at end of e-mail). I don't know whats wrong with it. It's just a simple program to connect from Java to Sql and then execute a simple query. I can see the first "hi" message in the program. But after that, once the connection is established, nothing is displayed on the screen. Not even second "HI" message. I am not even sure whether connection gets established or not.

Can anybody help me on this ?

I am damn sure about machine name, port#, SID, username and password used in the program. They are all right.

Waiting for ur reply,

Amith

 

import java.sql.*;
public class MyOwn{
 public static void main(String args[[]]) throws SQLException{
  
  System.out.println("hi");
  DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
  
  Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@akurach:2030:aaa",
                          "scott", "tiger");
                 
        System.out.println("HI");
        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery ("select DNAME from DEPT");
  
  while(rset.next()){
   System.out.println(rset.getString("DNAME"));
  }
  
  rset.close();
  conn.close();

 }

}
Re: Problem with connecting oracle to Java ! [message #92358 is a reply to message #92357] Mon, 14 June 2004 23:53 Go to previous message
Amith p Jayanthilal
Messages: 5
Registered: June 2004
Junior Member
Sorry for the trouble. I got it fixed myself by changing port number from 2030 to 1521.

Bye,
Amith
Previous Topic: Using Jdeveloper to compile SQLJ
Next Topic: doubt
Goto Forum:
  


Current Time: Wed Apr 24 20:52:20 CDT 2024