3 Replies Latest reply: Jan 6, 2005 1:06 PM by 796447 RSS

    <b><font color ='red'>Java JDBC and Oracle DB URGENT HELP PLEASE</font></b>

    807596
      Hello, I am a newbie. I'm very interested in Java in relation to JDBC, Oracle and SAP.I am trying to connect to an Oracle DB and I have problems to display the output on the consule in my application. What am I doing wrong here . Please help me. This is my code: Please Explain

      import java.sql.*;
      import java.sql.DriverManager;
      import java.sql.Connection;

      public class SqlConnection {

           public static void main(String[] args) {
                
                Class.forName("oracle.jdbc.driver.OracleDriver"); //Loading the Oracle Driver.
                Connection con = DriverManager.getConnection
                ("jdbc:orcle:thin:@34.218.5.3:1521:ruka","data","data"); //making the connection.
                Statement stmt = con.createStatement ();// Sending a query to the database
                ResultSet rs = stmt.executeQuery("SELECT man,jean,test,kok FROM sa_kostl");
                while (rs.next()) {
                     String man = rs.getString("1");
                     String jean = rs.getString("2");
                     String test = rs.getString("3");
                     String kok = rs.getString("4");
                     System.out.println( man, jean, test,kok );//here where my the
                                                   //compiler gives me errors
                     
                }
                stmt.close();
                con.close();
           }
      }