在JSP中是不是又傳遞了其它的password或者是不是傳遞空的值?????

ktyl2000 2002-03-25 12:02:06
在一個JavaBeans中定義:
---------------------------MyConnection----------------------------------
import java.sql.*;
import sun.jdbc.odbc.*;

public MyConnection{
public static Connection getConnection(){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:dsn_name","sa","pwd");
System.out.println("successfully");
}
catch (SQLException sqle){
System.out.println("error occurs,connect to database fail\n");
System.out.println(sqle.getMessage());
}
catch(ClassNotFoundException cle){
System.out.println("ClassNotFoundException error occurs");
cle.printStackTrace(System.out);
}
return conn;
}
}
//以上以java classname有形式成功執行
--------------------------------------------------------------
但當我在JSP中invoke時,出現error msg: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sa'.
------ 語句如下---
//在這里我調用MyConnection的method, 但不傳遞任何password 的信息.
Connection myconn=MyConnection.getConnection();
out.print("connected successfully");
--------------

不知道是不是因為在jsp中又傳遞了其它的password 值或者是不是傳遞空的值??請賜教!
Thanks in advance!
...全文
54 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ldgs 2002-03-25
  • 打赏
  • 举报
回复
Login failed for user 'sa'

不关jsp的事。
ktyl2000 2002-03-25
  • 打赏
  • 举报
回复
樓上的這位,現在我又發現了一個題:
當在數據庫中將user的password設置為空,即為""時,在JavaBeans中和jsp中均能調用!若有密碼,無論是 sa 或者其它用戶,均提示login failed for user "userName",誰能說這是什麼原因,好象javaBeans 中的沒有設定或設定的密碼不正確.(是不由於ms sql的安全驗證的問題或者是javaBeans+jsp其同工作時的問題),請賜教!!

23,407

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧