Get Connection from connection Cache ???

Hi there,

I have created a DataSource in my EJb context, but when I'm performing a 
lookup a com.sybase.ejb.NamingContext is returned instead of a DataSource 
object, which means I'm unable to typecast it into a DataSource and perform 
the getConnection invocation.

Code:
java.util.Properties props = new java.util.Properties();
props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, 
          "com.sybase.ejb.InitialContextFactory");
props.put(javax.naming.Context.PROVIDER_URL, 
          "iiop://avenir_kpp:9000");
props.put(javax.naming.Context.SECURITY_PRINCIPAL, "jagadmin");
props.put(javax.naming.Context.SECURITY_CREDENTIALS, "");
context = new javax.naming.InitialContext(props); 
// The lookup below returns a com.sybase.ejb.NamingContext, but why?
Object o = context.lookup("java:comp/env/jdbc/MVJ"); 
// The line below fails of course 
ds = (DataSource)context.lookup("java:comp/env/jdbc/MVJ"); 

Jaguar.log:
Jun 27 19:08:28 2002: java.lang.ClassCastException: 
com.sybase.ejb.NamingContext com.sybase.ejb.NamingContext

Snapshop from property file:
com.sybase.jaguar.component.resource-ref=(description=,res-type=javax.sql.DataSource,res-auth=Container,res-sharing-scope=Shareable,res-link=MVJDB,res-ref-name=jdbc/MVJ)

Thanks in regards,
Jess

0
Jess_Nielsen
6/27/2002 5:56:13 PM
sybase.easerver.general 7903 articles. 0 followers. Follow

6 Replies
986 Views

Similar Articles

[PageSpeed] 17
Get it on Google Play
Get it on Apple App Store

Hi there,

I tried to restart the appserver and I'm now getting the following 
exception:

java.sql.SQLException: Acquiring application-authenticated supported only 
for JDBC2.0 DataSource caches
        <<no stack trace available>>

What does that mean? 

Doesn't your Connection caches supporting JDBC 2.0?

Thanks in regards,
Jess
0
Jess_Nielsen
6/27/2002 6:10:10 PM
Hi there,

I succeeded to retrieve the DataSource, but instead of retrieve a 
org.omg.CORBA.UNKNOWN exception will I get the Exception below instead - 
why?

Hope to hear from you soon.

Thanks in regards,
Jess

Client-side exception:
java.rmi.MarshalException: CORBA MARSHAL 0; nested exception is:
        org.omg.CORBA.MARSHAL:   minor code: 0  completed: No
org.omg.CORBA.MARSHAL:   minor code: 0  completed: No
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at com.sybase.CORBA.iiop.Connection.invoke(Connection.java:3569)
at database.DBEjb_Stub.getConnection(DBEjb_Stub.java)
at TestApplForm.jcb_1_actionPerformed(TestApplForm.java:169)
at TestApplForm.actionPerformed(TestApplForm.java:129)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)


Server-side exception:
Jun 27 20:57:47 2002: org.omg.CORBA.MARSHAL: 
java.io.NotSerializableException: 
com.sybase.jaguar.jndi.CosNaming.JagConnProxy  minor code: 0  completed: No
Jun 27 20:57:47 2002: at 
com.sybase.CORBA.ObjectVal.writeObject(ObjectVal.java:64)
Jun 27 20:57:47 2002: at 
com.sybase.CORBA._ServerRequest.write_value(_ServerRequest.java:147)
Jun 27 20:57:47 2002: at 
database._sk_tas_DBEjb.invoke(_sk_tas_DBEjb.java:248)
0
Jess_Nielsen
6/27/2002 7:33:01 PM
Jess:

Are you trying to send a ResultSet from the server to a client?


Jonathan



--
--------------------
Jonathan Baker
eBusiness Division
Sybase, Inc.


<Jess_Nielsen> wrote in message
news:194D4FCD3DDCCBE9006B64BA85256BE5.0066396785256BE5@webforums...
> Hi there,
>
> I succeeded to retrieve the DataSource, but instead of retrieve a
> org.omg.CORBA.UNKNOWN exception will I get the Exception below instead -
> why?
>
> Hope to hear from you soon.
>
> Thanks in regards,
> Jess
>
> Client-side exception:
> java.rmi.MarshalException: CORBA MARSHAL 0; nested exception is:
>         org.omg.CORBA.MARSHAL:   minor code: 0  completed: No
> org.omg.CORBA.MARSHAL:   minor code: 0  completed: No
> at java.lang.Class.newInstance0(Native Method)
> at java.lang.Class.newInstance(Class.java:237)
> at com.sybase.CORBA.iiop.Connection.invoke(Connection.java:3569)
> at database.DBEjb_Stub.getConnection(DBEjb_Stub.java)
> at TestApplForm.jcb_1_actionPerformed(TestApplForm.java:169)
> at TestApplForm.actionPerformed(TestApplForm.java:129)
> at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
>
>
> Server-side exception:
> Jun 27 20:57:47 2002: org.omg.CORBA.MARSHAL:
> java.io.NotSerializableException:
> com.sybase.jaguar.jndi.CosNaming.JagConnProxy  minor code: 0  completed:
No
> Jun 27 20:57:47 2002: at
> com.sybase.CORBA.ObjectVal.writeObject(ObjectVal.java:64)
> Jun 27 20:57:47 2002: at
> com.sybase.CORBA._ServerRequest.write_value(_ServerRequest.java:147)
> Jun 27 20:57:47 2002: at
> database._sk_tas_DBEjb.invoke(_sk_tas_DBEjb.java:248)


0
Jonathan
6/27/2002 8:04:04 PM
Hi Jonathan,

No I'm trying to parse a Connection through RMI, but maybe your connection 
object doesn't implement Serializable? If so do you have any 
suggestions/work-arounds that can be used instead?

Regards,
Jess
0
Jess_Nielsen
6/27/2002 9:01:20 PM
Jonathan or to whom it may concern,

I'm now returning the results of a ResultSet in an Enumeration and get this 
exception:

Remote I/F:
public Enumeration getResultSet() throws javax.ejb.EJBException

BeamImpl:
Vector resultSet = new Vector();
public Enumeration getResultSet() throws javax.ejb.EJBException
{
   return resultSet.elements();
}

Client:
java.util.Enumeration ite = instance.getResultSet();

ValueObjects in the Enumeration of class:
public class DataRow implements java.io.Serializable, java.lang.Comparable 
{
   private int rowId = 0;
   private int columnId = 0;
   private Object data = null;
   public boolean equals(Object o) { ... }
   public String toString() { ... }
   public XXX getXXX() { ... }
   public void setXXX( ... ) { ... }
}

Client-side exception:
java.rmi.MarshalException: CORBA MARSHAL 0; nested exception is:
org.omg.CORBA.MARSHAL:   minor code: 0  completed: No
org.omg.CORBA.MARSHAL:   minor code: 0  completed: No
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at com.sybase.CORBA.iiop.Connection.invoke(Connection.java:3569)
at database.DBEjb_Stub.getResultSet(DBEjb_Stub.java)
at TestApplForm.jcb_1_actionPerformed(TestApplForm.java:173)
at TestApplForm.actionPerformed(TestApplForm.java:129)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
at 
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
at 
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250

Server-side exception:
Jun 28 13:36:09 2002: org.omg.CORBA.MARSHAL: 
java.io.NotSerializableException: java.util.Vector$1  minor code: 0 
completed: No
Jun 28 13:36:09 2002:   at 
com.sybase.CORBA.ObjectVal.writeObject(ObjectVal.java:64)
Jun 28 13:36:09 2002:   at 
com.sybase.CORBA._ServerRequest.write_value(_ServerRequest.java:147)
Jun 28 13:36:09 2002:   at 
database._sk_tas_DBEjb.invoke(_sk_tas_DBEjb.java:330)
0
Jess_Nielsen
6/28/2002 12:15:35 PM
Jess:

Okay, I'm getting a better idea of what is going on now.

Connection is never serializable.  That is because it holds an open socket
to a Database, and there is no way to "serialize" a socket.

If you want to transmit ResultSets from the server to the client, that can
be done.  But, you can't use the standard java.sql.ResultSet (because it too
holds a socket to the database and is not serializable).

Use the TabularResults.ResultSet for transmission instead.
TabularResults.ResultSet is a CORBA compliant transmission format, and
therefore can be sent from a server to a client.  To convert a
java.sql.ResultSet to a TabularResults.ResultSet, use the following command:

  public TabularResults.ResultSet
     com.sybase.CORBA.jdbc11.IDL.getResultSet( java.sql.ResultSet )


and to convert the data back to a java.sql.ResultSet, use the command:

  public java.sql.ResultSet
     com.sybase.CORBA.jdbc11.SQL.getResultSet( TabularResults.ResultSet )


Finally, set the return type of your server method to be
TabularResults.ResultSet. You may also need to go in to the method
properties on the server to make sure this is set up correctly.  In the
server properties, the return type is just "ResultSet" (and appears in the
drop down list of return types).



Jonathan



--
--------------------
Jonathan Baker
eBusiness Division
Sybase, Inc.


<Jess_Nielsen> wrote in message
news:DFC3392C6CD440B200737AB685256BE5.0071941985256BE5@webforums...
> Hi Jonathan,
>
> No I'm trying to parse a Connection through RMI, but maybe your connection
> object doesn't implement Serializable? If so do you have any
> suggestions/work-arounds that can be used instead?
>
> Regards,
> Jess


0
Jonathan
6/28/2002 4:08:11 PM
Reply:

Similar Artilces:

Get connection from connection cache ??? #2
Hi, I am do all the setting for the connection cache and can look up the connection from JNDI space by : DataSource ds = (javax.sql.DataSource) nameCntxt.lookup("java:comp/env/jdbc/myAlias2DB"); Connection con = ds.getConnection(); Do it mean that I can get connection from the connection cache ??? when I close the con, the connection will be released ??? Thanks in Advanced !!! Answers inline... -- Jonathan Baker eBusiness Division Sybase, Inc. "Penny" <penny167169la@hotmail.com> wrote in message news:fdHbgpvLBHA.202@forums.s...

connection cache hangs when getting a DB connection
I have a PB9 component deployed in EAS 5.1 as a standard stateless component, transaction not supported, but we are using connection cache in EAS: here is the DB parm: dbms = O90 dbparm = disablebind=1,CommitOnDisconnect='NO',TimeStamp='NO',CacheName='DBConnection',GetConnectionOption='JAG_CM_WAIT' in activate we do connect using SQLCA; and de-activate we do a disconnect using SQLCA; programmatically we are handling commit and rollback to Oracle 9 DB connection (no setabort() or setcomplet() since component does not support a ...

not connected when I am connected
What do I need to change on my 'puter when the icon in the toolbar shows and tells me I am connected and the error message tells me I am not and I can not go to web pages, get or send emails. I have to close down and restart to get connected again. This only happens if I am on line and leave the 'puter for an hour or so. As long as I am using it I don't have a problem. This just started about a month ago. I am on very slow dialup, DSL and Cable not in my area, thanks you SBC/ATT tks Elaine wrote: > What do I need to change on my 'puter when the icon in ...

More general use of getting a connection from the pool (cache
Hello, Is it possible to get a connection from a pool (cache) without having powersoft specific classes in my code. Because this makes it not portable when I want to migrate to (let's say) another database... In the documentation they advise us to use : The JCM classes manage JDBC connections. Classes The JCM classes are: com.sybase.jaguar.jcm.JCMCache com.sybase.jaguar.jcm.JCM Java Connection Manager Example The example below implements a Java component that calls these JCM class methods: JCM.getCache(String, String, String) JCMCache.getConnection(int) JCMCache.relea...

connecting to wrong connection cache
Hi , every so often our PB objects end up connecting to the wrong connection cache ? we connect in the activate event , and dissconnect in the deactivate event. this is our dbparm : Disablebind=0,UseContextObject='Yes',CacheName='pm1step_test',GetConnectionO ption= 'JAG_CM_FORCE' ReleaseConnectionOption='JAG_CM_UNUSED' what else wound be causing this to happen ? any common problems ? using easerver 4.2 thanks for anyadvice Matt Hi, Matt, What do you mean, "wrong connection cache?" Does it connect to a cache with a name othe...

Connection Cache
Hi, I wonder if there's a way to detect the timestamp of the creation of the database connection from a connection pool ? The reason why I ask this strange question is, that I want to destroy all connections from the cache that were established before a certain timestamp. Thomas It's not clear to me as to why you would want to do that. There are a number of parameters you can set to control connection cache size, if you are simply concerned about the number of open connections. If the amount of time that a connection remains idle is a concern, you can set a time...

REPOST: PB components use only 1 connection from 50 connections connection cache
Hello all, I'm currently investigating a performance bottleneck in jaguar. I've reported this problem before and got some helpful hints from this forum so I'm back for more, since the hints weren't helpful enough. I have a web application which uses Powerbuilder components as the backend. Even when I generate 30 calls that each take 1 minute, the Jaguar server reports that it uses only one connection!! When I check oracle, it reports that only one session is active from the Jaguar server. Now I can just handle this if it was only one session but when i teste...

jdbc connection cache vs client library connection cache
I see options for Client Library to encrypt data by passing the information to the DBMS. But I don't see similar options for JDBC. Are the Sybase 11.0 encryption options only available through the Client Library driver? TIA, Tim The encryption you see of OpenClient is only to encrypt the password. The rest of the stream is i the clear. jConnect can go inside of SSL but you need to tunell, and detunnel etc etc. Dave Wolf Internet Applications Division Tim Nesham <tim.nesham@born.com> wrote in message news:38ac2dbf@news.qgraph.com... > I see options f...

How to setup connection property in Connection Cache using EAServer 3.6.1 + JDBC 2.0
Hi, The following properties is my connection cache property. Server Name ---> NetworkProtocol=Tds:Server=localhost:Port=4100:DatabaseName=odwas Class Name ---> com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource I am using the JDBC 2.0 to connect with my ASE 12.0 Server. I check all of the books about JDBC API. I could not find more information about connection property with JDBC 2.0 + Sybase jConnect 5.2. I already try to use the connection cache property file but it could not work. Do anyone know how to put the "PACKETSIZE" property to "Server Na...

connection cache problem Connection not open
I am able to connect to the connection cache the first few time. Then I will get this error. Is there a timeout or something? SQLSTATE = 08003 [Microsoft][ODBC Driver Manager] Connection not open also, some time i get this error: Feb 16 15:55:49 2001: cm__oci_error: Open Cursor. Feb 16 15:55:49 2001: cm__oci_error: Close failure. ---------------------------------------------------------------------------- --- Jaguar Memory Error: invalid prefix (40000002) for memory block (3109F9E0) (probably caused by the continued use of a freed memory block) ...

HELPHELP - cannot connect to connection cache
Hi, I cannot connect to my connection cache, see an extract of my srv.log file: .... Oct 11 17:27:39 2000: cm__odbc_alloc:alloc connection MEMORY_ERROR Oct 11 17:27:39 2000: cm__odbc_alloc:alloc connection MEMORY_ERROR Oct 11 17:27:39 2000: cm__odbc_alloc:alloc connection MEMORY_ERROR Oct 11 17:27:39 2000: cm__odbc_alloc:alloc connection MEMORY_ERROR Oct 11 17:27:39 2000: cm__odbc_error: SQLError: 0, SQLState: `�, . Oct 11 17:27:39 2000: Cannot connect .... Whats wrong ? I installed EA Studio 3.0 then updated to 3.5. The OS is Windows NT 4.0 Server. Thank you for any h...

database connection failed with connection cache
I have a connection cache on jag 3.6.1 using com.sybase.jdbc2.jdbc.sybdrives. I am able to ping the connection in jag manager. My problem is in PowerJ 3.6.1. I setup a transaction object using the database wizard(very cool), change it to use a cache and even find the connection cache on the server. when I try to test the connection, I first select a profile jconnect5 and try the connection. I get this error: database connection failed jz006: cought a IoException java.net.connectionException connection refused, no further info. any ideas would be great! You can only...

EAServer Connection caches
We are planning to have an application in Appeon with EAServer. We are going to rent the application to our customers, so each customer will have its own database, so I will need one connection cache for each database. If I have 1000 customers using the application, I would need 1000 connection caches, will EAServer support as many connections ? Thanks Hi, I consulted a consultant of Sybase before regarding this one. He said one of his projects has 6000 connection caches. Therefore, EAServer supports as many as 6000 connection caches. By the way, EAServer is version 5. I...

EAServer connection cache
I Can create jaguar connection cache . But i am not able to ping it. It gives error mesage. Indus In article <97F45D4374AB01230043313185256B19.004331B485256B19 @webforums>, Indus says... > I Can create jaguar connection cache . > But i am not able to ping it. > It gives error mesage. > Indus > What is the error message? Also what are your settings for the connection cache? Have you tried restarting the server? Mark -- Mark Pfeifer[TeamSybase] Corporate Technology Partners, Inc. mpfeifer at sprynet.com www.ctpartners.com ...

Web resources about - Get Connection from connection Cache ??? - sybase.easerver.general

Connection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iMedia Connection: Interactive Marketing News, Features, Podcasts and Video - iMediaConnection.com
High-quality data, if not used properly, can still lead marketers to make bad decisions. Consider these common ways that numbers are used to ...

HTTP persistent connection - Wikipedia, the free encyclopedia
... tacked on to an existing protocol. If the browser supports keep-alive, it adds an additional header to the request: Following this, the connection ...

CareerSonar Turns Facebook Friends Into Job Connections
Looking for a job ? Among your Facebook friends lies the potential for employment. CareerSonar , a new service, brings together a person’s connections ...

Man Charged With Aggravated Arson In Connection To Columbus Warehouse Fire
Police have charged 30-year-old Robin Toms with aggravated arson.

Adam Savage from 'MythBusters' has an incredible connection to the 'Star Wars' franchise
Adam Savage, co-host of the popular " MythBusters " television show, soured on the plot of "Interstellar." But when it comes to the newest films ...

Heavyset woman with facial hair arrested in connection to downto - CBS News 8 - San Diego, CA News Station ...
Police were on the lookout Thursday for a heavyset woman with facial hair who stabbed a man in the East Village.

Arrest made in connection with California mosque fire
CNN Arrest made in connection with California mosque fire CNN (CNN) A California man was arrested Saturday in connection with a fire at a ...

UK Police Make Arrest in Connection With VTech Hacking
British law enforcement officials arrest a 21-year-old man in connection with attack on toy maker VTech that exposed 6 million parents and children ...

"News Feed" For Slower Connections: Facebook's Strategy To Build A Stronger User Base
The changes in News Feed will more efficiently show relevant stories in a slow connection and let users compose comments when they are offline. ...

Resources last updated: 12/30/2015 3:12:32 PM