Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day everyone, I have been watching this video series as a guide line for my own netbeans e commerce project but at 27:00 the teacher test the data source but when I try to run the file one I got this error message. “jakarta.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc/OkStore2"” I’m on windows 11. The program versions I’m using are Apache Netbeans IDE 16, MySQL WorkBench 8.0 CE, Eclipse GlassFish 6.2.5 (build 6.x-b66-g0159b68 2022-02-12T17:39:59+0000). My driver is mysql-connector-j-8.0.31. https://www.youtube.com/watch?v=JlLGrqHSSjk&list=PLWS58wV27xi5AFrSfru26h4KWNMv1h2XA&index=7&ab_channel=CS.Math.Educator

Here's the error message https://i.stack.imgur.com/Pc1En.png


 Here's my TestDatasource code
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%-- 
    Document   : testDataSource
    Created on : Jan 6, 2023, 1:01:57 AM
    Author     : Bredy
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
        <sql:query var="result" dataSource="jdbc/OkStore2">
            SELECT * FROM category.product
            WHERE category.id = product.category_id
        </sql:query>

        <table border="1">
            <!-- column headers -->
            <tr>
                <c:forEach var="columnName" items="${result.columnNames}">
                    <th><c:out value="${columnName}"/></th>
                    </c:forEach>
            </tr>
            <!-- column data -->
            <c:forEach var="row" items="${result.rowsByIndex}">
                <tr>
                    <c:forEach var="column" items="${row}">
                        <td><c:out value="${column}"/></td>
                    </c:forEach>
                </tr>
            </c:forEach>
        </table>    
    </body>
</html>


What I have tried:

I tried moving mysql-connector-j-8.0.31 into different folders but that didn't work.
Posted
Updated 6-Jan-23 18:56pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900