<div dir="ltr">Hi,<div><br></div><div style>I have run into pretty unique problem with jCIFS and I'd welcome any help.</div><div style><br></div><div style>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:</div>
<div style><br></div><div style>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:</div><div style>
<br></div><div style><div> public static string createFile(String filename, Clob filecontent, String fileOut ) { </div><div> OutputStream out =null;</div><div> java.net.URL localURL;</div><div> InputStream content;</div>
<div> SmbFile toFile;</div><div> SmbFile newFile;</div><div> byte[] buf = new byte[4096];</div><div> try {</div><div> newFile = new SmbFile(fileOut);</div><div> toFile = new SmbFile( newFile, filename );</div>
<div> out = new SmbFileOutputStream(toFile);</div><div> content = filecontent.getAsciiStream();</div><div> </div><div> for(int len=-1;(len=content.read(buf))!=-1;){</div><div>
out.write(buf,0,len);</div><div> } </div><div> content.close();</div><div> out.close(); </div><div> } catch (Exception e) {</div><div> e.printStackTrace(); </div>
<div> return e.getMessage();</div><div> }</div><div> return filename;</div><div> }</div><div><br></div><div style>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.</div>
<div style><br></div><div style>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.</div><div style><br></div><div style>However now I'm stuck with:</div>
<div style><br></div><div style>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' )<br>
</div><div style><br></div><div style>It's worth to note that when I check in USER_JAVA_POLICY I have following entries:</div><div style><br></div><div style>SYS<span class="" style="white-space:pre"> </span>java.net.SocketPermission<span class="" style="white-space:pre"> </span>*<span class="" style="white-space:pre"> </span><span style="white-space:pre"> </span><span style="white-space:pre"> </span>*</div>
<div style>SYS<span class="" style="white-space:pre"> </span>java.net.SocketPermission<span class="" style="white-space:pre"> </span>localhost:1024-<span class="" style="white-space:pre"> </span>listen,resolve<br><br>at this moment I'm stuck. I have no ideas. <br>
<br>Any suggestion would be appreciated!</div><div style><br></div><div style>regards</div><div style>Paweł</div></div></div>