Get the App
SLTechnology News&Howtos  ›  Database  › 

Example Analysis of connection between websphere and mysql

Shulou Source: shulou.com Published: 2022-05-31 15:55:45 11月14日 Update

This article shares content about an example analysis of websphere and mysql connections. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

I am jb9 +websphere and want to access mysql using JNDI

At http://localhost:9090/admin I configured as follows

Set in jdbc provider

Classpath:D:mysqldrivermysql-connector-java-3.0.11-stable-bin.jar

The implementation class name is: com.mysql.jdbc.Driver

Then in the data source settings:

Name:DataSource

JNDI:jdbc/DataSource

Finally, add custom attributes (I deleted and added many times in this place, but it didn't work):

databaseName--info

user-root

password--blue

url--jdbc:mysql://localhost/info

portNumber--3306

ConnectionURL--jdbc:mysql://localhost/info

Use the following link code

private final static String JNDI="jdbc/DataSource";

InitialContext ctx=new InitialContext();

DataSource source=(DataSource)ctx.lookup(JNDI);

conn = source.getConnection();

The result source is not empty, but conn has the following error:

I don't know what's wrong, I've been tuning from yesterday to today, and websphere console printing is very weak (system.out can't see error messages, really depressed!)

Really do not know how to deal with, prawn kindly guidance, thank you very much!

java.sql.SQLException: DSRA9002E: ResourceException with error code 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@]

Thank you for reading! About "websphere and mysql connection example analysis" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Tags: Examples analysis code content more articles errors good practical depressed information functions names places prawns that is properties console effects data Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn Microsoft Huawei MySQL