Note that there are some explanatory texts on larger screens.

plurals
  1. POApache Tomcat and SQLServerDataSource configuration
    primarykey
    data
    text
    <p>I work with Java-based web application in Tomcat. I connect my application with Oracle with this:</p> <pre><code>&lt;Resource name="jdbc/conn" auth="Container" type="oracle.jdbc.pool.OracleDataSource" driverClassName="oracle.jdbc.driver.OracleDriver" factory="oracle.jdbc.pool.OracleDataSourceFactory" url="jdbc:oracle:thin:@XXX.XXX.XXX.XXX:1521:XE" user="XXX" password="XXX" maxActive="100" maxIdle="30" maxWait="10000" scope="Shareable"/&gt; </code></pre> <p>I try to do the same with SQLServer:</p> <pre><code>&lt;Resource name="jdbc/conn" auth="Container" type="com.microsoft.sqlserver.jdbc.SQLServerDataSource" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" factory="com.microsoft.sqlserver.jdbc.SQLServerDataSourceObjectFactory" url="jdbc:sqlserver://XXX.XXX.XXX.XXX:1433;databaseName=XXX" username="XXX" password="XXX" maxActive="100" maxIdle="30" maxWait="10000"/&gt; </code></pre> <p>But this dasn't work!</p> <p>I know I can manage both situation using type="javax.sql.DataSource", but I need to cast the Datasource in OracleDataSource and SQLServerDataSource... Here is the java code :</p> <pre><code>Context ctx = new InitialContext(); Object obj = ctx.lookup("java:comp/env/jdbc/conn"); </code></pre> <p>I receive this exception:</p> <pre><code> Unexpected exception resolving reference com.microsoft.sqlserver.jdbc.SQLServerException: Riferimento DataSource non valido. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171) at com.microsoft.sqlserver.jdbc.SQLServerDataSourceObjectFactory.getObjectInstance(SQLServerDataSourceObjectFactory.java:37) at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:140) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.apache.naming.NamingContext.lookup(NamingContext.java:793) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:140) at org.apache.naming.NamingContext.lookup(NamingContext.java:781) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137) at javax.naming.InitialContext.lookup(InitialContext.java:392) </code></pre> <p>Please, can you help me?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload