Hello Everyone !
I'm trying to connect to Oracle from Java. I've given my coding below. But i get an error. The error is " Connection Refused No further Information". How do go about now ? Is my coding alright ? I set my classpath to c:\orawin95\jdbc\lib\classes111.zip [ i have one more zip file there in the lib folder by name classes102.zip ]. I have both jdk1.2.2 and 1.3. But here i used 1.2.2. I use Oracle 8.0.3. Somebody help me out of this prob.
This is the coding i used :
import java.sql.*;
import java.io.*;
import java.util.Date;
class JdbcTest
{
public static void main (String args [])
throws SQLException, IOException
{
System.out.println ("Loading Oracle driver");
try
{
Class.forName ("oracle.jdbc.driver.OracleDriver");
}
catch (ClassNotFoundException e)
{
System.out.println ("Could not load the driver");
e.printStackTrace ();
}
System.out.println ("Connecting to the local database");
Connection conn = null;
try {
conn =
DriverManager.getConnection
("jdbc racle:thin:scott/tiger");
}
catch (Exception e)
{
System.out.println("Error : " + e.getMessage());
}
Statement stmt = conn.createStatement ();
// Query the employee names
ResultSet rset = stmt.executeQuery ("select ename from emp");
while (rset.next ())
{
// Print the name out
System.out.println (rset.getString (1));
}
}
}
Is there any problem with my connection specification like the thin driver ? Do help me.
Thanks and Regards.
Swamy
[This message has been edited by Swaminathan Ramanathan (edited January 22, 2001).]