Skip to content

Commit

Permalink
STL-734: Fixing error no suitable driver found when running LCM Brick…
Browse files Browse the repository at this point in the history
…s with environment C9S Java11
  • Loading branch information
hung-nguyen-hoang committed Sep 13, 2024
1 parent a20d93c commit 5c2845e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/gooddata/cloud_resources/mssql/mssql_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def initialize(options = {})
raise('Missing connection info for MSSQL client')
end

# When update driver class then also updating driver class using in connection(..) method below
Java.com.microsoft.sqlserver.jdbc.SQLServerDriver
end

Expand Down Expand Up @@ -90,7 +91,7 @@ def connect
prop.setProperty('userName', authentication['userName'])
prop.setProperty('password', authentication['password'])

@connection = java.sql.DriverManager.getConnection(connection_string, prop)
@connection = com.microsoft.sqlserver.jdbc.SQLServerDriver.new.connect(@url, prop)
end

def validate
Expand Down
3 changes: 2 additions & 1 deletion lib/gooddata/cloud_resources/mysql/mysql_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def initialize(options = {})
raise('Missing connection info for Mysql client')
end

# When update driver class then also updating driver class using in connection(..) method below
Java.com.mysql.jdbc.Driver
end

Expand Down Expand Up @@ -84,7 +85,7 @@ def connect
prop = java.util.Properties.new
prop.setProperty('user', @authentication['basic']['userName'])
prop.setProperty('password', @authentication['basic']['password'])
@connection = java.sql.DriverManager.getConnection(@url, prop)
@connection = com.mysql.jdbc.Driver.new.connect(@url, prop)
@connection.set_auto_commit(false)
end

Expand Down
3 changes: 2 additions & 1 deletion lib/gooddata/cloud_resources/postgresql/postgresql_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def initialize(options = {})
raise('Missing connection info for Postgres client')
end

# When update driver class then also updating driver class using in connection(..) method below
Java.org.postgresql.Driver
end

Expand Down Expand Up @@ -86,7 +87,7 @@ def connect
prop.setProperty('password', @authentication['basic']['password'])
prop.setProperty('schema', @schema)

@connection = java.sql.DriverManager.getConnection(@url, prop)
@connection = org.postgresql.Driver.new.connect(@url, prop)
statement = @connection.create_statement
statement.execute("#{POSTGRES_SET_SCHEMA_COMMAND} #{@schema}")
@connection.set_auto_commit(false)
Expand Down
3 changes: 2 additions & 1 deletion lib/gooddata/cloud_resources/redshift/redshift_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def initialize(options = {})
end
@debug = options['debug'] == true || options['debug'] == 'true'

# When update driver class then also updating driver class using in connection(..) method below
Java.com.amazon.redshift.jdbc42.Driver
end

Expand Down Expand Up @@ -83,7 +84,7 @@ def connect
prop.setProperty('DbUser', @authentication['iam']['dbUser'])
end

@connection = java.sql.DriverManager.getConnection(full_url, prop)
@connection = com.amazon.redshift.jdbc42.Driver.new.connect(@url, prop)
end

private
Expand Down
3 changes: 2 additions & 1 deletion lib/gooddata/cloud_resources/snowflake/snowflake_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def initialize(options = {})

end

# When update driver class then also updating driver class using in connection(..) method below
Java.net.snowflake.client.jdbc.SnowflakeDriver
end

Expand Down Expand Up @@ -80,7 +81,7 @@ def connect
prop.setProperty('warehouse', @warehouse)
prop.setProperty('db', @database)

@connection = java.sql.DriverManager.getConnection(@url, prop)
@connection = com.snowflake.client.jdbc.SnowflakeDriver.new.connect(@url, prop)
end

def build_url(url)
Expand Down

0 comments on commit 5c2845e

Please sign in to comment.