C
cwang66
Hi,
I am trying to configure JDBC connecting to MS SQL 2000 in Tomcat
5.5.9. I have tried using JDBC drivers from both Microsoft and JTDS. I
copied JDBC jar files to [Tomcat_home]shared\lib" in both cases.
However, I am getting the following error message from both cases( I am
using JSTL in my JSP page.):
javax.servlet.jsp.JspException: Unable to get connection, DataSource
invalid: "java.lang.NullPointerException"
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.java:85)
org.apache.jsp.userReport_jsp._jspx_meth_sql_query_0(org.apache.jsp.userReport_jsp:307)
org.apache.jsp.userReport_jsp._jspx_meth_c_when_0(org.apache.jsp.userReport_jsp:241)
org.apache.jsp.userReport_jsp._jspx_meth_c_choose_0(org.apache.jsp.userReport_jsp:203)
org.apache.jsp.userReport_jsp._jspService(org.apache.jsp.userReport_jsp:120)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Below is my web.xml configuration when using JTDS driver:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.3.dtd">
<web-app>
<context-param>
<param-name>
net.sourceforge.jtds.jdbcx.JtdsDataSource
</param-name>
<param-value>
jdbc:jtds:sqlserver://127.0.0.1:1433/testdb;user=xxx;password=xxx
</param-value>
</context-param>
</web-app>
Below is my web.xml configuration when using MS driver:
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.3.dtd">
<web-app>
<context-param>
<context-param>
<param-name>com.microsoft.jdbc.sqlserver.SQLServerDriver</param-name>
<param-alue>jdbc:microsoft:sqlserver://localhost:1433;User=xxx;Password=xxx;DatabaseName=testdb</param-value>
</context-param>
</context-param>
</web-app>
Any help is appreciated.
I am trying to configure JDBC connecting to MS SQL 2000 in Tomcat
5.5.9. I have tried using JDBC drivers from both Microsoft and JTDS. I
copied JDBC jar files to [Tomcat_home]shared\lib" in both cases.
However, I am getting the following error message from both cases( I am
using JSTL in my JSP page.):
javax.servlet.jsp.JspException: Unable to get connection, DataSource
invalid: "java.lang.NullPointerException"
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.java:85)
org.apache.jsp.userReport_jsp._jspx_meth_sql_query_0(org.apache.jsp.userReport_jsp:307)
org.apache.jsp.userReport_jsp._jspx_meth_c_when_0(org.apache.jsp.userReport_jsp:241)
org.apache.jsp.userReport_jsp._jspx_meth_c_choose_0(org.apache.jsp.userReport_jsp:203)
org.apache.jsp.userReport_jsp._jspService(org.apache.jsp.userReport_jsp:120)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Below is my web.xml configuration when using JTDS driver:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.3.dtd">
<web-app>
<context-param>
<param-name>
net.sourceforge.jtds.jdbcx.JtdsDataSource
</param-name>
<param-value>
jdbc:jtds:sqlserver://127.0.0.1:1433/testdb;user=xxx;password=xxx
</param-value>
</context-param>
</web-app>
Below is my web.xml configuration when using MS driver:
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.3.dtd">
<web-app>
<context-param>
<context-param>
<param-name>com.microsoft.jdbc.sqlserver.SQLServerDriver</param-name>
<param-alue>jdbc:microsoft:sqlserver://localhost:1433;User=xxx;Password=xxx;DatabaseName=testdb</param-value>
</context-param>
</context-param>
</web-app>
Any help is appreciated.