Hi I recently updated the java version on my mac to 1.6.0_29 and now the following line continually causes my program to crash. Java does not throw an error it just runs endlessly and i have to force close it. The program works fine on my windows 7 pc so I am relatively sure that this bug has to do with the new update.
conn = DriverManager.getConnection(conurl, user, pass);
This is the function I have written along with my my driver. I am using sqljbdc4.
public static Connection dbCon(String conurl, String user, String pass, String db) throws SQLException, ClassNotFoundException{
String JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
Connection conn;
Statement stmt;
String sql;
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(conurl, user, pass);
stmt = conn.createStatement();
sql = "USE "+db;
stmt.executeUpdate(sql);
return conn;
}
I’ve had success on Java 1.6 using the JTDS driver. I’m personally using Linux, but have a coworker using the same driver on his MacBook.