Jump to content

JavaScript i połączenie z bazą danych


ShtaS

Recommended Posts

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.

Link to comment
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...