Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Rudra Nath

Greenhorn
+ Follow
since May 12, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rudra Nath

I added kernel32.dll,msvcr80 and ocijdbc11.dll in tomcat/bin folder; still I'm facing error: UnsatisfiedLinkError:
5 years ago
I added following elements in my server.xml:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol" />
tcnative-1.dll is present in my tomcat/bin.
but after adding above element in my server.xml, tomcat is not running properly.
please help.
5 years ago
I've set java.library.path like this:
JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=512m -Djava.library.path=C:/apache-tomcat-6.0.36/lib/ocijdbc11.dll"
but I' m getting attached error.
5 years ago
three quote is typo.
I was selecting an image from a JSP file like this:
<script language="javascript">
function submitPage(content){

var myImg=document.getElementById("myImg");

document.myForm.action="/BeyondSmile/pages/home.jsp";
document.myForm.submit();
}
</script>
</head>
<body>
<form enctype="multipart/form-data" name="myForm" method="post">
<%
String loginId = request.getParameter("loginid");
System.out.println("newLeftPaneBody:loginId="+loginId);

File dir = new File("C:/Tomcat/apache-tomcat-6.0.32/webapps/BeyondSmile/images/tmp/"+loginId);
File[] children = dir.listFiles();
if (children == null) {
System.out.println("tmp is blank");
// Either dir does not exist or is not a directory
} else {
StringBuffer filename =null;
StringBuffer filenameAbs =null;
InputStream is = null;
for (int i=0; i<children.length; i++) {
filename =new StringBuffer();
filenameAbs =new StringBuffer();
filenameAbs.append("C:/Tomcat/apache-tomcat-6.0.32/webapps/BeyondSmile/images/tmp/"+loginId+"/"+children[i].getName());
filename.append("/BeyondSmile/images/tmp/"+loginId+"/"+children[i].getName());
is= new FileInputStream(filenameAbs.toString());
request.getSession().setAttribute("myImg",is);
%>
<input type="image" id="myImg" src="<%= filename.toString()%>" height="100" width="100" onclick="javascript:submitPage('myImg=<%= is %>');">
<input type="hidden" name="myImg" value='<%=is %>'>

Here I am seding image as hidden parameter.
In next JSP page, I am retriving it like this:
InputStream myImg = (InputStream)request.getSession().getAttribute("myImg");
and it is not null.
then I am trying to update it in database (Oracle 10g)
5 years ago
I have table where datatype of a column is CLOB.
String query = "update tablename set image=?'";
PreparedStatement st1=conn.prepareStatement(query);
st1.setBlob(1,new DataInputStream(myImg));
int retVal = st1.executeUpdate();

I am getting following error:
root cause

javax.servlet.ServletException: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CPreparedStatement.setBlob(ILjava/io/InputStream;)V
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)

Thanks for your help!
5 years ago
I did following in JAVA:

String query = "update mytable set image=? where column1= \'" +columnvalue+"\'";
PreparedStatement st1=conn.prepareStatement(query);
st1.setBinaryStream(1,new FileInputStream(myImg),(int)myImg.length());
st1.executeUpdate();

where myImg contains full path with filename where an image is stored.

But I am getting follwoing error:
java.sql.SQLException: not all varaibles bound.

What to do?
I wanted to store image from JAVA to Oracle 10 g .
I took following steps:
created a table with column type 'BINARY FILE LOB'.
My JAVA code is as follows for update:
String query = "update mytable set bfile_loc=bfilename(\'JPG_FILES\',\'"+myImg+"\') where name= \'" +frnd +"\'";
st.executeUpdate(query);

for fetching data from table I did as follows in resultSet:
while(rs.next()){
byte[] blobbytes = rs.getBytes("bfile_loc"); text = new String(blobbytes);
}
But I am getting follwing error:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:519)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:410)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause
javax.servlet.ServletException: java.sql.SQLException: ORA-22289: cannot perform FILEREAD operation on an unopened file or LOB

Please help.
6 years ago
Many Thanks Chris.
Your solution helped me!!!
Thanks again!!!
I installed Oracle XE in my PC and tried to connect to Oracle using JDBC.
I am getting error:"listener does not currently know of service requested in connect descriptor", while trying to connect to Oracle XE using JDBC.
Please help.
Please find below code snippet, and TNSNAMES.ORA for the database



error:
INFO: Jk running ID=0 time=0/64 config=null
29 Apr, 2012 1:00:23 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8264 ms
java.sql.SQLException: Listener refused the connection with the following error:

ORA-12514, TNS:listener does not currently know of service requested in connect
descriptor
The Connection descriptor used by the client was:
Rudre-PC:1521

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:260)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:386)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
413)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
n.java:34)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752)
at java.sql.DriverManager.getConnection(DriverManager.java:582)