Olá amigos:
Estou tendo o seguinte erro no Tomcat:
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class ’ ’ for connect URL ‘null’
Estou tentando criar um pool de conexão no Tomcat da seguinte maneira:
No arquivo context.xml da minha aplicação adicionei:
<Resource
name=“jdbc/Pontocom”
type=“javax.sql.DataSource”
username=“sa”
password=""
driverClassName=“com.microsoft.jdbc.sqlserver.SQLServerDriver”
url=“jdbc:microsoft:sqlserver://localhost:1433;SelectMethod=Cursor;DatabaseName=WebCache_2788”
maxIdle=“10”
maxWait="-1"
maxActive=“20”/>
No arquivo web.xml da minha aplicação adicionei:
<resource-ref>
<res-ref-name>jdbc/Pontocom</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
Criei um jsp para testar:
<%@ page language=“java” contentType=“text/html”
pageEncoding=“ISO-8859-1”
import=“java.sql., javax.sql., javax.naming.*”
%>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<title>Usando Pool de Conexo</title>
</head>
<body>
<%
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
Context ctx = (Context) new InitialContext().lookup("java:comp/env");
DataSource ds = (DataSource) ctx.lookup("jdbc/Pontocom");
conn = ds.getConnection( );
st = conn.createStatement( );
rs = st.executeQuery("select * from PETROCOM_Active_r");
while(rs.next( )) {
%>
<%= rs.getString("a_webc_url") %>
<%= rs.getString("language_code") %>
<%
}
} catch (Exception ex) {
ex.printStackTrace( );
} finally {
if (rs != null) rs.close( );
if (st != null) st.close( );
}
%>
</body>
</html>
Alguma ajuda???
Andre