JSP (Java Server Page) - Urge ayuda!!!!!

 
Vista:

Urge ayuda!!!!!

Publicado por ana (2 intervenciones) el 17/05/2006 17:17:21
Hola. Yo quiero hacer una aplicacion web. De momento he hecho:
La programacion de clases en Java con JBuilder.
La base de datos com MySql 5.0.21.
Creo que necesito tomcat pero no tengo muy claro para que, me he descrgado tomcat 5.5.17.
Y ahora tengo que conectarlo todo y no se como????
Me he descargado un controlador JDBC pero no consigo conectarme a la base de datos, alguien me puede ayudar u orientar un poco.
Que mas necesito, JSP o servlets o que? y se puede implementar jsp con el JBuilder?
El diseño de la web con que deberia hacerlo?
Espero vuestra ayuda, es urgente.
Y muchas gracias por anticipado.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Urge ayuda!!!!!

Publicado por bizkit (3 intervenciones) el 19/05/2006 13:57:55
Una classe como esta y JDBC es todo lo que necessitas para conectar.
/*
* DAO.java
*
* Created on 25 de noviembre de 2005, 14:14
*
* To change this template, choose Tools | Options and locate the template under
* the Source Creation and Management node. Right-click the template and choose
* Open. You can then make changes to the template in the Source Editor.
*/

package com.boikot.etaller;
import java.sql.*;
import java.util.*;
/**
*
* @gverge
*/
public class DAO{
static boolean registrat=false;
private String url,usr,psw;

/** Creates a new instance of DAO */
public DAO() {
}
public Connection getConnexio(){
Connection con=null;
ResourceBundle bdconfig = ResourceBundle.getBundle("com/boikot/etaller/config");
url=bdconfig.getString("url");
usr=bdconfig.getString("usr");
psw=bdconfig.getString("psw");
try{
if(registrat==false){
Class.forName("com.mysql.jdbc.Driver").newInstance();
registrat=true;
}
con=DriverManager.getConnection(url,usr,psw);
}catch(ClassNotFoundException e){
System.out.println(e);
}catch(IllegalAccessException e){
System.out.println(e);
}catch(InstantiationException e){
System.out.println(e);
}catch(SQLException e){
System.out.println(e);
}


return con;
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar