Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tomcat JNDI Connection with MS SqlServer 2008 R2 issue
- <Resource name="jdbc/XXX"
- auth="Container"
- type="javax.sql.DataSource"
- maxActive="50"
- maxIdle="50"
- maxWait="20000"
- username="XX"
- password="XX"
- driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
- url="jdbc:sqlserver://XXX.XXX.XXX.XXX:1433;databaseName=XXX"
- removeAbandoned="true"
- removeAbandonedTimeout="1800"
- />
- <resource-ref>
- <description>SQLSERVER Connection</description>
- <res-ref-name>jdbc/XXX</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <res-auth>Container</res-auth>
- </resource-ref>
- try {
- Context initCtx = new InitialContext();
- Context envCtx = (Context) initCtx.lookup("java:comp/env");
- log.info("0");
- dsSqlServer = (DataSource) envCtx.lookup("jdbc/XXX"); <---OK
- log.info("1");
- connSqlServer = dsSqlServer.getConnection(); <---THIS DOES NOTHING, "2" IS NEVER SHOWN IN LOG FILE!!!!!!
- log.info("2");
- ...
- } catch (Exception e) {
- log.fatal("SQLSERVER: Impossibile connettersi al database: " + e);
- }
Add Comment
Please, Sign In to add comment