Jdbc connection mssql empty URL
Hello i've got this code:
Code :
DatabaseManager.init("com.inet.tds.TdsDriver", "jdbc:inetdae:127.0.0.1?database=main", "username", "password", 10);
which links to:
Code :
public static void init(String JDBCDriver, String parURL, String parUserName, String parPassWord, int maxConnections) throws ClassNotFoundException, SQLException {
Class.forName(JDBCDriver);
URL = parURL;
userName = parUserName;
passWord = parPassWord;
openConnection();
}
But gives me this fault:
Code :
DatabaseManager.getConnection() : java.sql.SQLException: The url cannot be null
By this script:
Code :
public static void openConnection() throws SQLException{
connection = DriverManager.getConnection(URL, userName, passWord);
}
public static Connection getConnection() {
try {
if (connection!=null) {
if (connection.isClosed())
openConnection();
}
else {
openConnection();
}
} catch (SQLException e) {
System.out.println("deze fout: DatabaseManager.getConnection() : " + e);
return null;
}
return connection;
Does anyone have a clue why it tells me the url is empty?
Please let me know if you need to see more scripting