这篇文章给大家分享的是有关WEBsphere与Mysql连接的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。 我是jb9+websphere
这篇文章给大家分享的是有关WEBsphere与Mysql连接的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
我是jb9+websphere,想用JNDI访问mysql
在Http://localhost:9090/admin我配置如下
在jdbc提供程序里设置
类路径:D:mysqldrivermysql-connector-java-3.0.11-stable-bin.jar
实现类名为:com.mysql.jdbc.Driver
然后在数据源设置:
名称:DataSource
JNDI:jdbc/DataSource
最后在定制属性增加(这地方我删增了好多次,就是没效果):
databaseName--info
user-root
passWord--blue
url--jdbc:mysql://localhost/info
portNumber--3306
ConnectionURL--jdbc:mysql://localhost/info
使用连接代码如下
private final static String JNDI="jdbc/DataSource";
InitialContext ctx=new InitialContext();
DataSource source=(DataSource)ctx.lookup(JNDI);
conn = source.getConnection();
结果source不为空,但是conn出现错误如下:
我不知道哪里错了,从昨天一直调到今天,websphere控制台打印功能又非常弱(system.out看不到出错信息,真是郁闷!)
实在不知道该怎么处理,恳请大虾指导一下,非常感谢!
java.sql.SQLException: DSRA9002E: ResourceException 带有错误代码 null:
javax.resource.spi.ResourceAllocationException:
Caught ResourceException thrown during creation of the ManagedConnection.
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1151)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:908)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1067)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:568)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:378)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:180)
at testwebsphere.web.DataBaseFacade.getUserinfo(DataBaseFacade.java:22)
at org.apache.jsp._index._jspService(_index.java:112)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.httpservlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:598)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:696)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)[@more@]
感谢各位的阅读!关于“websphere与mysql连接的示例分析”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
--结束END--
本文标题: websphere与mysql连接的示例分析
本文链接: https://lsjlt.com/news/62527.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0