DriverManager.getConnection(" jdbc:odbc:thin:@localhost:1521:orcl"," shaheena"," shaheena");错误:找不到符号DriverManager,声明

时间:2014-09-21 12:26:52

标签: java database-connection

import java.io。*;

import oracle.jdbc。*;

公共类JdbcApp6

{

       public static void main(String[] args)throws Exception 
      {
       OracleDriver driver=new OracleDriver();
       Connection con=DriverManager.getConnection("jdbc:odbc:thin:@localhost:1521:orcl","shaheena","shaheena");
    Statement st=con.createStatement();
    ResultSet rs=st.executeQuery("select * from sss");
    System.out.println("SSNO    SNAME    SBRANCH   SADDR ");
    System.out.println("---------------------------------");
    while(rs.next())
    {
    System.out.println(rs.getInt(1)+"  "+rs.getString(2)+"   "+rs.getFloat(3)+"  "+rs.getString(4));
    }
    con.close();
}

}

1 个答案:

答案 0 :(得分:0)

你需要

import java.sql.DriverManager;