Skip to Main Content

Data Science & Machine Learning

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

dbSendQuery using ROracle hangs while retrieving data

user9048328Jul 27 2020 — edited Aug 4 2020

Hi All,

I am facing issue with ROracle on Linux 7.X while fetching data from Oracle 12c Database (different box) using 18c client. While fetching data from R - R version 3.5.0 (2018-04-23) -- "Joy in Playing" using ROracle 1.3.1 and DBI 1.1.0 R package, process gets stuck and never comes out.

Psuedo code:

setwd("/srv/shiny-server/SimulationEngine_SIT/STDJD")

source("password_encryption.R")

library(ROracle)

library(DBI)

con <- dbConnect(drv=dbDriver("Oracle"),username=get_user(),password=get_decrypted_pass(),dbname=connect_string(),prefetch = FALSE)

S <- paste("select code, yearval, freq_code, freq_num, dataval from data_sim")

res <- dbSendQuery(con,S)

data <- fetch(res,n=-1)

When the last line is executed, process hangs and R console is not returned. Not sure where the problem lies , but i have never faced this issue earlier. Please help where am i going wrong here.Issue.png

Comments

gimbal2
Okay, lets filter that story of yours. What you are actually having difficulty with is running a command line utility using Java right? It has nothing to do with GnuPG specifically, so why base your entire question around it? Your thread title will now probably discourage people from coming here because they don't have experience with this tool you're using.

If you want to get help, ask clear questions. That also means drilling down to the core of your problem first.

Your first stop should be reading this article front to back:

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html


Also, read the forum faq to learn how to format the code you post. Right now it is quite a mess.
sabre150
As part of an article I have been writing on the use of Runtime.exec() and ProcessBuilder, for the last couple of weeks I have been writing a simple Java GUI that wraps the 'gpg' command line so I thought I would be able to help here but I don't think I can. You seem to have read some of the 'traps' article and to have implemented some of the recommendations but your exception handling makes your code just about unreadable. If a particular exception means that you have a system error then wrap it in an Error and throw that. If a particular exception means that the caller of your code has provided bad data then throw an exception to tell him that. If you can't think of what to do with an exception then don't do anything; just pass it back to the calling process. Never (well almost never) just smother an exception and just printing a stack trace then continuing is usually wrong.

Note - there is a pretty complete Pure Java PGP library available from BouncyCastle.
876084
thanks sabre 4your aid, you have been able to help me to an extent, let me see if i can do a work around on this because i have been able to implement everything even other processes in the GPG only this part of the creation of the key which if i do that manually using the command line in windows in a batch file it works but during my program it just gives error and just like you said i think i would take your advice and try see if it works well, and would have a look at the bouncy castle if it works like the GPG and every procedure is similar that would save me a lot of problem. thanks very much again.
gimbal2
user13340119 wrote:
thanks sabre 4your aid, you have been able to help me to an extent, let me see if i can do a work around on this because i have been able to implement everything even other processes in the GPG only this part of the creation of the key which if i do that manually using the command line in windows in a batch file it works but during my program it just gives error and just like you said i think i would take your advice and try see if it works well, and would have a look at the bouncy castle if it works like the GPG and every procedure is similar that would save me a lot of problem. thanks very much again.
Just to note: you may need to install the unlimited strength policy into your JRE if you want to use GPG encryption through BouncyCastle to allow encryption keys of any length.

http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html
876084
thanks sabre and gimbal2 for your assistance but i have checked this pgp implementation, i found out it is not open source, and i will love to work with this gnupg version because it is open source. also i found out the process is likely similar in generating keys in pgp but i do not seem to see where this part as specified by this website http://www.gnupg.org/gph/en/manual.html similar to http://www.seas.upenn.edu/cets/answers/pgp_keys.html in terms of the key generation; can be implemented via my application without actually interacting with the command prompt on windows which is my major problem. but i still appreciate your helpful details provided earlier, however, any further assistance would be much appreciated.

Edited by: user13340119 on Jul 20, 2011 6:13 AM
sabre150
user13340119 wrote:
thanks sabre and gimbal2 for your assistance but i have checked this pgp implementation, i found out it is not open source,
If you are referring to the BouncyCastle PGP then it most definitely is open source!
876084
after trying a lot of things i learnt a lot on my way and still come about the solution which is what i have pasted below in my codes, sorry for pasting it late.

thanks for all the assistance from the people that have helped me.

code_tags

//create key
public boolean createkey(String user, String regno, String email, String passphrase){
boolean success=false;
String other="Key-Type: RSA\n"
+ "Key-Length: 2048\n"
+ "Subkey-Type: ELG-E\n"
+ "Subkey-Length: 1024\n"
+ "Name-Real: "+ user+"\n"
+ "Name-Comment: "+regno+"\n"
+ "Name-Email: "+email+"\n"
+ "Expire-Date: 365\n"
+ "Passphrase: "+passphrase+"\n"
+ "%commit\n";
success = runGnuPG ("--gen-key --batch --yes --no-tty",other);
try{Thread.sleep(2000);//wait for operation to complete
}catch(Exception ex){}
if (success && this.gpg_exitCode != 0)
success = false;
return success;
}

code_tags

once again many thanks in advance.

Edited by: user13340119 on Aug 29, 2011 7:00 AM
1 - 7

Post Details

Added on Jul 27 2020
3 comments
360 views