sun.jdbc.odbc.JdbcOdbcDriver from [Module "deployment.XXX.war:main" from Service Module Loader]
aoitora Apr 23, 2015 8:40 AMHello,
I'm currently trying to code in Eclipse a simple application (using jsp) where we have an internet page showing a catalog of books from a database. The problem is, I get this error sun.jdbc.odbc.JdbcOdbcDriver from [Module "deployment.myfirstProject.war:main" from Service Module Loader] and nothing else (see image attached) [the MyFirstServlet.java and web.xml are not related to this project].
With such an unexplicit error, it is quite difficult to solve that problem which might be, according to many links on Google, related to JBoss.
Here is my code (whose syntax is not coloured in the preview, I hope it will be once the post is sent)
MyApp.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" import="java.sql.*,java.io.*"%>
<!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">
<link rel="stylesheet" type="text/css" href="MyAppStyle.css">
<title>Gestion de stocks de livres</title>
</head>
<body>
<!-- Il faudra récupérer les livres depuis une base de données. Pour le moment, ils sont affichés directement.-->
<!-- Il faudra également indiquer "Epuisé" si qté==0 -->
<%
Connection conn = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:MYDATABASE","XXXX","XXXX");
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery("SELECT isbn, Titre_livre, auteur, quantite FROM Livres");%>
<table id="tableauDeLivres">
<tr><th>Titre</th>
<th>Auteur</th>
<th>ISBN</th>
<th>Quantité restante</th>
</tr>
<%
while (rs.next()){
System.out.println("test");
out.println("<tr>\n<td>"+ rs.getString("isbn")+"</td>");
out.println("<tr>\n<td>"+ rs.getString("titre_livre")+"</td>");
out.println("<tr>\n<td>"+ rs.getString("auteur")+"</td>");
out.println("<tr>\n<td>"+ rs.getString("quantite")+"</td>\n</tr>");
}
rs.close();
} catch (IOException ioe){
out.println(ioe.getMessage());
} catch (SQLException sqle){
out.println(sqle.getMessage());
} catch (ClassNotFoundException cnfe){
out.println(cnfe.getMessage());
} catch (Exception e){
out.println(e.getMessage());
}
finally{
try {
if (conn != null){
conn.close();
}
}
catch (SQLException sqle){
out.println(sqle.getMessage());
}
}
%>
</table>
<!-- <div id="boutons">
<input type="button" value="Ajouter un livre"> <input type="button" value="Supprimer la sélection"><input type="submit" value="Ajouter au panier"><br/>
<input type="button" value="Tout Cocher"><input type="button" value="Tout Décocher">
</div> -->
</body>
Any help is welcome!
EDIT : it appears that this error happens with another code I wrote, following a JSP book down to the last semi-column. I can connect to my base with a java class (to add data) but when it comes to the JSP file (to JBoss?) I've got this error.