Hi,
I created a bundle that contains the jdbc driver. Because I could not get it up and running I created a RCP Client application that uses this bundle and it works well. See the example below.
public class DBConnection {
public static Connection getConnection() {
Connection connection = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
}
catch (java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
catch (InstantiationException e) {
System.err.print("InstantiationException: ");
e.printStackTrace();
}
catch (IllegalAccessException e) {
e.printStackTrace();
}
try {
String connectionUrl = "jdbc:sqlserver://localhost:1433;database=MY_DB;";
connection = DriverManager.getConnection(connectionUrl, "user", "password");
}
catch (SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
return connection;
}
}
When I add the same bundle to a Scout Server and configure the SQL Service (see below) it cannot find the class.
(First it could not able to find the bundle but solved that with the help of ivan.motsch)
public class MsSqlService extends AbstractSqlService implements IService {
@Override
protected String getConfiguredJdbcDriverName() {
return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
}
@Override
protected String getConfiguredJdbcMappingName() {
return "jdbc:sqlserver://localhost:1433";
}
@Override
protected String getConfiguredJdbcProperties() {
return "database=MY_DB";
}
@Override
protected String getConfiguredPassword() {
return "password";
}
@Override
protected String getConfiguredUsername() {
return "user";
}
So the question is, what is different in Scout that this does not work. Is it something with different class loaders ? or do I have to make some more configurations to make it work?
Regards Bertin