title: java.sql.SQLException: No suitable driver found for jdbc:sqlserver
body: <p>I am working on a web application where I am creating MSSQLSERVER 2008
  database dynamically. </p>
  
  <p>But it's giving me</p>
  
  <pre><code>java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost:1433;databaseName=master
  </code></pre>
  
  <p><strong>My code is:</strong> </p>
  
  <pre><code>String dbName = "db1";
  try {
      String url = "jdbc:sqlserver://localhost:1433;databaseName=master";
      Connection connection = DriverManager.getConnection(
                   url,
                   "sa",
                   "roshan14121987");
  
      Statement statement = connection.createStatement();
      String sqlquery = "CREATE Database \"" + dbName + "\"; ";
      statement.executeUpdate(sqlquery);
      statement.close();
  
      connection.close();
  
  } catch(Exception e) {
      e.printStackTrace(); 
  }
  </code></pre>
  
  <p>I have added sqljdbc4.jar in lib. I have tried it on both NetBeans (with GlassFish and Tomcat Server) and Eclipse IDE(Tomcat Server).</p>
  
  <p>On the other hand I have tried this with simple desktop application, it's working fine on both IDEs. With sqljdbc4.jar added in lib.</p>