You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/03 18:42:43 UTC

[GitHub] [beam] kennknowles opened a new issue, #18522: Add Apache Ignite IO

kennknowles opened a new issue, #18522:
URL: https://github.com/apache/beam/issues/18522

   Hi all,
   {color:#14892c}I tried to connect Apache Ignite(In-memory) via the beam's sdk:org.apache.beam.sdk.io.jdbc.JdbcIO
   Here, i am not sure if the JdbcIO sdk only is provided for some specific Database: MySQL(disk), postgreSQL(disk)?{color}
   my java test code is as follows:
   import java.sql.PreparedStatement;
   import java.sql.SQLException;
   import java.util.ArrayList;
   import java.util.List;
   
   import org.apache.beam.sdk.Pipeline;
   import org.apache.beam.sdk.io.jdbc.JdbcIO;
   import org.apache.beam.sdk.options.PipelineOptionsFactory;
   import org.apache.beam.sdk.transforms.Create;
   import org.apache.beam.sdk.values.KV;
   import org.apache.beam.sdk.values.PCollection;
   
   public class BeamtoJDBC {
   	public static void main(String[] args) {		
   		Integer[] value=new Integer[] {1,2,3,4,5};
   		List<KV<Integer, Integer\>\> dataList = new ArrayList<\>();
   		int n=value.length;
   		int count=0;
   		for (int i=0; i<n; i********)
   		{
   			dataList.add(KV.of(count,value[i]));
   			count=count****1;			
   		}
   		
   		Pipeline p = Pipeline.create(PipelineOptionsFactory.fromArgs(args).withValidation().create());
   		
   		PCollection<KV<Integer, Integer\>\> data=p.apply("create data with time",Create.of(dataList));
   
   		data.apply(JdbcIO.<KV<Integer, Integer\>\>write()
   				.withDataSourceConfiguration(JdbcIO.DataSourceConfiguration
   						.create("org.apache.ignite.IgniteJdbcDriver", "jdbc:ignite://localhost:11211/")
   						)		
   				.withPreparedStatementSetter(new JdbcIO.PreparedStatementSetter<KV<Integer, Integer\>\>() {
   					public void setParameters(KV<Integer, Integer\> element, PreparedStatement query)
   						throws SQLException {
   						query.setInt(1, element.getKey());
   						query.setInt(2, element.getValue());
   					}
   				})
   			);
   		p.run();
   
   	}
   }
   
   {color:#d04437}my error message is: 
   " InvocationTargetException: org.apache.beam.sdk.util.UserCodeException: java.sql.SQLException: Cannot create PoolableConnectionFactory 
   (Failed to establish connection.): Failed to get future result due to waiting timed out. "{color}
   
   {color:#14892c}I would like to know whether the connection between beam and ignite is feasible or not?{color}
   
   Thanks
   
   Rick
   
   
   Imported from Jira [BEAM-3073](https://issues.apache.org/jira/browse/BEAM-3073). Original Jira may contain additional context.
   Reported by: Ricklin.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org