Connecting to SQL Server using JSP
I get the following error while trying to connect to SQL Server using JSP.
Login failed for user 'prashanti'. Reason: Not associated with a trusted SQL Server connection.
My code is as follows:
<html><head></head>
<body>
<%@ page import="java.sql.*" %>
<% Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); %>
<% Connection conn = DriverManager.getConnection
("jdbc:microsoft:sqlserver://localhost:1433","prashanti","prashanti");
Statement stmt = conn.createStatement();
ResultSet columns = stmt.executeQuery("select * from employee");
while(columns.next())
{
String name = columns.getString("name");
String address = columns.getString("address");
%>
<%=name%>
<%}%>
</body>
</html>
Any help will be appreciated.
Thanks,
Regards,
Prashanti
Re: Connecting to SQL Server using JSP
That sounds like a configuration problem with the database. Is there a command line client to MSSQL that you can try?
Oh, and please use [code][/code] tags for posting code.