websphere与mysql连接的示例分析-创新互联
这篇文章给大家分享的是有关websphere与mysql连接的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
成都创新互联 - 成都服务器托管,四川服务器租用,成都服务器租用,四川网通托管,绵阳服务器托管,德阳服务器托管,遂宁服务器托管,绵阳服务器托管,四川云主机,成都云主机,西南云主机,成都服务器托管,西南服务器托管,四川/成都大带宽,服务器机柜,四川老牌IDC服务商我是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连接的示例分析”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
分享文章:websphere与mysql连接的示例分析-创新互联
标题URL:http://pwwzsj.com/article/dpeiec.html