Boa tarde a todos.
Estou tendo o seguinte erro em meu projeto web.
org.apache.jasper.JasperException: java.lang.RuntimeException: java.sql.SQLException: No suitable driver found for jdbc:sqlserver: (...)
Já coloquei o driver jtds-1.2.5.jar na lib e no build patch mas não funciona.
Espero que alguém possa me ajudar.
Segue abaixo o código.
ConnectionFactory:
[code]
package br.com.engemap.ecm.connectionFactory;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionFactory {
public Connection getConnection(){
try{
//Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
return DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.2.12\SQLEXPRESS:1433; " +
"databaseName=TOTVSDB;" +
"user=sa;" +
"password=msadm;");
}catch(SQLException erro){
throw new RuntimeException(erro);
}
}
}[/code]
Teste.jsp
<%@page import="br.com.teste.Factory.ConnectionFactory"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
Connection con = new ConnectionFactory().getConnection();
out.write("Conexão realizada com sucesso!!");
con.close();
%>
</body>
</html>
Sem mais.
Agradeço aos que responderem.