Código C#:
Ver original
protected Connection Con = null; protected PreparedStatement Pst = null; protected CallableStatement Cst = null; protected CachedRowSetImpl Crs = null; protected ResultSet Rs = null; protected final String SERVER = "ServerSQL"; protected final String DATABASENAME = "nameBD"; protected final String USER = "admin"; protected final String PASSWORD = "admin"; protected final String SECURITY ="false"; public void Open() { try { Con = null; String URL = "jdbc:sqlserver://" + SERVER + ";databaseName=" + DATABASENAME + ";integratedSecurity=" + SECURITY; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver()); Con = DriverManager.getConnection(URL,USER,PASSWORD); }catch(ClassNotFoundException ex){ JOptionPane.showMessageDialog(null,"Error En El Controlador SQL:" + ex.getMessage(),"Aviso",1); }catch(SQLException ex){ JOptionPane.showMessageDialog(null,"Error al conectarse al SQL Server 2008:" + ex.getMessage(),"Aviso",1); }catch(Exception ex){ JOptionPane.showMessageDialog(null,"Error:" + ex.getMessage(),"Aviso",1); } }
es decir ENCRIPTAR el envio del USUARIO y el PASSWORD para evitar alguna INJECCION o que entren o se conecten a mi BD sacando esta informacion