[jcifs] jCIFS, Oracle and errors

Paweł Matysiak pawel.jacek.matysiak at gmail.com
Tue Apr 9 08:39:25 MDT 2013


I have run into pretty unique problem with jCIFS and I'd welcome any help.

While I would prefer not to go into details what are the underlying
"business" decisions that put me into this position, I ended in situation
in which "optimal" solution is as follows:

I need to connect and create (and fill) file on smb:// resource folder
directly from Oracle database. To do this I created a relatively simple
java class with public static method:

    public static string createFile(String filename, Clob filecontent,
String fileOut ) {
        OutputStream out =null;
        java.net.URL localURL;
        InputStream content;
        SmbFile toFile;
        SmbFile newFile;
        byte[] buf = new byte[4096];
        try {
            newFile = new SmbFile(fileOut);
            toFile = new SmbFile( newFile, filename );
            out = new SmbFileOutputStream(toFile);
            content = filecontent.getAsciiStream();

            for(int len=-1;(len=content.read(buf))!=-1;){
        } catch (Exception e) {
            return e.getMessage();
        return filename;

I then deployed it and loaded into Oracle database (preceded by servlet.jar
and jcifs.12 jar archive). It loaded. I then created a function that was
mapped to the above method as well.

Then I tried to make a simple test run. It asked me for more privileges so
I asked DBA for them and I was granted.

However now I'm stuck with:

the Permission (java.net.SocketPermission localhost:1024- listen,resolve)
has not been granted to DATABASE_NAME. The PL/SQL to grant this is
dbms_java.grant_permission( 'MY_USER', 'SYS:java.net.SocketPermission',
'localhost:1024-', 'listen,resolve' )

It's worth to note that when I check in USER_JAVA_POLICY I have following

SYS java.net.SocketPermission *  *
SYS java.net.SocketPermission localhost:1024- listen,resolve

at this moment I'm stuck. I have no ideas.

Any suggestion would be appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20130409/343fad52/attachment.html>

More information about the jCIFS mailing list