09/07/2006, 23:25
|
| | Fecha de Ingreso: julio-2006
Mensajes: 3
Antigüedad: 18 años, 6 meses Puntos: 0 | |
Prueba Esta coneccion ...
yo utilizo esta clase para hacer mis conecciones... y listo
package com.connection;
import java.sql.*;
public class IntrametConnection
{
//string de conexion a la BD
//----------------------------------------
private String connstring="jdbc:oracle:thin:@192.168.42.11:1521:p rod";
//----------------------------------------
//Username
//----------------------------------------
private String user="USER";
//----------------------------------------
//password
//----------------------------------------
private String password="PASSWORD";
//----------------------------------------
//constructor de la clase
//----------------------------------------
public IntrametConnection() throws SQLException
{
//System.out.println("init: OracleConnection()");
Statement st;
String strsql;
//se conecta a la BD
//-------------------------------------------------------------------
java.sql.DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//-------------------------------------------------------------------
DriverManager.setLoginTimeout(30000);
conn = java.sql.DriverManager.getConnection(connstring,us er,password);
st=conn.createStatement(java.sql.ResultSet.TYPE_SC ROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ON LY );
strsql =" alter session set nls_language ='American' ";
st.execute(strsql);
st.close();
}
//----------------------------------------
//conexion a la BD
//----------------------------------------
private Connection conn=null;
public Connection getconnection()
{
return conn;
}
//----------------------------------------
} |