Hi,
I am trying to get a connection to a datasource but I am getting a
communication exception. I'm not sure what the problem is here and I haven't
seen any other posts with the same issue. Can someone please point me in the
right direction? The exception I get doing a lookup for the datasource is:
javax.naming.CommunicationException: Receive timed out [Root exception is
java.net.SocketTimeoutException: Receive timed out]
We are using MS Sql Server, here is the mssql-ds.xml file:
<no-tx-datasource>
<jndi-name>jndiname</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dbname</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>XXX</user-name>
XXX
</no-tx-datasource>
And here is the code to lookup the datasource:
Connection con = null;
Context ctx = null;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "XXX");
env.put(Context.SECURITY_CREDENTIALS, "XXX");
try{
ctx = new InitialContext(env);
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jndiname");
con = ds.getConnection();
}catch(Exception e) {
e.printStackTrace();
}
Thanks in advance.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3938537#3938537
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3938537
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user