3
I am building an application from Netbeans IDE 8.1 and accessing the database developed in Sql server further when running the application this generates error:
Connection error The port number 1433/sistema_venda is not Valid
I already configured TCP/IP.
public class ConectaBanco {
public Statement stm;
public ResultSet rs;
private final String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
private final String caminho = "jdbc:sqlserver://localhost:1433/sistema_venda";
private final String user = "user";
private final String senha = "password";
public Connection conn;
public void conexao(){
try {
System.setProperty("jdbc.Driver", driver);
conn = DriverManager.getConnection(caminho, user, senha);
JOptionPane.showMessageDialog(null, "Conectado com sucesso!");
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null,"Erro de conexao " + ex.getMessage());
}
}
public void desconecta(){
try {
conn.close();
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null,"Erro ou achar a conexao " + ex.getMessage());
}
}
}
What is the name of the jar you are using for connection? The bank is created right? You can connect to it using any client ?
– Roknauta
Which instance are you using? MSSQL, Sqlexpress?
– Sorack
I am using sqljdbc42.jar . This yes straight.
– Orlando
I’m using sqljdbc42.jar. And the bank is right
– Orlando
the 'and ORLANDOJJCAWEND. Sql server
– Orlando