Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-7387][Agent] Fix error of SqlServer connector #7388

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class JobProfileDto {
/**
* sqlserver source
*/
public static final String SQLSERVER_SOURCE = "org.apache.inlong.agent.plugin.sources.SqlServerSource";
public static final String SQLSERVER_SOURCE = "org.apache.inlong.agent.plugin.sources.SQLServerSource";

private static final Gson GSON = new Gson();

Expand Down Expand Up @@ -293,12 +293,12 @@ private static SqlServerJob getSqlServerJob(DataConfig dataConfigs) {
SqlServerJob.SqlserverJobConfig config = GSON.fromJson(dataConfigs.getExtParams(),
SqlServerJob.SqlserverJobConfig.class);
SqlServerJob sqlServerJob = new SqlServerJob();
sqlServerJob.setUser(config.getUser());
sqlServerJob.setUser(config.getUsername());
sqlServerJob.setHostname(config.getHostname());
sqlServerJob.setPassword(config.getPassword());
sqlServerJob.setPort(config.getPort());
sqlServerJob.setServerName(config.getServerName());
sqlServerJob.setDbname(config.getDbname());
sqlServerJob.setServerName(config.getSchemaName());
sqlServerJob.setDbname(config.getDatabase());

SqlServerJob.Offset offset = new SqlServerJob.Offset();
offset.setFilename(config.getOffsetFilename());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public static class History {
public static class SqlserverJobConfig {

private String hostname;
private String user;
private String username;
private String password;
private String port;
private String dbname;
private String serverName;
private String database;
private String schemaName;

private String snapshotMode;
private String intervalMs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public SQLServerSource() {
@Override
public List<Reader> split(JobProfile conf) {
super.init(conf);
Reader sqlServerReader = new SQLServerReader();
SQLServerReader sqlServerReader = new SQLServerReader();
sqlServerReader.setReadSource(conf.getInstanceId());
List<Reader> readerList = new ArrayList<>();
readerList.add(sqlServerReader);
sourceMetric.sourceSuccessCount.incrementAndGet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ public String getReadSource() {
return instanceId;
}

public void setReadSource(String instanceId) {
this.instanceId = instanceId;
}

@Override
public void setReadTimeout(long mill) {

Expand Down Expand Up @@ -253,7 +257,7 @@ public void init(JobProfile jobConf) {

private Properties getEngineProps() {
Properties props = new Properties();
props.setProperty("name", "engine" + instanceId);
props.setProperty("name", "engine-" + instanceId);
props.setProperty("connector.class", SqlServerConnector.class.getCanonicalName());
props.setProperty("database.hostname", hostName);
props.setProperty("database.port", port);
Expand Down