简体   繁体   中英

i am trying to connect my jdbc program oracle database 10g and using window 8

my code is

import java.sql.*;

public class SelectTest{
    public static void main(String arr[]) {
        try {
            class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con=DriverManager.getConnection("jdbc:odbc:myDb","system","oracle");
            Statement stmt=con.createStatement();
            ResultSet rset=stmt.executeQuery("select * from emp");

            while(rset.next()) {
                System.out.print(rset.getInt(1)+"\t"+rset.getString(2)+"\t"+
                rset.getString(3)+"\t"+rset.getInt(4));
            }//while loop
            con.close();
        }//try 
        catch(Exception ex) {
            System.out.print(ex);
        }//catch
    }//main 
}//class 

And i set classpath of the oracle DB in system environment as

C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;.

And i set path for jre in user variables as

C:\Program Files\Java\jdk1.7.0_17\bin;.;

i am not getting why my program is giving the error:

Error: this program is not recognised as internal or external command.

You probably won't have jre and jdk installed. If java -version has the same result install these.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM