Error: package oracle.sql does not exist

Hello:

I am trying to compile the following java code and the get this error:
============================================
C:\>javac ftp_utility.java
ftp_utility.java:5: package oracle.sql does not exist
import oracle.sql.*;
^
ftp_utility.java:14: cannot resolve symbol
symbol  : class NUMBER
location: class ftp_utility
    NUMBER port,
    ^
2 errors
======================================
Here is my code:
======================================

import java.io.*;
import sun.net.ftp.*;
import oracle.sql.*;

import java.util.*;
import java.net.*;

public class ftp_utility {

public static void put(
    String host,
    NUMBER port,
    String username,
    String password,
    String sourceFile,
    String remoteDirectory ) throws Exception
    {

   // Modify system properties - 03/16/2005
     Properties sysProperties = System.getProperties();
     // Specify proxy settings
     sysProperties.put("proxyHost", "app-proxy"); //change IP address of proxy, apr-30-2004
     sysProperties.put("proxySet",  "true");
     sysProperties.put("proxyPort", "8080");
     System.setProperties(sysProperties);

     //sysProperties.put("socksProxySet", "true");
     ////sysprops.put("socksProxyHost", "socks.whitehouse.gov");
     //sysProperties.put("socksProxyHost", "ftpun01");
   //sysProperties.put("socksProxyPort", "8080");

        FtpClient ftpClient = null;

        try
        {
          int lastSlash = sourceFile.lastIndexOf('/');
          String file = sourceFile.substring(lastSlash + 1);
          String directory = sourceFile.substring(0, lastSlash);
          ftpClient = new FtpClient(host, port.intValue());
          ftpClient.login(username, password);
          ftpClient.cd(remoteDirectory);
          ftpClient.put(sourceFile);
         }
         finally
         {
          if (ftpClient != null)
          {
            ftpClient.closeServer();
          }
        }
    }
}

======================================

Could someone point out what am I missing here?  Thanks - Inayat
Inayat081501Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
You're not using the oracle package so you may as well remove the declaration. If you need it later, you'll have to put it in your classpath
0
CEHJCommented:
And 'port' can just be declared as int
0
Inayat081501Author Commented:
Hi CEHJ,

Thanks for your quick response. I commented out the line

import oracle.sql.*, and I changed NUMBER to int for port, and now I get the following error.
Please let me know. Thanks.
=====================================
C:\>javac ftp_utility.java
ftp_utility.java:44: int cannot be dereferenced
          ftpClient = new FtpClient(host, port.intValue());
                                              ^
1 error
=====================================
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

CEHJCommented:
Should be

 ftpClient = new FtpClient(host, port);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Inayat081501Author Commented:
hi CEHJ:

I got it. I changed

          ftpClient = new FtpClient(host, port.intValue());

to:
          ftpClient = new FtpClient(host, port);

and I was able to compile. However, I might come back to the forum for a little more clarification. Thanks. Inayat.
0
CEHJCommented:
ok
0
Inayat081501Author Commented:
CEHJ:

I am just learning some java. quite interesting.

I am now trying to call the "put" method in the above code, by passing hardcoded values for the various parameters. I need to have a main method. Correct? Say, if I want to have another method that calls the "put" method passing in
the values for the parameters as below, how do I do this?

ftpun01                            (string)
21                                   (numeric)
testuser                           (string)              
testpwd                           (string)
f:\clfy\infile\export123       (string)
\ftptest1                           (string)

Thanks - Inayat
0
CEHJCommented:
You could pass the values for put in the main method. I would put as few params as possible though or you're going to have parameter overkill. What's essential?
0
CEHJCommented:
To pass them all though, you can do:

public static void main(String[] args) {
      if (args.length < 6) {
            printUsageMessage(); // print a message showing correct parameter usage
      }
      else {
            put(args[0], Integer.parseInt(args[1]), args[2], args[3], args[4], args[5]);
      }
}
0
Inayat081501Author Commented:

In the code you have shown, within the main method, I want to hardcode the values of each of the 6 parameters to the specific values I have indicated above.  I don't want to pass arguments to the main method itself.

Thanks. Inayat
0
CEHJCommented:
In that case i'm getting confused. This is what i thought you were asking:

>>
Say, if I want to have another method that calls the "put" method passing in
the values for the parameters as below, how do I do this?
>>
0
Inayat081501Author Commented:
I am sorry I confused you.

Here is what I want to do. The put method takes in 6 parameters.

I want to be able to call this put method passing parameter values to it. How could I do this?

I thought I could do something like as I am showing below:

===========================================================
public static void main (String args[]) throws Exception {

String host = "ftpun01";
int port = 21;
String username = "bbb\\ijilani";
String password = "union28";
String sourceFile = "f:\\clfy\\infile\\export123";
String remoteDirectory = "\\ftptest1";

   put(host.toString(), port, username.toString(), password.toString(), sourceFile.toString(), remoteDirectory.toString());

}
===========================================================

I am getting errors when I run it, but it does compile.

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1444)
        at ftp_utility.put(ftp_utility.java:58)
        at ftp_utility.main(ftp_utility.java:24)

Could you please spot for me programmatic errors in the above code? --> Thanks - Inayat
0
CEHJCommented:
That error comes about because of

>>int lastSlash = sourceFile.lastIndexOf('/');

and there *is* no last forward slash
0
CEHJCommented:
:-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.