Connecting to Solaris... and using ftp command .....

Hi all,
actually i want to put file on another machine and operating system is solaris through ftp below is the code i have written but it shows
-bash-3.00# java NewClass2
/bin
Name (IP:root): Login incorrect.
?Invalid command
Please login with USER and PASS.
Please login with USER and PASS.
Please login with USER and PASS.
try
File wd = new File("/bin");
System.out.println(wd);
Process proc = null;
try {
   proc = Runtime.getRuntime().exec("/bin/bash", null, wd);
catch (IOException e) {
   e.printStackTrace();
if (proc != null) {
   BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
   PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
   out.println("cd /export");
   out.println("ftp ip");
   out.println("user");
   out.println("password");
   out.println("cd /dir");
   out.println("put file");
   out.println("quit");
   out.println("rm -rf file");
   out.println("exit");
try {
      String line;
      while ((line = in.readLine()) != null) {
         System.out.println(line);
      proc.waitFor();
      in.close();
      out.close();
      proc.destroy();
   catch (Exception e) {
      e.printStackTrace();
}

i have written this code now i just need to write put command in the commented area
please give me some hint..
public class FtpTest {
public static void main(String[] args) throws SocketException, IOException
    FTPClient ftp = new FTPClient();
    try {
       String userName = "user";
       String password = "password";
    String folder = "/dir";
      int reply;
      String server  = "ip";
      ftp.connect("ip");
      ftp.login(userName, password);
      System.out.println("Connected to " + server + ".");
      System.out.print(ftp.getReplyString());
      reply = ftp.getReplyCode();
      if(!FTPReply.isPositiveCompletion(reply)) {
        ftp.disconnect();
        System.err.println("FTP server refused connection.");
        System.exit(1);
  ftp.changeWorkingDirectory(folder);
FTPFile[] files = ftp.listFiles();
System.out.println("Number of file in dir: " +files.length );
Here i want to run put command.
which will put a file on server from where i am running code.
for(int i=0; i<files.length; i++)
  System.out.println("file Name : "+ files.getName() );
ftp.logout();
System.out.println("LogOut Successfully");
} catch(IOException e) {

Similar Messages

  • Dataset query issues twice if the dataset is connected to matrix and used in multilookup function

    hello everybody.
    could not find any information if this is an intended behavior:
    dataset query issues twice if the dataset is connected to matrix and used in multilookup function
    parameters in both queries are the same
    ssrs: 2008 r2, sharepoint 2010 integrated
    sharepoint 2010: september 2014 cu
    thanks in advance
    Sergey Vdovin

    Hello, Wendy.
    I prepared a very empty sample report for you to demonstrate the problem - with this report, i hope, there is no place to discuss the shrinking of time data retrieval.
    There is one dataset, one parameter and one lookup function. The query is executed twice.
    <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
    <AutoRefresh>0</AutoRefresh>
    <DataSources>
    <DataSource Name="DataSource1">
    <DataSourceReference>http://t005/ProjectBICenter/DocLib/IntegrationDBVdovin.rsds</DataSourceReference>
    <rd:SecurityType>None</rd:SecurityType>
    <rd:DataSourceID>7e554344-d6c2-48a5-a7f4-1d24608cb4b5</rd:DataSourceID>
    </DataSource>
    </DataSources>
    <DataSets>
    <DataSet Name="DataSet1">
    <Query>
    <DataSourceName>DataSource1</DataSourceName>
    <CommandText>select 1 as temp, '$' as tempname</CommandText>
    <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
    </Query>
    <Fields>
    <Field Name="temp">
    <DataField>temp</DataField>
    <rd:TypeName>System.Int32</rd:TypeName>
    </Field>
    <Field Name="tempname">
    <DataField>tempname</DataField>
    <rd:TypeName>System.String</rd:TypeName>
    </Field>
    </Fields>
    </DataSet>
    </DataSets>
    <ReportSections>
    <ReportSection>
    <Body>
    <ReportItems>
    <Textbox Name="ReportTitle">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Lookup(1,Fields!temp.Value,Fields!tempname.Value,"DataSet1")</Value>
    <Style>
    <FontFamily>Verdana</FontFamily>
    <FontSize>20pt</FontSize>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:WatermarkTextbox>Title</rd:WatermarkTextbox>
    <rd:DefaultName>ReportTitle</rd:DefaultName>
    <Top>0mm</Top>
    <Height>10.16mm</Height>
    <Width>139.7mm</Width>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </ReportItems>
    <Height>57.15mm</Height>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    </Style>
    </Body>
    <Width>152.4mm</Width>
    <Page>
    <PageFooter>
    <Height>11.43mm</Height>
    <PrintOnFirstPage>true</PrintOnFirstPage>
    <PrintOnLastPage>true</PrintOnLastPage>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    </Style>
    </PageFooter>
    <PageHeight>29.7cm</PageHeight>
    <PageWidth>21cm</PageWidth>
    <LeftMargin>2cm</LeftMargin>
    <RightMargin>2cm</RightMargin>
    <TopMargin>2cm</TopMargin>
    <BottomMargin>2cm</BottomMargin>
    <ColumnSpacing>0.13cm</ColumnSpacing>
    <Style />
    </Page>
    </ReportSection>
    </ReportSections>
    <ReportParameters>
    <ReportParameter Name="ReportParameter1">
    <DataType>String</DataType>
    <DefaultValue>
    <Values>
    <Value>1</Value>
    </Values>
    </DefaultValue>
    <Prompt>ReportParameter1</Prompt>
    <ValidValues>
    <DataSetReference>
    <DataSetName>DataSet1</DataSetName>
    <ValueField>temp</ValueField>
    <LabelField>tempname</LabelField>
    </DataSetReference>
    </ValidValues>
    </ReportParameter>
    </ReportParameters>
    <rd:ReportUnitType>Mm</rd:ReportUnitType>
    <rd:ReportServerUrl>http://t005/ProjectBICenter</rd:ReportServerUrl>
    <rd:ReportID>cd1262ef-eca7-4739-a2ce-d3ca832d5cd6</rd:ReportID>
    </Report>
    Sergey Vdovin

  • I have an ipod 4 can i connect to pc and, using itunes match, store all music off ipod and then transfer to a new ipod 5?

    i have an ipod 4 can i connect to pc and, using itunes match, store all music off ipod and then transfer to a new ipod 5?

    hI, bella
    I also met this issue a few days ago and I finally find out how to transfer music from iPod to computer:
    1. Plug your iPod in and wait for the computer to recognize it.
    2. Open up 'My Computer' and under 'Devices With Removable Storage', double click and open apple iPod.
    3. Click on 'Tools' at the top of the window and drag down to 'Folder Options'.
    4. Under the 'View' tab, find the subfolder called 'Hidden files and folders'.
    5. Select the option 'Show hidden files and folders'.
    6. Click 'OK'.

  • You can take a coldbackup from solaris and use it on windows NT?

    hi all,
    You can take a coldbackup from solaris and use it on windows NT?
    can we?
    regards
    girish

    khaja(DBA) wrote:
    Yes!!! why not
    Have you actually done this?
    Why not? Because the internal structure of the solaris files is different from Windows.
    >
    >
    Regards,
    khaja

  • SSIS and Secured FTP Commands to GET a Remote File using wildcards

    So my biggest caveat here is dealing with wildcards! For the life of me I cannot find any good examples of SSIS and scripting that uses FTP wildcards to GET certain Files. In a nutshell, here's what I need to do...
    Query a SQL Server Database which has a parsed File Name, the first 50 characters of the file name.
    The Query "Result Set" is put into an Object Variable User::SQLServerFileList
    I then utilize a "Foreach Loop Container" which reads the User::SQLServerFileList and puts it into Variable User::SQLServerFileNm...which is again the first 50 characters of the File Name
    Within the "Foreach Loop Container", I then utilize an "Expression Task" which builds a variable User::RemoteFileLookup which is a concatenation of the User::RemoteFolderPath + User::SQLServerFileNm + the wildcard *(Variable
    User::RemoteWildCard)
    I then try and utilize a "FTP Task" to use that concatenated Variable to go and GET the Filename but every time I try, it does not like what I'm sending via the "FTP Task"
    Error: 0x0 at TF Secure FTP Task, ExecuteTask Failed:: Illegal characters in path.
    I realize I might have to do something like this via C#.
    My biggest challenge is providing the GET Command via the Remote FTP Site with a parsed Filename and utilizing a wildcard.
    mc7i1231_20140227_050114_27_05_02_09*.999
    And the Filename that exists on the FTP Server is...
    mc7i1231_20140227_050114_27_05_02_09_x12_a43419452ca844a9b8a00f61e655dca3.x12-20140303180032.999
    Can any gurus out there PLEASE help me out???
    Thanks in advance for your review and am hopeful for a reply.
    PSULionRP

    Hi PSULionRP,
    According to the document
    FTP Task, we can read that:
    The FTP task supports the ? and * wildcard characters in paths. This lets the task access multiple files. However, you can use wildcard characters only in the part of the path that specifies the file name. For example, C:\MyDirectory\*.txt is a valid
    path, but C:\*\MyText.txt is not.
    So, when you use expression tobuild the variable RemoteFolderPath, make sure the evaluated value of the expression conforms to the above rule. 
    Regards,
    Mike Yin
    TechNet Community Support

  • Connect to multi instance use sqlplus command

    Hi Brother
    We would like to use following statement to connect to DB instance and execute script through sysdba but the statement seem not work, which connect to default DB only "db00", pls help
    sqlplus / "as sysdba" @db01 @/home/dba/myscript

    user460521 wrote:
    Hi Brother
    We would like to use following statement to connect to DB instance and execute script through sysdba but the statement seem not work, which connect to default DB only "db00", pls help
    sqlplus / "as sysdba" @db01 @/home/dba/myscriptUsing the convention of "multi-instance" would give an impression that you are willing to work in a RAC system. If yes, then you can use the command srvctl to manage more than one instance. But to run scripts or to execute some statement, you would need to connect only the designated instance using the properly configured TNSNAMES.ora file. So tell us clearly what you want to do and what you have done for it so far?
    Aman....

  • Allowing other users to connect via SSH and using X apps.

    My computer starts ssh as daemon and I can connect from other workstations, but I can't use ssh -X to use X apps.
    I usually do not need it, but when I do it is pretty annoying.
    I can connect to the university computer and use X apps, but I can't connect from uni to home... :S

    I just did this on the machine you have sshed into you want to set the DISPLAY variable to 192.168.1.5:0
    So if using bash it should be DISPLAY=192.168.1.5:0
    The ip address being the address of your computer that you trying to run the X apps on.
    I also believe you have to run xhost +
    So to sum it up:
    xhost +
    DISPLAY=192.168.1.5:0
    ssh -X ezzetabi@remotemachine

  • Filevault encryption paused, despite reset of PRAM and using terminal commands

    I have been trying to partition my HDD but am unable to because file vault encryption is paused - and has been since October 2014.
    I attempted making a new user to see if this would bypass it, but it didn't.
    I have reset the PRAM and have repaired the HDD both in recovery and normal, neither work.
    I have also used terminal command "sudo fdesetup disable" to attempt turning it off, but that doesn't work either.
    Help please??
    Harry

    If you don't already have a current backup of all data, back up before proceeding. There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    Start up in Recovery mode. When the OS X Utilities screen appears, select Disk Utility.
    In the Disk Utility window, select the icon of the startup volume from the list on the left. It will be nested below another disk icon, usually with the same name. Click the Unlock button in the toolbar. When prompted, enter the login password of a user authorized to unlock the volume, or the alternate decryption key that was generated when you activated FileVault.
    Then, from the menu bar, select
              File ▹ Turn Off Encryption
    Enter the password again.
    You can then restart as usual, if the system is working. Decryption will be completed in the background. It may take several hours, and during that time performance will be reduced.
    If you can't turn off encryption in Disk Utility because the menu item is grayed out, you'll have to erase the volume and then restore the data from a backup. Select the Erase tab, and then select
              Mac OS Extended (Journaled)
    from the Format menu.
    You can then quit to be returned to the main Recovery screen. Follow these instructions if you back up with Time Machine. If you use other backup software, follow its developer's instructions.
    Don't erase the volume unless you have at least two complete, independent backups. One is not enough to be safe.

  • Connecting 2 iMacs and using Syncopation

    For some reasen I just don't get it done: connecting two iMacs (with up to date software) and then using Syncopation 2.2 to make a back-up of my iTunes library.
    I'm not comfortable with 'networks' and this seems to play a role here.
    I have connected the two Macs using ethernet but I have the feeling I forget something or do something wrong.
    That, combined with the fact Syncopation provides very unsatisfactory instructions, makes that although the machines 'see' each other:
    a newly bought album is not back upped to the second Mac.
    If anyone can provide me with a step-by-step-manual-for-complete-dummies to solve this, I would be very, very grateful.
    Thanks!!!
    René van den Abeelen, the Netherlands

    We do not have any way to know how your app 'Syncopation" should work or is working.  You need to go on the web and contact Syncopation's web Techincal Support to get proper help with that.

  • Connection to XDB Repository using FTP

    I'm trying to connect to my server from a web browser using the FTP protocol. I can connect giving my login and password but the files doesn't display properly :
    ?????????? ? ???????? ??????? ???????? ??? ?? ??:?? xdbconfig.xml
    When I try to open the file i can't open it because the server has not been found...
    This service uses the port 2100 and the listener configuraiton is OK...
    Could you give me some advice ??
    Thank you very much...
    Lionel

    What version of XML DB ?.
    What Browser ?
    What is the database character set ?
    What is the client character set ?
    Do you have the same problem with a command line ftp client ?
    What language is the information in ?

  • Can I share my internet connection via wifi AND use my wireless printer at the same time?

    Not completely familiar with  wifi capabilities. I have this new setup in my office. I want to share my iMac internet connection via wifi so I can text and check emails using my iPhone (no cell service inside the building). Which works fine. However, I now cannot print wirelessly to my HP printer (LaserJet Pro 400 color). Once Internet sharing is off, I can print just fine. Any other wireless options, or just go get a long USB cable?

    Hi,
    It is not a multitasking printer, other devices may keep it therefore the best option in this case: connect it to your wireless router and all devices which are conntected to this router can sahre the printer.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • IPad is constantly connected to wireless and using up all my download limit

    My iPad is the only wireless device I have running and even when its turned off its still connecting to my wireless broadband. Its used up 5gb in less than two days!!! The only thing I can do to stop it is to put the iPad into flight mode or disable the wireless connection. Help!! What can I do to fix this?

    Cashper13 wrote:
    My iPad is the only wireless device I have running and even when its turned off its still connecting to my wireless broadband. Its used up 5gb in less than two days!!! The only thing I can do to stop it is to put the iPad into flight mode or disable the wireless connection. Help!! What can I do to fix this?
    I'm going to agree with everyone else. Unless your iPad is streaming movies and/or some other media content, or it's downloading hundreds of emails with photo attachments, it is seriously impossible.
    I bet you have not protected your router and someone is using your bandwidth.

  • Connecting to SQLPLUs and using DBCA

    hi
    i have just installed oracle 10g on a fresh windos xp machine and after installation, DBCA is not able to create database
    When it starts creating database, it returns error
    ORA-24324: Service handle not initializaed
    ORA-24323: Value not allowed
    ORA-28547: connection to server failed, probable Oracle Net admin error
    Some thing same i am facing if i use oracle 9i DBCA to create a database.
    If i try to use SQLPLSU to login to the database, it doesnt allow me and returns error of "hotsdef not found"
    let me tell you one thing that i am logged in to the OS as a domain user "salman.qureshi'
    Amaizingly if i log into the windows using local administrator, it allows me everthing to do.
    my domain user "salman.qureshi" is the member of local ORA_DBA group and also local administrator group (same groups as local ADMINISTRATOR user is connected)
    any clue?
    Regards

    Well i am on wondows XP,
    it doesnt let me connect to SQLPLUS unless i specify a TNS Service while connecting to a local DB, This is the reason that DBCA is not able to create a database, when i log into the system as local Admunistrator, it allows me to connect and create a database So i created a database.
    now if i log into the system using domain user, and write scott/tiger, it is returning error "end-of-file on communication channel"
    but if i use scorr/tiger@tnservice, it connects me
    Regards

  • Why when I try to copy any thing that I highlight and use the command c it does not copy?

    my command c to copy something that I highlight  does not work.

    Have you tried going to "Edit" from the menu at the top bar and select "Copy" that way?

  • Failed to connect to TOAD and used to work before the upgrade to APEX 3.1

    Hi,
    I installed Oracle XE 10g first, then installed several tools including TOAD, Oracle Forms and Reports all under a different ORACLE_HOME directory. I made sure they can all connect to the XE instance. Then I upgraded the Oracle APEX (Application Express) from the version 2.1 that comes with Oracle XE 10g to version 3.1.
    Now the Oracle APEX works properly and the Oracle Forms and Reports can still connect to the database, but I got error "ORA-12705: invalid or unknown NLS parameter value specified" when I tried to connect via TOAD.
    Any suggestions?
    Thanks,
    Mike

    http://www.dbmotive.com/oracle_error_codes.php?errcode=12705

Maybe you are looking for

  • How to connect macbook to smart tv

    I have a 2008 macbook and want to connect iT to my Samsung smart tv. I have bought a minidisplayport to HDMI adapter and get a gold video signal in my tv, bit no. sound. Does anyone know how to get. this right?

  • What's wrong with Mac G5 1.8 Machine?

    I've searched the net, I've searched the forum with the whole fan noise issues and seen all possible solutions but none has worked for me. I bought a used mac a while ago and now that I bought some PNY memory (2) 512MB chips that are designed specifi

  • Duplicate rows based upon condition

    Oracle 11.2.0.1 Windows create table regsales (billno number,itemno number,paymode varchar2(10)); insert into regsales values (12345,10,'cash'); insert into regsales values (12345,11,'cash'); insert into regsales values (12346,11,'cash'); insert into

  • Question about bundling application in Netbeans

    Hi All,           My question is regarding bundling an application in netbeans? At present I have my application all working fine when I build and clean or run the application within Netbeans. Sweet so far! However the standalone JAR that is created

  • Removing Schema name during calling Oracle Procedure

    Hi all, from my JPD I am trying to call a Stored Procedure in Oracle.But it is appending Scott.testsp which I dont want. This is not coded in jcx. Also I have built a connection pool and data source to oracle and tested connection.There I have specif