I have a question about how to generate the Java JDBC connection URL in the Netbeans IDE to connect to an online SQL Server database.
Below is my code, which did not generate a connection like the database:
package teste.br.com.DAO;
import java.sql.Connection;
import java.sql.DriverManager;
public class ConexaoSQLServer {
Connection con = null;
String driverDB = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String rota = "jdbc:sqlserver//sqlserver01.BASE_DADOS.com.br;databaseName=NOME;user=USER;"
+ "password=PASS;";
public boolean ConectarBD(){
try{
Class.forName(driverDB);
con = DriverManager.getConnection(rota);
return true;
}
catch(Exception ex){
ex.getMessage();
return false;
}
}
}
When debugging netbeans, I noticed that the problem is connecting to the online database.