tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Foo Shyn <foos...@optegra.com.my>
Subject Re: Using servlet and mysql
Date Tue, 29 May 2007 03:54:31 GMT
Hi,

yyyy would be ur database port, xxx will be ur database name

HTH
FooShyn

Teh Noranis Mohd Aris wrote:
> 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. 
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.472 / Virus Database: 269.8.0/821 - Release Date: 5/27/2007 3:05 PM
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message