|
-
Dec 9th, 2004, 04:24 PM
#1
Thread Starter
New Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|