Results 1 to 2 of 2

Thread: Connecting to SQL Server using JSP

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    1

    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

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width