Boa tarde,
Será que alguém pode me ajudar, tenho uma classe de conexão no meu projeto que aponta para um banco de dados SQL Server 98 e estou mudando o banco para o SQL Server 2012. Gostaria de saber se tenho que mudar alguma parametro de conexão ou é só apontar o nome do novo banco? Tenho que importar algum arquivo para o projeto? Obrigado.
Segue minha classe:
[code]
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
public class Conexao
{
public static String SQLSERVER = “jdbc:sqlserver”;
public static String URL = “jdbc:jtds:sqlserver://POSBR20:1433”;
public static String USER = “WEBUSER”;
public static String PASS = “22331133”;
public Connection getConexao(String bd) throws ClassNotFoundException, SQLException
{
if (bd.equalsIgnoreCase(SQLSERVER))
return getSqlServerConnection();
if (bd.equalsIgnoreCase(“jdbc:sqlserverbr7”))
return getSqlServerbr7Connection();
return null;
}
public Connection getSqlServerConnection()
throws ClassNotFoundException, SQLException
{
Class.forName(“net.sourceforge.jtds.jdbc.Driver”);
Properties prop = new Properties();
prop.setProperty("user", USER);
prop.setProperty("password", PASS);
Connection con = DriverManager.getConnection(URL, prop);
return con;
}
public Connection getSqlServerbr7Connection() throws ClassNotFoundException, SQLException
{
Class.forName(“net.sourceforge.jtds.jdbc.Driver”);
Properties prop = new Properties();
prop.setProperty(“user”, USER);
prop.setProperty(“password”, PASS);
Connection con = DriverManager.getConnection(URL, prop);
return con;
}
}[/code]