Tema: java Y asp
Ver Mensaje Individual
  #5 (permalink)  
Antiguo 15/01/2007, 18:18
Avatar de Nighter
Nighter
 
Fecha de Ingreso: enero-2007
Mensajes: 97
Antigüedad: 17 años, 4 meses
Puntos: 0
Re: java Y asp

si te sirve de algo aqui te mando un jababean muy sencillo que cree para conexion de base de datos (sin usar palabras rebuscadas o definiciones completas un java bean es una clase con caracteristicas y metodos solamente no usa el main por ejemplo)

Codigo:

Código PHP:
package beans;

import java.sql.*;

public class 
MsServer{

private 
Connection c;
private 
Statement statment;
      
private 
ResultSet result
private 
String argumentos
private 
int ban;
 
 public 
MsServer()
  {  }
  
 public 
void open()
{
try {
    Class.
forName("org.postgresql.Driver"); 
  } catch (
ClassNotFoundException cnfe) {
//    argumentos = cnfe.getMessage();
}

  
null;
  
  try {
    
DriverManager.getConnection("jdbc:postgresql://localhost:5432/database2","Nighter""dbadmon");
  } catch (
SQLException se) {
  
argumentos se.getMessage();

 }
  
}
  
  public 
ResultSet query(String arg) {
  try{
  
//argumentos = arg;
  
statment c.createStatement();
    
result statment.executeQuery(arg);
       
 }catch(
SQLException et){ 
   
System.out.println(et.getMessage()); 
}
 
finally{
return 
result
 }
 
}

public 
int IAB(String arg) {
  try{
  
//argumentos = arg;
  
statment c.createStatement();
   
ban statment.executeUpdate(arg);
       
 }catch(
Exception et){ 
   
System.out.println(et.getMessage()); 
}
 
finally{
return 
ban
 }
 
}

public 
void close()
{
 try{
 
statment.close();
  
   
c.close();     
}
catch(
Exception u){} 
}


lo complilas y usas las etiquetas de javabeans