求助!!数据源错误

andy971024 2004-07-19 03:38:05
jbuilder9+weblogic8.1+Oracle9i 数据库未在本机
我在weblogic里配置链接池数据源都成功了,是运行程序出错错误代码:

Error 404--Not FoundFrom RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.4.5 404 Not Found The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.

我得使用数据源的JSP文件

<%@ page contentType="text/html;charset=GBK" %>
<%@ page import= "java.sql.* " %>
<%@ page import= "javax.sql.* " %>
<%@ page import= "javax.naming.* "%>
<%@ page import= "java.util.* "%>
<HTML>
<HEAD>
<TITLE> </TITLE>

</HEAD>
<BODY>

<%

Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"t3://127.0.0.1:7001");
ht.put(Context.SECURITY_PRINCIPAL, "weblogic");
ht.put(Context.SECURITY_CREDENTIALS, "00000000");

Connection conn = null;
Statement stmt = null;
ResultSet rs = null;

try {
ctx = new InitialContext(ht);
DataSource ds = (DataSource)ctx.lookup ("MyJNDI");
conn = ds.getConnection();
stmt = conn.createStatement();
stmt.execute("select * from LawTypeInfo");
rs = stmt.getResultSet();
while ( rs.next()){
out.println( rs.getString(1)+"___");
out.println( rs.getString(2)+"___");
out.println( rs.getString(3)+"<br>");
}

stmt.close();
stmt=null;
conn.close();
conn=null;



}catch (Exception e) {
out.println("错误 !! ERR !" );
}
finally {

try {
ctx.close();
} catch (Exception e) {
out.println("ctx ERR !" ); }

try {
if (rs != null) rs.close();
} catch (Exception e) {
out.println("rs ERR !" ); }

try {
if (stmt != null) stmt.close();
} catch (Exception e) {
out.println("stmt ERR !" ); }

try {
if (conn != null) conn.close();
} catch (Exception e) {
out.println("conn ERR !" ); }

}



%>
</BODY>
</HTML>
我该怎样呀?
...全文
163 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
dalyyy 2004-07-21
  • 打赏
  • 举报
回复
这个错误是你的地址不正确,检查你调用程序的地址,目录名和页面名是否都正确。
withwind79 2004-07-20
  • 打赏
  • 举报
回复
同上的写法就可以了
duoshanx 2004-07-20
  • 打赏
  • 举报
回复
weblogic里配置链接池数据源都成功了,那就直接用就行啦!为什么还要在程序中再写呢?
换一种方法。

javax.naming.Context ctx = null;
javax.sql.DataSource ds = null;
//SysLog log = null;

public UserMan() {
try {
ctx = new javax.naming.InitialContext();
ds = (javax.sql.DataSource) ctx.lookup("documents");
}
catch (javax.naming.NamingException ex) {
ex.printStackTrace();
}
}

andy971024 2004-07-19
  • 打赏
  • 举报
回复
改为我本机的ip也不行,localhost也不行
wypang0903 2004-07-19
  • 打赏
  • 举报
回复
你的问题我也没见过,建议把127.0.0.1修改为你本机的实际ip。

1,220

社区成员

发帖
与我相关
我的任务
社区描述
企业软件 中间件技术
社区管理员
  • 中间件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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