用ODBC-JDBC连接时会报未知错误,真的没办法了,那位大侠帮帮忙。

解决方案 »

  1.   

    access denied (java.net.SocketPermission 192.168.0.100:1521 connect,resolve)
    用户名密码对么?
      

  2.   

    applet只能和它所在的服务器(即从该服务器上下载这个applet)建立socket连接 
      

  3.   

    你先检查驱动是否有问题,如果没有问题,在检查一下你连数据库的URL,应该就是这两个的问题。或者你试试连其它机子上的数据库。
      

  4.   

    用户名和密码是没问题的,那我该用什么方法来测试我的JDBC是不是能用呢?
    我在DREAMEWEAVER MX 里用它自带的工具来连接报一个叫 protocol vailation的错误,实在是没办法了,谢谢
      

  5.   

    原码在这里,我只改动了HOST的地址,其他的都没边,我的JDK版本是1。4/*
     * This sample applet just selects 'Hello World' and the date from the database
     */// Import the JDBC classes
    import java.sql.*;// Import the java classes used in applets
    import java.awt.*;
    import java.io.*;
    import java.util.*;public class JdbcApplet extends java.applet.Applet
    {
      // The driver to load
      static final String driver_class = "oracle.jdbc.driver.OracleDriver";  // The connect string 
      //static final String connect_string = "jdbc:oracle:thin:scott/[email protected]:orcl";
    static final String connect_string = "jdbc:oracle:thin:scott/tiger@(description=(address_list=(address=(protocol=tcp)(host=192.168.0.100)(port=1521)))(source_route=yes)(connect_data=(sid=orcl)))";
      // This is the kind of string you woudl use if going through the 
      // Oracle 8 connection manager which lets you run the database on a 
      // different host than the Web Server.  See the on-line documentation
      // for more information.
      // static final String connect_string = "jdbc:oracle:thin:scott/tiger@(description=(address_list=(address=(protocol=tcp)(host=dlsun511)(port=1610))(address=(protocol=tcp)(host=pkrishna-pc2)(port=1521)))(source_route=yes)(connect_data=(sid=orcl)))";  // The query we will execute
      static final String query = "select 'Hello JDBC: ' || sysdate from dual";
        // The button to push for executing the query
      Button execute_button;  // The place where to dump the query result
      TextArea output;  // The connection to the database
      Connection conn;  // Create the User Interface
      public void init ()
      {
        this.setLayout (new BorderLayout ());
        Panel p = new Panel ();
        p.setLayout (new FlowLayout (FlowLayout.LEFT));
        execute_button = new Button ("Hello JDBC");
        p.add (execute_button);
        this.add ("North", p);
        output = new TextArea (10, 60);
        this.add ("Center", output);
      }  // Do the work
      public boolean action (Event ev, Object arg)
      {
        if (ev.target == execute_button)
        {
          try
          {
    // Clear the output area
    output.setText (null); // See if we need to open the connection to the database
    if (conn == null)
    {
      // Load the JDBC driver
      output.appendText ("Loading JDBC driver " + driver_class + "\n");
      Class.forName (driver_class);   // Connect to the databse
      output.appendText ("Connecting to " + connect_string + "\n");
      conn = DriverManager.getConnection (connect_string);
      output.appendText ("Connected\n");
    } // Create a statement
    Statement stmt = conn.createStatement (); // Execute the query
    output.appendText ("Executing query " + query + "\n");
    ResultSet rset = stmt.executeQuery (query); // Dump the result
    while (rset.next ())
      output.appendText (rset.getString (1) + "\n"); // We're done
    output.appendText ("done.\n");
          }
          catch (Exception e)
          {
    // Oops
    output.appendText (e.getMessage () + "\n");
          }
          return true;
        }
        else
          return false;
      }
    }这是ORACLE自己带的例子程序,应该不会有问题吧?
      

  6.   

    windows服务中的OracleOraHome81TNSListener服务没有打开!