标题:servlet编程问题
取消只看楼主
tianshikun
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-9-20
结帖率:0
已结贴  问题点数:10 回复次数:0 
servlet编程问题
这个程序错在哪里?为什么会连接不了数据库:
try{
            
        
            Class.forName("org.gjt.mm.mysql.Driver");
            logconn=java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3307/lvddb","root","15186986877");
            logStmt=logconn.createStatement(java.sql.ResultSet.TYPE_SCROLL_SENSITIVE,
                    java.sql.ResultSet.CONCUR_READ_ONLY);
            strq="select user,password from lvduserdb";
            logRst=logStmt.executeQuery(strq);
            user2=logRst.getString("username");
            pass2=logRst.getString("password");
            if(user1.equals(user2)&&pass1.equals(pass2)){
                RequestDispatcher dispatcher=request.getRequestDispatcher("asssportcom.jsp");
                dispatcher.forward(request,response);
            }else{
                RequestDispatcher dispatcher=request.getRequestDispatcher("login.html");
                dispatcher.forward(request,response);
            }
        }catch(SQLException e){
            System.out.println(e.toString());
        }catch(Exception e){
        System.out.println(e.toString());
        }
        finally{
            System.out.println("0");
        }
搜索更多相关主题的帖子: servlet 数据库 localhost password 
2013-01-04 09:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-394956-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.103290 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved