aspose file tools*
The moose likes Websphere and the fly likes websphere studio and mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "websphere studio and mysql" Watch "websphere studio and mysql" New topic
Author

websphere studio and mysql

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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 java.io.*;
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 {

resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "org.gjt.mm.mysql.Driver"; // MySQL MM JDBC driver
Class.forName(driverName);
// 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);
out.println("connected");
} catch (ClassNotFoundException e) {
out.println("driver problem");
} catch (SQLException e) {
out.println("not connected");
}
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: websphere studio and mysql