2013-08-27 12 views
7

पर प्रतिलिपि बनाने के लिए जावा एसडीके जावा जेडीबीसी कनेक्शन के माध्यम से एस 3 से रेडशिफ्ट से कॉपी कॉपी को फायर करना संभव है?Redshift

उदाहरण: 'S3: //' से प्रतिलिपि परीक्षण साख 'aws_access_key_id = xxxxxxx; aws_secret_access_key = XXXXXXXXX'

+0

नीचे के रूप में कोड की कोशिश हां। क्या आपने इसे आजमाया और एक त्रुटि मिली? – Guy

+0

बेशक यह समर्थित है। मामला क्या है? – ciphor

+0

आपने यह कैसे किया? इसके लिए कोई लिंक। ऐसा करने की कोशिश कर रहा है – dinesh707

उत्तर

5

हाँ

String dbURL = "jdbc:postgresql://x.y.us-east-1.redshift.amazonaws.com:5439/dev"; 
String MasterUsername = "userame"; 
String MasterUserPassword = "password"; 

      Connection conn = null; 
      Statement stmt = null; 
      try{ 
       //Dynamically load postgresql driver at runtime. 
       Class.forName("org.postgresql.Driver"); 


       System.out.println("Connecting to database..."); 
       Properties props = new Properties(); 


       props.setProperty("user", MasterUsername); 
       props.setProperty("password", MasterUserPassword); 
       conn = DriverManager.getConnection(dbURL, props); 
       stmt = conn.createStatement(); 
       String sql="copy test from 's3://' CREDENTIALS  'aws_access_key_id=xxxxxxx;aws_secret_access_key=xxxxxxxxx'" 
       int j = stmt.executeUpdate(sql); 

       stmt.close(); 
       conn.close(); 
      }catch(Exception ex){ 
       //For convenience, handle all errors here. 
       ex.printStackTrace(); 
      } 
संबंधित मुद्दे