Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

websphere studio and mysql

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have websphere studio 5.0. I have downloaded the mysql jar file(mysql-connector-java-3.0.11-stable-bin.jar). I placed it in
"C:\Program Files\IBM\SQLLIB\java" . I wrote a simple dbase program trying to access database. Everytime I run the code it says "driver problem".
I am able to get connected thru data perspective in websphere studio. I have no clue why I get this when I connect thru my code?
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class dbservlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

PrintWriter out = resp.getWriter();
Connection connection = null;
try {
// Load the JDBC driver
String driverName = ""; // MySQL MM JDBC driver
// Create a connection to the database
String serverName = "localhost";
String mydatabase = "test";
String url = "jdbc:mysql://" + serverName + "/" + mydatabase; String username = "root";
String password = "root";
connection = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
out.println("driver problem");
} catch (SQLException e) {
out.println("not connected");
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic