somenath chatterjee

Greenhorn
+ Follow
since Mar 20, 2008
Merit badge: grant badges
For More
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 somenath chatterjee


I have tried by adding following way:-
1) <prop key="hibernate.autoReconnect">true</prop> where ID is hibernateProperties in applicationContext-DAO.xml
2) For changing the URL as jdbc:sqlserver://10.20.10.48:1433; autoReconnect=true.

But still not getting an exception com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
thank you for reply, I have seen the MYSQl doc.Well, I am explain you the what is the problem actually I am getting.
I am using LOCK for a table(eg: Table A) in a method, And after complete process of that method doing UNLOCk that table(Table A)in finally block. But I got the LOCK Exception from different table(eg: Table B) of a different method on a select sql query. Which is doesn't have any relation with Table A. Please suggest me how to fixed this issue.
Hi,
I am using mysql version- 3.23.49a. Sometime i am getting a exception that is -
java.sql.SQLException: General error message from server: "Table 'X' was not locked with LOCK TABLES".
please send me solution if anybody had faced this kind of problem.
Thank you.
Thank you for you reply. Can you please guide me for how granted permission to the Oracle object.
Hi,

I am trying to call java method from oracle function to get hash code, please
refer the the code-

java code:
create or replace and compile java source named lookUpHash AS
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Encoder;

public class LookUpHash {

public static String getLHash(String colValue) {
String result = "";
try{
long l = 0;
String encryptValue = encrypt(colValue);
l = getHashCode(encryptValue);
result = String.valueOf(l);
}catch(Exception e){
e.printStackTrace();
}
return result;
}
public static String encrypt(String plainText){
BASE64Encoder encoder = null;
String encrypted = null;
byte[] keyBytes = "1234567890123456".getBytes();
try
{
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256);
SecretKey skey = keyGen.generateKey();
SecretKeySpec KeySpec = new SecretKeySpec(keyBytes, "AES");
Cipher AesCipher = Cipher.getInstance(skey.getAlgorithm());
AesCipher.init(Cipher.ENCRYPT_MODE, KeySpec);

encoder = new BASE64Encoder();
byte[] CipherText = AesCipher.doFinal(plainText.getBytes());
encrypted = encoder.encode(CipherText);
return encrypted;
}
catch(Exception e){
System.out.println("Exception in encrypt: "+e);
e.printStackTrace();
}
return encrypted;
}
public static long getHashCode(String value)
{
char val[] = value.toCharArray();
long hash = 1;
int len = value.length();
int j = 1;
for (int i = 0; i < len; i++ )
{
hash = 1 + hash + (++j * 500) + val[i];
}
return hash;
}

}

and oracle function is :
create or replace
FUNCTION oo(name VARCHAR2) RETURN VARCHAR2
AS LANGUAGE JAVA NAME 'HashSomu.getLHash(java.lang.String) return String';

but it is gave: ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException

I am sure it is return null value from encrypt().
please send me solution if any bady had faced this kind of problem.
Thank you
Hi,

I am using odbc5.jar(thin driver) for create connection with oracle database.
Now i want to get database name from connection object.
like in seq-server we use - connection.getCatalog().
but in oracle its return null.
please reply me if anybody know its solution.

thank you.
Hi,

I am new in xsl. And I am trying to increase count of a loop. As well as trying to change value of a xsl:varibale. So can you please help me to do that.
Hi,
I am using JAXB 2.1 for marshalling xml. When I run it in JDK 1.5 environment its working successfully. But when I use JDK 1.6 its giving a error �

org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/dmsuite/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:860)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/dmsuite/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:135)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:389)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:253)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:84)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:66)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
com.dmsuite.common.xmlUtility.provision.utils.ProvisionXMLGenerator.executeMarshalling(ProvisionXMLGenerator.java:96)
com.dmsuite.manager.environment.EnvironmentManagerImpl.getExecutionId(EnvironmentManagerImpl.java:1605)
com.dmsuite.manager.environment.EnvironmentManagerImpl$$FastClassByCGLIB$$ea699c62.invoke(<generated>
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:675)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:616)
com.dmsuite.manager.environment.EnvironmentManagerImpl$$EnhancerByCGLIB$$8253be56.getExecutionId(<generated>
com.dmsuite.web.environment.EnvironmentOverviewController.runJob(EnvironmentOverviewController.java:244)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:434)
org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:372)
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

Do you have any idea? What do I need to do?
14 years ago
Hi,

I am trying to marshal a xml file validating with a XSD file.
if any one had done like this please help me.
14 years ago
I am sending you the code, but its giving me an exception please tell me how can i handle this exception-

package remoteFileTest;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.net.URLConnection;

import org.apache.commons.net.ftp.*;

public class AccessRemotFile {

public static void main(String[] args) {

FTPClient ftp = null;
String usrID = "userID";
String pass = "password";
String url = "SystemIP";
//String fileName = "E:/vishal/vishal.txt";
File file = new File("E:/FOLDER/file.txt");

StringBuffer sb = new StringBuffer("ftp://");

sb.append(usrID);
sb.append(':');
sb.append(pass);
sb.append('@');
sb.append(url);
sb.append('/');
sb.append(':');
//sb.append(fileName);
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
System.out.println("sb: "+sb);
try {


URL url2 = new URL(sb.toString());
URLConnection connection = url2.openConnection();

bos = new BufferedOutputStream(connection.getOutputStream());
bis = new BufferedInputStream(new FileInputStream(file.getName()));

int i;
while((i = bis.read())!=-1){
bos.write(i);
}
} catch (Exception e) {
System.out.println("Exception in AccessRemotFile: "+e);
e.printStackTrace();
}finally{
if (bis != null) try { bis.close(); } catch (Exception ioe) { /* ignore*/ }
if (bos != null) try { bos.close(); } catch (Exception ioe) { /* ignore*/ }
}

}

}




Exception :

Exception in AccessRemotFile: java.net.ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.NetworkClient.openServer(Unknown Source)
at sun.net.ftp.FtpClient.openServer(Unknown Source)
at sun.net.ftp.FtpClient.openServer(Unknown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.getOutputStream(Unknown Source)
at remoteFileTest.AccessRemotFile.main(AccessRemotFile.java:42)
14 years ago
Hi friends,

I want to read a file from remote computer, verifying with user authentication using java.If any one done this kind of code please help me..
Thank you.
14 years ago
Hi,

Thanks for reply me. I have done with by rownum, its working. I am sending you the query please check it and let me know if any issues.

select * from ( select *, ROWNUM as rnum from table where ROWNUM <= "upperLimit" order by 1 ) where rnum > "lowerLimit"
Hi all,
I am sharing my problem to all of you for need help to resolve it.
I am going to retrieve millions data from a table.Now I want to retrieve data
part by part wise by ResultSet, giving some example like,a table having 1000 of rows now I want to retrieve those data in 10 steps. like in one steps ResultSet limit 0 to 100, and after finish 1 step 2nd ResultSet limit come 101 to 200.
So if you have done like this or faced like it. please reply me.
Hi all,
I want to copy date from one table to another with column type like eg: BLOB, CLOB, RAW, TimeStamp data. But when i am going to update timestamp datatype in target table its giving error:

Internal Error: Unable to construct a Datum from the specified input

giving some code for understanding clearly-

rs = stmt.executeQuery("SELECT COUNT(*) AS rowcount FROM "+ srcTable);
while(rs.next()){
rowCount = rs.getRow();

rSet = stmt.executeQuery("SELECT * FROM "+srcTable);
rsTarget = stmtTarget.executeQuery("SELECT "+srcColumn+" FROM "+tarTable);
while (rSet.next() && rsTarget.next()) {
if(srcColType.equals("BLOB")){

// this blob data successfily updating in target table try {
blobVal = rSet.getBlob(srcColumn);
rsTarget.updateBlob(srcColumn, blobVal);
} catch (Exception e) {
e.printStackTrace();}
/* this part showing error message Internal Error: Unable to construct a Datum from the specified input*/
try {
time = rSet.getTimestamp(srcColumn);
rsTarget.updateTimestamp(srcColumn, time);
} catch (Exception e) {
e.printStackTrace();}
rsTarget.updateRow();
}
}

Please Let me know if you faced similar problem and the solution if available
HI all I am working on a socket based application which is continuously running on specific port and listening client terminal request. For tracking request client request I used �
InetAddress netAdd = clientSocket.getInetAddress();
So when-ever client hit the server we can trace client IP address.

Now I am facing a problem that is- when I run the server socket, automatically a client hit the socket, but not sending any request and it lock the socket. So the socket can�t handle other request. For clear understanding I am giving also log message -

2008-04-01 03:36:06,170 INFO com.socket.Listener - Socket server started on port:*****
2008-04-01 03:36:06,245 INFO com.socket.Listener - Client InetAddress = /216.184.38.98
Let me know if you faced similar problem and the solution if available.