Antwort: Re: DBCP/JDBC Problems with DelegatingResultSet

2005-04-13 Thread Sebastian . Wiemer
 
 [EMAIL PROTECTED] 
 .com  An
Tomcat Users List  
 12.04.2005 17:26   tomcat-user@jakarta.apache.org
 Kopie
   
  Bitte antwortenThema
an  Re: DBCP/JDBC Problems with
   Tomcat UsersDelegatingResultSet
   List   
 [EMAIL PROTECTED] 
  rta.apache.org  
   
   
   




Do you mean that perhaps you are trying to access
SYBASE specific JDBC extensions?  If so, then you need
the inner most delegate connection.  I did this with
Oracle:

I also had this parameter in my JNDI declaration in
the server.xml...

parameter

nameaccessToUnderlyingConnectionAllowed/name
valuetrue/value
  /parameter

Then I used this static method that I wrote.  Just
pass in the JNDI data source name.  BUT...be careful,
DO NOT close this underlying connection, or your next
call will have the overhead of recreating the
underlying connection object for DBCP:

public static synchronized Connection
getDelegatingConnection(
String dataSource) throws
SQLException,NamingException,Exception {

final String JNDI_LOOKUP = java:comp/env;

Connection conn = null;
OracleConnection oc = null;

Context initCtx = new InitialContext();
Context envCtx = (Context)
initCtx.lookup(JNDI_LOOKUP);

if (envCtx == null) {
throw new Exception(No
EnvironmentContextException);
}

DataSource ds = (DataSource)
envCtx.lookup(dataSource);
if (ds == null) {
throw new Exception(No
DatasourceException);
}

((BasicDataSource)
ds).setAccessToUnderlyingConnectionAllowed(true);

conn = ds.getConnection();
if (conn == null) {
throw new Exception(No
ConnectionException);
}

Connection dconn = ((DelegatingConnection)
conn).getInnermostDelegate();

if (dconn == null) {
throw new Exception(No
DelegatingConnectionException);
}

conn.close();
conn=null;

return dconn;
}

Regards,

Jimmy Ray
--- [EMAIL PROTECTED] wrote:




 Hello,

 I need some help accessing low level routines using
 JDNI based connection
 pooling provided by tomcat.

 Environment:  J2SE 1.4.2
 Tomcat: 5.5
 JDBC-Driver:  Sybase JConnect 5.5 (TDS)

 The Tomcat is configured to provide a small
 connection pool.

 Within my servlet i need access to the low-level
 implementation of the
 ResultSet from Sybase.
 The problem is, that the following code:

 Connection conn = dataSource.getConnection();
 Statement stmt = conn.getConnection();
 ResultSet result = stmt.executeQuery( ... );

 System.out.println( result.getClass().getName() );

 prints
 org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.

 I couldn't find a api documentation for this class
 nor could i find the jar
 file providing this class
 at all in the tomcat installation directory.

 Can anyone give a hint in which JAR archive this
 class can be found ?



 Mit freundlichen Grüßen / Kind regards
 Sebastian Wiemer

 
 Sebastian Wiemer
 GfK Group
 Data Services GmbH
 Nordwestring 101
 D-90319 Nürnberg
 Fon: +49 (0) 911 395 3876
 Fax: +49 (0) 911 333 796
 [EMAIL PROTECTED]
 www.gfk.de / www.gfk.com
 



 _

 Diese E-Mail (ggf. nebst Anhang) enthält
 vertrauliche und/oder rechtlich
 geschützte Informationen. Wenn Sie nicht der
 richtige Adressat sind, oder
 diese E-Mail irrtümlich erhalten haben, informieren
 Sie bitte sofort den
 Absender und vernichten Sie diese Mail. Das
 unerlaubte Kopieren sowie die
 unbefugte Weitergabe dieser Mail ist nicht
 gestattet.

 This e-mail (and any attachment/s) contains
 confidential and/or privileged
 information. If you are not the intended recipient
 (or have received this
 e-mail in error) please notify the sender
 immediately and destroy this
 e-mail. Any unauthorised copying, disclosure or
 distribution of the
 material in this e-mail is strictly forbidden.
 _



-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED

Antwort: RE: class path (UNCLASSIFIED)

2005-04-13 Thread Sebastian . Wiemer




Sorry maybe you already did that. I'm new to the Mailing-List.

But is it possible to have a look at the source code of you're
HelloWorld.java file ?

Is it possible that your HelloWorld class is packaged into a special
package and the
class file is generated under that directory, but not obviously in the root
directory
where you started the cmd 'javac HelloWorld.java' ?

regards
Sebastian




S M [EMAIL PROTECTED] schrieb am 13.04.2005 17:51:50:

 see this... no errors... but no class file for the same 

 C:\javacodejavac -classpath c:\tomcat\common\lib\servlet.jar
HelloWorld.java
 C:\javacodejavac -classpath c:\tomcat\common\lib\servlet.jar
 HelloWorld.java

 C:\javacodejavac HelloWorld.java


 David B. Saul [EMAIL PROTECTED] wrote:
 Try typing/copying the following at the prompt in the directory where the
 source code is for HelloWorld.java:

 javac -classpath C:\Program Files\Apache Group\Tomcat
 4.1\common\lib\servlet.jar HelloWorld.java

 if in fact this is where the servlet.jar file exists.



 -Original Message-
 From: BAO RuiXian [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 13, 2005 8:15 AM
 To: Tomcat Users List
 Subject: Re: class path (UNCLASSIFIED)


 Hello,

 S M wrote:

 tried that too... but it can't identify the path.
 
 C:\javacodejavac -classpath 4.1\common\lib HellWorld.java
 
 
 

 Try use quotes instead of '' and '' to quote the class path.

 Good luck.

 Bao

 The system cannot find the file specified.
 
 anyways.. now will reinstall as suggested 'without' spaces and will let
 you know.. thanks so far
 
 Samara, Fadi N Mr ACSIM/ASPEX wrote:
 Classification: UNCLASSIFIED
 Caveats: NONE
 
 Try compiling the class by including the path for servlet.jar in your
 javac command, if you haven't done that yet.
 
 -Original Message-
 From: S M [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 13, 2005 10:33 AM
 To: Tomcat Users List
 Subject: RE: class path (UNCLASSIFIED)
 
 I compiling it from the command prompt.
 The sourse code is in c:\javacode
 so i on cmd... i change directory to c:\javacodejavac HelloWorld.java
 
 Samara, Fadi N Mr ACSIM/ASPEX wrote:
 Classification: UNCLASSIFIED
 Caveats: NONE
 
 I am sorry, but how are you compiling your class ?
 Are you using any IDE (i.e Eclipse, Jdeveloper) ?
 
 -Original Message-
 From: S M [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 13, 2005 10:07 AM
 To: Tomcat Users List
 Subject: RE: class path (UNCLASSIFIED)
 
 The same as before.
 
 C:\javacodejavac HelloWorld.java
 HelloWorld.java:2: package javax.servlet does not exist import
 javax.servlet.*; ^
 HelloWorld.java:3: package javax.servlet.http does not exist import
 javax.servlet.http.*; ^
 HelloWorld.java:5: cannot resolve symbol symbol : class HttpServlet
 location: class HelloWorld
 public class HelloWorld extends HttpServlet { ^
 HelloWorld.java:7: cannot resolve symbol symbol : class
HttpServletRequest
 location: class HelloWorld
 public void service(HttpServletRequest request, HttpServletResponse
 response) th rows ServletException, IOException { ^
 HelloWorld.java:7: cannot resolve symbol symbol : class
HttpServletResponse
 location: class HelloWorld
 public void service(HttpServletRequest request, HttpServletResponse
 response) th rows ServletException, IOException { ^
 HelloWorld.java:7: cannot resolve symbol symbol : class ServletException
 location: class HelloWorld
 public void service(HttpServletRequest request, HttpServletResponse
 response) th rows ServletException, IOException {
 
 ^
 6 errors
 
 -
 
 Samara, Fadi N Mr ACSIM/ASPEX wrote:
 Classification: UNCLASSIFIED
 Caveats: NONE
 
 What errors are you getting again ?
 
 -Original Message-
 From: S M [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, April 13, 2005 9:47 AM
 To: Tomcat Users List; Jason Bainbridge
 Subject: Re: class path
 
 Hi
 These are the env. variables that I have set explicitly for tomcat 4.1
 installation
 
 lJAVA_HOME = C:\java\bin
 lCATALINA_HOME = C:\Program Files\Apache Group\Tomcat 4.1 CLASSPATH=

.;C:\javacode;%CATALINA_HOME%;%CATALINA_HOME%\common\lib\servlet.jar;%J2EE

 _
 HOME%\lib\j2ee.jar;
 
 I have the path =C:\java\bin; when i installed
 J2sdk1.4.2_06
 
 
 
 These being the variables I am still getting that error log where the
 compiler cannot locate the servlet pakages.
 
 Hope you can assit further.
 
 Thanks.
 
 
 
 Jason Bainbridge wrote:
 On Apr 12, 2005 3:39 PM, S M wrote:
 
 
 sorry for the confusion, but i have set CLASSPATH, i echoed on cmd as
 mentioned and yes it shows me the CLASSPATH as listed below
 
 
 .;C:\javacode;%CATALINA_HOME%;%CATALINA_HOME%\common\lib\servlet.jar;%
 J2EE_
 HOME%\lib\j2ee.jar;
 
 
 where ;C:\javacode had the source code.
 
 
 
 Have you explicityly set CATALINA_HOME as well? Does it have spaces in
 it? If so surround it with double quotes or move it to a path with no
 spaces. I don't think having servlet.jar and j2ee.jar in the 

DBCP/JDBC Problems with DelegatingResultSet

2005-04-12 Thread Sebastian . Wiemer




Hello,

I need some help accessing low level routines using JDNI based connection
pooling provided by tomcat.

Environment:  J2SE 1.4.2
Tomcat: 5.5
JDBC-Driver:  Sybase JConnect 5.5 (TDS)

The Tomcat is configured to provide a small connection pool.

Within my servlet i need access to the low-level implementation of the
ResultSet from Sybase.
The problem is, that the following code:

Connection conn = dataSource.getConnection();
Statement stmt = conn.getConnection();
ResultSet result = stmt.executeQuery( ... );

System.out.println( result.getClass().getName() );

prints org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.

I couldn't find a api documentation for this class nor could i find the jar
file providing this class
at all in the tomcat installation directory.

Can anyone give a hint in which JAR archive this class can be found ?



Mit freundlichen Grüßen / Kind regards
Sebastian Wiemer


Sebastian Wiemer
GfK Group
Data Services GmbH
Nordwestring 101
D-90319 Nürnberg
Fon: +49 (0) 911 395 3876
Fax: +49 (0) 911 333 796
[EMAIL PROTECTED]
www.gfk.de / www.gfk.com




_

Diese E-Mail (ggf. nebst Anhang) enthält vertrauliche und/oder rechtlich
geschützte Informationen. Wenn Sie nicht der richtige Adressat sind, oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail (and any attachment/s) contains confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this
e-mail. Any unauthorised copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.
_


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Retrieving driver-specific implementation of ResultSet

2005-04-12 Thread Sebastian . Wiemer




Hi,

as Marco helped me to solve my previous problem, i'm now facing the next
one.

It seems the org.apache.tomcat.dbcp.dbcp.DelegatingResultSet does not
provide any facility to
retrieve the wrapped ResultSet.

What i need is access to the driver specific implementation of the
ResultSet for the used connection pool.

DelegatingResultSet.getInnermostDelegate() only returns the innermost
DelegatingResultSet instance.

Is there any hack out there which provides something like
DelegatingResultSet.getWrappedResultSet() ?

Or does anyone have another/better idea to get access to the low-level
implementation ?

Thanx, so far
Sebastian

_

Diese E-Mail (ggf. nebst Anhang) enthält vertrauliche und/oder rechtlich
geschützte Informationen. Wenn Sie nicht der richtige Adressat sind, oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail (and any attachment/s) contains confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this
e-mail. Any unauthorised copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.
_


_

Diese E-Mail (ggf. nebst Anhang) enthält vertrauliche und/oder rechtlich
geschützte Informationen. Wenn Sie nicht der richtige Adressat sind, oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail (and any attachment/s) contains confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this
e-mail. Any unauthorised copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.
_


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]