title: SQL Sever and JAVA website connection JDBC
body: <p>I have created a JAVA application that connects to a SQL server database. 
  I used  'Microsoft JDBC Driver 4.0 for SQL Server' to connect my application to the database.
  I included the 'sqljdbc4.jar' file in my PC Classpath and in my Java Application Library, a made other nessa there after in connected perfectly.</p>
  
  <p>i am now making a local website similar to this Java Application, with basically the same features, the problem i an having is, i cannot connect the database to my website as i did with the Java application. it constantly says "No suitable driver found". my JAVA Application still runs, but not the website, even though in using the same PC, and the driver is still included in my PC Class path and Website library.</p>
  
  <p>You can have a look at my code that i have attached.
  i have also tried connecting using a servlet rather than a jsp page but it gives me the same issue.</p>
  
  <p>Could you please guide me as to what i am doing wrong, and if possible show me the correct way to connect my Webpage to the SQL Server database i created.</p>
  
  <p>PS - I used to connect to SQL Sever to my websites using a JDBC ODBC Bridge, but now that doesn't work.</p>
  
  <p>My Code - </p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;%@page import="java.sql.*"%&gt;
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"&gt;
  
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;Test Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
  &lt;p&gt;
      &lt;b&gt;
          Test Page
      &lt;/b&gt;
  &lt;/p&gt;
  
  &lt;%
  try
  {                    
      String connectionUrl = "jdbc:sqlserver://localhost:1433;" + "databaseName=Test;user=admin;password=admin";
      Connection con = DriverManager.getConnection(connectionUrl);
      PreparedStatement st=con.prepareStatement("Insert Into Test (UserName, Password ) Values ('Test_UName', 'Test_password')");  
      out.println("&lt;BR&gt;&lt;TD&gt;Inserted Successful&lt;/TD&gt;");
  }
  catch(Exception e)
  {                    
      out.println("&lt;TD&gt;Insert not Successful&lt;/TD&gt;");        
      out.println("&lt;BR&gt;&lt;TD&gt;" + e + "&lt;/TD&gt;");
  }
  
  %&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>