1.你要将安装oracle目录下的jdbc\lib\classes12.zip(数据库driver)和nls_charset12.zip(字符集),两个文件的完整路径在classpath中设置。(如果你的tomcat不支持.zip,要将.zip改为.jar)。2.用下面的连接中的oracle的例子测试一下。
http://www.csdn.net/expert/topic/670/670716.xml?temp=.3571741

解决方案 »

  1.   

    <%
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();   
    String url="jdbc:oracle:thin:@192.168.4.105:1521:dbName";  String user="uNane"; 
    String password="pass"; 
    Connection conn= DriverManager.getConnection(url,user,password);   
    Statement stmt=conn.createStatement(); 
    %>
      

  2.   

    在别的机器上找到了那两个文件,但考过来还是不能用,必须装Oracle吗?
    classpath已经设置了
      

  3.   

    怎么装jdbc呢?
    不是j2se中已经有了jdbc了吗?
      

  4.   

    classes12.jar加到你的classpath中去
      

  5.   

    jdb:odbc bridge连接方式下,classes12.zip没用啊
      

  6.   

    在oracle中有一个classes111.zip
    你在java目录下再建一目录jdbc然后
    把classes111.zip考到jdbc下,然后设置路径就可以连接了<%
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();   
    String url="jdbc:oracle:thin:@192.168.4.105:1521:dbName";  String user="uNane"; 
    String password="pass"; 
    Connection conn= DriverManager.getConnection(url,user,password);   
    Statement stmt=conn.createStatement(); 
    %>
      

  7.   

    这个是直接连接的 try    {      Class.forName("oracle.jdbc.driver.OracleDriver");      Connection con = DriverManager.getConnection("jdbc:oracle:thin:@yn:1521:dbName","sys","");//此处根据你帐户而定。      Statement st = con.createStatement();      ResultSet res = st.executeQuery("select * from table");      String line = "";      while (res.next())        line = line + res.getString("title")+"</b>";      out.print(line);      con.close();    }    catch (Exception ex)    {}
    ================================
    这个采用数据源,需要先配置好。
     Hashtable ht = new Hashtable();    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");    ht.put(Context.PROVIDER_URL,"t3://localhost:7001");     try    {      Context ctx = new InitialContext(ht);      DataSource ds = (DataSource)ctx.lookup("Oracle");      Connection con = ds.getConnection("system","12345678");//此处是WebLogic7的域用户和密码      Statement st = con.createStatement();      ResultSet res = st.executeQuery("select * from table");      String line = "";      while (res.next())        line = line + res.getString("notes")+"</b>";      out.print(line);      con.close();    }    catch (Exception ex)    {   }