tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Teh Noranis Mohd Aris <teh_nora...@yahoo.com>
Subject Using servlet and mysql
Date Tue, 29 May 2007 03:52:19 GMT
Hi,
   
  I would like to access mysql database from a servlet but I'm not sure what to initialize
for the String connectionURL marked as "jdbc:mysql://localhost:yyyy/xxx" in the program below.
I got this program from the internet which I would like to run in my computer. Can anyone
please explain to me what the parameters "yyyy" and "xxx" should be?
   
  Yours Sincerely,
  TEH
   
  Following is part of the program:
  .......
  public void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException{
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
String connectionURL = "jdbc:mysql://localhost:yyyy/xxx";
Connection connection=null;
try{
String username = request.getParameter("username");
String password = request.getParameter("password");
pw.println(username);
pw.println(password);
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "root", "root");
PreparedStatement pst = connection.prepareStatement
("insert into login_table values(?,?)");
  .......

       
---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message