http://210.35.0.36/nt/ntsky/news/listarticle.jsp?articleid=4
连接数据库的类,用jdbc驱动要加载jdbc的驱动程序。

解决方案 »

  1.   

    还有一点要说明一下,就是我的JDBC也已经安装了,刚才看到好象还要设置JDBC的路径方面什么的,我确实不懂,希望可以明示!
      

  2.   

    点一下右上角的FAQ,去csdn首页的文档搜索
    到google查找都有很多答案阿
      

  3.   

    你需要一个mysql jdbc的工具包类似于:mysql-connector-java-3.0.7-stable-bin.jar然后:
    class SqlCon
    {
    private Connection myconn ;
        private Connection remoteconn ;
        private PreparedStatement pstmt;
        private Statement st;
        private Statement stmt;
        private ResultSet rs;
        private ResultSet res;
        public SqlCon()
        {
    try
    {
              Class.forName("org.gjt.mm.mysql.Driver").newInstance();
              String url1 ="jdbc:mysql://192.168.77.3/suhang?user=root&password=zeebo&useUnicode=true&characterEncoding=gb2312&autoReconnect=true";
              String url2 ="jdbc:mysql://192.168.77.4/info?user=root&password=zeebo&useUnicode=true&characterEncoding=gb2312&autoReconnect=true";
              myconn= DriverManager.getConnection(url1);
              remoteconn=   DriverManager.getConnection(url2);
            }
    catch(Exception e)
    {
    System.out.println("Cannot get the client stream"+e); }    }//其他函数和语句。
    }