November 26, 200915 yr Witam, chcę ustanowić podstawowe połączenie pomiędzy JSP, a bazą danych utworzoną w MySQL. Do programowania używam nakładki na Eclipse - GlassFisha. Poniżej wklejam mój kod <%@page import="java.sql.*"%> <html> <head> <title>Obtaining a Connection</title> </head> <body> <h1>This Page Obtains a Connection to a Database and executes a query</h1> <% Class.forName("com.mysql.jdbc.Driver"); Connection connection= DriverManager.getConnection("jdbc:mysql://localhost:3306/books"); Statement statement= connection.createStatement(); ResultSet rs= statement.executeQuery("SELECT authorID, firstName, lastName FROM authors"); %> </body> </html> Za chu.ja nie chce to działać. Ciągle wyskakuje mi błąd "javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver". Domyślam się, że chodzi zapewne o odpowiedniego jara, ale zaimportowałem go do projektu poprzez Project->Properties->Build Path->Libraries->Add External Jar Błagam, pomocy.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.