You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by John MccLain <jm...@tcshealthcare.com> on 2004/03/11 23:06:56 UTC
setdatasource problem
Heres the scenario -
I have a servlet
it sets up a JDBC connection to sql server via a URL with user name and
password
I am using standard SQL server authentication
I execute a query and get the results back and put them in a session
variable
I then take the URL I used for the connection and the database driver and
format a string:
jdbc:jtds:sqlserver://ZION/wisdomtest;user=wisdom;password=wisdom,net.source
forge.jtds.jdbc.Driver,,
This string is a parameter to Config.set(Config.SQL_DATA_SOURCE, <above
string>)
I then forward to a jsp page that performs a query - BUT since I already
have the data source set in my
session (from Config.set(...)), I don't use the setDataSource tag - the DS
isa already available
IT WORKS - my JSP page displays my result set I set in my session
originally, and it also performs the
query against the DS I set in the session and displays that result set
as well- WHEW!
Now I set it up to do the same thing BUT my JDBC url is
jdbc:jtds:sqlserver://ZION/wisdomtest;user=john;password=5223;domain=TRINITY
I do this because my driver does NT authentication when you specify a
domain.
The JDBC connection works and I get my result set back from the first query
using a standard
JDBC connection using domain authentication. HOWEVER, when my JSP page uses
the DS with
domain authentication, it fails. Here is the message
------------------------------------
javax.servlet.ServletException: Unable to get connection, DataSource
invalid: "java.sql.SQLException: Logon failed. Msg 18452, Severity 14,
State 1, Login failed for user '(null)'. Reason: Not associated with a
trusted SQL Server connection., Server , Procedure , Line 0"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI
mpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:800)
org.apache.jsp.provider_jsp._jspService(provider_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
11)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
test.testJDBC.doGet(testJDBC.java:67)
test.testJDBC.doPost(testJDBC.java:39)
.
.
.
----------------------------------------
WHY does the jstl datasource not like domain authentication, but is fine
with standard authentication - th
only difference is the URL I passed into Config.SQL_DATA_SOURCE, and the
only error is when using
that data source ????
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
RE: setdatasource problem
Posted by Martin van Dijken <su...@windgazer.nl>.
Hey John,
Can you show me the code snippets you use yourself to setup a connection and
do a query in the servlet? Both the standard and the domain example please.
As always ;) no uid/passwd necessary...
Martin
-----Oorspronkelijk bericht-----
Van: John MccLain [mailto:jmcclain@tcshealthcare.com]
Verzonden: donderdag 11 maart 2004 23:07
Aan: taglibs user list
Onderwerp: setdatasource problem
Heres the scenario -
I have a servlet
it sets up a JDBC connection to sql server via a URL with user name and
password
I am using standard SQL server authentication
I execute a query and get the results back and put them in a session
variable
I then take the URL I used for the connection and the database driver and
format a string:
jdbc:jtds:sqlserver://ZION/wisdomtest;user=wisdom;password=wisdom,net.source
forge.jtds.jdbc.Driver,,
This string is a parameter to Config.set(Config.SQL_DATA_SOURCE, <above
string>)
I then forward to a jsp page that performs a query - BUT since I already
have the data source set in my
session (from Config.set(...)), I don't use the setDataSource tag - the DS
isa already available
IT WORKS - my JSP page displays my result set I set in my session
originally, and it also performs the
query against the DS I set in the session and displays that result set
as well- WHEW!
Now I set it up to do the same thing BUT my JDBC url is
jdbc:jtds:sqlserver://ZION/wisdomtest;user=john;password=5223;domain=TRINITY
I do this because my driver does NT authentication when you specify a
domain.
The JDBC connection works and I get my result set back from the first query
using a standard
JDBC connection using domain authentication. HOWEVER, when my JSP page uses
the DS with
domain authentication, it fails. Here is the message
------------------------------------
javax.servlet.ServletException: Unable to get connection, DataSource
invalid: "java.sql.SQLException: Logon failed. Msg 18452, Severity 14,
State 1, Login failed for user '(null)'. Reason: Not associated with a
trusted SQL Server connection., Server , Procedure , Line 0"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI
mpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:800)
org.apache.jsp.provider_jsp._jspService(provider_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
11)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
test.testJDBC.doGet(testJDBC.java:67)
test.testJDBC.doPost(testJDBC.java:39)
.
.
.
----------------------------------------
WHY does the jstl datasource not like domain authentication, but is fine
with standard authentication - th
only difference is the URL I passed into Config.SQL_DATA_SOURCE, and the
only error is when using
that data source ????
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org