Thanks fo ryour advise greg
It make s me feel so happy
 
-----Original Message----- 
From: Greg Nudelman [mailto:[EMAIL PROTECTED] 
Sent: Wed 3/5/2003 6:52 PM 
To: jdjlist 
Cc: 
Subject: [jdjlist] RE: oracle java connection



        Antony, I do not think it should be 

        String databaseUrl = "Z0L9H3:1521";// database address 

        Try something like this (206.189.201.155 = DB machine IP on the network): 

        import java.sql.*; 
        import java.math.*; 
          
        public class JdbcTest { 
          public static void main(String[] args) { 
            try { 
              DriverManager.registerDriver        // load driver 
                               (new oracle.jdbc.driver.OracleDriver()); 
              Connection conn = DriverManager.getConnection 
                  ("jdbc:oracle:thin:@206.189.201.155:1521:orcl","scott","tiger"); 
              Statement stmt = conn.createStatement(); 
              ResultSet rset = stmt.executeQuery ("Select ID from userAccount"); 
              while (rset.next()) { 
                   System.out.println("Yeeeee haaa! ID = " + rset.getString(1)); 
              } 
              
              rset.close(); 
              stmt.close(); 
              conn.close(); 
            } catch (Exception e) { 
                 System.out.println("ERROR : " + e); 
                 e.printStackTrace(System.out); 
            } 
          } 
        } 

        

        If this does not work, ping your DB machine. Can you connect using SQL from 
your machine? 
        If you can the problem is most likely in the TNSNames file.  What *is* in your 
TNSnames file?  Is it properly defined? Do you have orcl instance defined properly? 

        Why don't you try to connect to Access toy DB first through ODBC bridge?  That 
should be much easier. 

        If you still have problems: do you have a DBA at DeVry?  You'll need to have 
someone look at your system as a whole, this is trivial after you do it a couple of 
times, but the first time it can drive you nuts.

        Good luck. 

        Greg "who thinks he should be charging for this sh*t as no one held his hand 
for him when he was learning" 


        -----Original Message----- 
        From: Anthony Shaw [mailto:[EMAIL PROTECTED] 
        Sent: Wednesday, March 05, 2003 3:06 PM 
        To: jdjlist 
        Subject: [jdjlist] oracle java connection 


        Hi all 
        I would be most oblige if someone could help me fix my problem. 
        I have been trying for months to make a valid connection to oracle through 
java.  never succeed. 
          
        COULD SOMEONE PLEASE GIVE AN ANSWER? 

        I am using oracle8i on a personal computer: 
          
        database name = ORACLE 
        instance name = orcl 
        WHICH SHOULD BE USE IN THE CONNECT STRING? 
        When I select hostname from v$instance it came up blank. 
          
        I am using my ip address from Internet Provider 
        My computer name is = Z0L9H3 
        I am usin classes12.zip.  I also tried classes111.zip & classes102.zip 
          
        here is my errormsg 
        java.sql.SQLException: Io exception: The Network Adapter could not establish 
the 
        connection. 

        try { 
           String databaseUrl = "Z0L9H3:1521";// database address 
           String oracleHome = "orcl"; // oracle home 
           String databaseUserName = "scott"; // database access account name 
           String databaseUserPassword = "tiger"; // database access account password 


           DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); 
           conn = 
            DriverManager.getConnection("jdbc:oracle:thin:@" + databaseUrl + ":" + 
oracleHome, 
                             databaseUserName, databaseUserPassword); 

        Could someone help please? 

        thaks 


        b.⮷\&v:#v9b֬^f஧l\d{.ns+zwZnV隊[hz7cᬖ+-m|cV̬rܢhm , 
        (&Cz֥ 

        ---
        You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
        To unsubscribe send a blank email to [EMAIL PROTECTED]
        http://www.sys-con.com/fusetalk 

<<winmail.dat>>

---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk

Reply via email to