on 10-08-2009 9:41 AM
Hello All,
I want to test the connection test for the FTP using telnet.
if any one have the java code please provide me........... i want to test it in mapping.
Thanks,
Chinna
Hi Chinna,
Check this below code
try
{
// create Ftp instance with FTP hostname, username and password as arguments
Ftp ftp = new Ftp("ftp.myserver.com","jsmith","secret");
// establish connection
ftp.connect();
}
Catch(Exception e)
{
System.out.println("Connection is not established due to this reason"+e);
}
For your reference
http://www.jscape.com/articles/simple_ftp_using_java.html
http://www.java2s.com/Code/Java/Network-Protocol/Establishftpconnection.htm
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can test the FTP connection using the folowing code
import java.net.*;
//write your code here
AbstractTrace trace = container.getTrace();
try
{
URL url = new URL("ftp://user:user@IPAddress/sender/salary.txt");
URLConnection yc = url.openConnection();
yc.connect();
}
catch( Exception e)
{
//write your message here
trace.addInfo(e.getMessage());
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
May be you have interest in the J2EE based application provided in SAP Note 1085539.
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply.
I want to check the connection test in the mapping.
for example if we want to test the FTP connection we can write the UDF and check the connection.
check the code for FTP connection test.
String checkFTP(String server,String username,String password,Container container){
boolean status=false;
try
{
FTPClient f=new FTPClient();
f.connect(server);
status=f.login(username, password);
if(status)
f.disconnect();
}
catch(Exception e)
{
}
if(status)
return "FTPOK";
else
return "FTPNOTOK";
In the same way i want to test the FTP connection using TELNET.
if any one have code please provide me.
Thanks,
chinna
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.