JNDI problem with SQLServer
Hi all, excuse me I'm going to ask about a topic there are thousands of questions already made. The fact, is that I've searched and tried everything, but I still cannot connect Tomcat with SQLServer using a Resource. I've copied exactly the example at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how to.html I've got the DBTest class (from the example) also. My web.xml is: ?xml version=1.0 encoding=ISO-8859-1? web-app descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app And my server.xml . Host... Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ parameter namefactory/name valuecom.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valuewebsitebenchmark/value /parameter parameter namepassword/name valueredheader/value /parameter parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://localhost:1433/value /parameter /ResourceParams /Context /Host . But I´m still getting javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at this line: DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/TestDB); //From de DBTest class Is anyone able to tell me what that means?? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JNDI problem with SQLServer
Hi all, excuse me I'm going to ask about a topic there are thousands of questions already made. The fact, is that I've searched and tried everything, but I still cannot connect Tomcat with SQLServer using a Resource. I've copied exactly the example at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how to.html I've got the DBTest class (from the example) also. My web.xml is: ?xml version=1.0 encoding=ISO-8859-1? web-app descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app And my server.xml . Host... Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ parameter namefactory/name valuecom.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valuewebsitebenchmark/value /parameter parameter namepassword/name valueredheader/value /parameter parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://localhost:1433/value /parameter /ResourceParams /Context /Host . But I´m still getting javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at this line: DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/TestDB); //From de DBTest class Is anyone able to tell me what that means?? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI problem with SQLServer
You have: parameter nameurl/name valuejdbc:microsoft:sqlserver://localhost:1433/value /parameter The value needs some additional information. If you named your database as robinhood then you need the string to read: jdbc:microsoft:sqlserver://localhost:1433/robinhood?autoReconnect=true Nothing else jumped out at me on first look. I am assuming you did restart TC afterwards? I have to restart each time I redeploy my war. Haven't chased this one to see if it suppose to be that way or If I have something else wrong. Try adding this and let us know. Doug www.parsonstechnical.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]