Java-Informix

zoso
02 de Septiembre del 2005
Nom ereconoce el DRIVER de conexion a informix en el siguinete programa:

import java.sql.*;
//import java.io.*;

public class cnxInformix {

/**
* @param args
*/
public void Conexion(){

Connection con=null;
Statement stmt=null;
ResultSet rs=null;

try{

//DriverManager.registerDriver(com.informix.jdbc.IfxDriver);

String driver = "com.informix.jdbc.IfxDriver";

String url = "jdbc:informix-sqli://10.140.12.216:4848/siscam:INFORMIXSERVER=;Servicio Informix";

//String url = "jdbc:informix-sqli://123.45.67.89:1533:INFORMIXSERVER=myserver;user=rdtest;password=test;PROXY=webserver:1462";
//4848: Puerto de Mi servicio

String login = "ODBCinformix";
String password = "oracle";

Class.forName(driver);
con = DriverManager.getConnection(url,login,password );

stmt=con.createStatement();
rs=stmt.executeQuery("SELECT usutec FROM TSERINS WHERE serins='ACL'");

while (rs.next()){
System.out.println(rs.getString("usutec"));
}
}catch (ClassNotFoundException e){
System.out.println("No se pudo cargar el driver "+e.getMessage());
}catch(SQLException e){
System.out.println("SQLException atrapada "+e.getMessage());
}
finally{
try{
if (con!=null) con.close();
}
catch(SQLException ignorado){}
}
}

public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub

System.out.println("Comienza Main...");
cnxInformix con=new cnxInformix();
con.Conexion();
}

}