This discussion is archived
2 Replies Latest reply: Oct 3, 2012 10:48 AM by RaviJegga RSS

Re: Weblogic Data Source issue

965967 Newbie
Currently Being Moderated
Hai

i am write a program on data source to access database connection here is code but i am getting an exception at create statement

Hashtable<String, String> hashtable = new Hashtable<String, String>();
          hashtable.put(Context.INITIAL_CONTEXT_FACTORY,
          "weblogic.jndi.WLInitialContextFactory");
          hashtable.put(Context.PROVIDER_URL,
          "t3://localhost:7001");
          Context context = new InitialContext(hashtable);
          Connection connection = null;
          
          try{
          Object o = context.lookup("jdbc/jndi/test");
          DataSource dataSource = (DataSource) o;
          connection = dataSource.getConnection();
          Statement statement = connection.createStatement();
          ResultSet resultSet = statement.executeQuery("select empno,empname from testtest");
          while (resultSet.next()) {
               System.out.println(resultSet.getInt("empno")+"and"+resultSet.getString("empname"));
          }
          }
          catch (Exception e) {
               System.out.println("EXCCCCCC :::"+e);
          }
          finally{
               connection.close();
               //statement.close();
               //resultSet.close();
               
          }
          System.out.println("something different");


but i am getting exception as
EXCCCCCC :::java.sql.SQLException: weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:
[java.rmi.MarshalException: error marshalling return; nested exception is:
     java.io.NotSerializableException: oracle.sql.LobDBAccessImpl]

can anyone help me how to avoid this exception

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points