Could you show a bit more information?
Also you might use a Java tool like SQuirreL that you are able to test the connection with the same JDBC driver from the same machine
Thanks for your quick response. I have tested connection in Wildfly Data source Administration and the connection was successful. Below is what I use to connect to the data source.
Properties p = new Properties();
InitialContext ic = new InitialContext(p);
And this is the error I get.
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
Are you trying to lookup the datasource from a remote client (like standalone application)? If yes, then it's not supported. Furthermore, the jnp: JNDI provider URL too is no longer supported in AS7/EAP6 or WildFly.
Hi Jaikiran, Thanks for your reply.
I have an ejb deployed in the server in which I have to use Data base connection. And my code to connect to Data source is inside a jar file that is available in the server as well. I have a standalone code to connect to EJB and I am able to connect to the EJB. But when I call the function to connect to Data source I get the error I specified earlier.
If your code which is trying to lookup the datasource is within the same server as the datasource, then all you need to do is:
DataSource ds=(DataSource) InitialContext.doLookup("java:jboss/TestDatasource"); Connection con=ds.getConnection(); ....
You should get rid of the other lines from the code you posted.