java.lang.ClassCastException: oracle.jdbc.driver.T4CConnection - Java - JDBC (Archived)

i am trying to connect to by oracle 10G database in a database server from my developers machine. and i m using eclipse. i get the following error java.lang.ClassCastException: oracle.jdbc.driver.T4CConnection at Finisher.MarkerFinishing.con(MarkerFinishing.java:15) at Finisher.MarkerFinishing.main(MarkerFinishing.java:3 can anyone suggest something

Are you using straight jdbc?
Tomcat and Hibernate both put wrappers around the Connection object so that you can't do a straight cast
We had some pain with this because we are doing some oracle-specific work with Hibernate (using the oracle proxy-user to switch users in order to use our existing oracle security)
If you let me know more of the setup, maybe we did the same and I can pass on our java code 

user588124,
I may be able to help you if you provide more information, including:
* entire error message and stack trace you are getting
* section of your code that is causing the error
* environment you are using (operating system, java version, Oracle database version, JDBC driver)
Good Luck,
Avi. 

Hi pmeiller,
We are trying to use proxy user for Oracle connections and open sessions through the proxy user. We have a similar ClassCastException problem. Can we get your sample code to see how you managed to do it with Hibernate?
Thanks

Related

FinalizedClientSession on running newbie tutorial

Hi,
I'm examining Toplink for persistancy layer. I started doing the standalone newbie-tutorial on http://www.oracle.com/technology/products/ias/toplink/doc/10131/main/_tutorial/intro/standalone/intro_tutorial.htm.
Having some experience with Hibernate, I'm really impressed by the ease of use of the TopLink workbench.
Everything goes according to plan until testing the application. Every time database access is required I get a "An Error Occurred"-page with
a oracle.toplink.internal.sessions.FinalizedClientSession.
In my first attempt I tried to run it on MySQL5.0, but even after downloading and using Oracle XE it still occurs.
My config:
Windows XP (SP2)
Oracle XE 10.2.0.1.0
TopLink (10.1.3.1.0)
OC4J standalone (10.1.3.2.0)
Java 1.5.0_06-b05
I tried to setup my session using a J2EE Datasource as well as JDBC (oracle.jdbc.driver.OracleDriver). Nothing works. Don't think it's a driver/database problem. Since a Google search on FinalizedClientSession returns 0 hits I expect this happens somewhere in the deep dark secret dungeons of Toplink.
Any ideas?
Grtz,
Roel 
Roel,
Can you provide the full stack trace for the failure? The issue does not sound familiar but is most likely a configuration issue between TopLink and the database or TopLink and the container.
Doug 
Doug,
That's part of the problem: there is no stack trace. On the client nor on the OC4J-console. The oracle.toplink.internal.sessions.FinalizedClientSession is all I get.
I found out I get another error (Error Code: 17002) when I forgot to startup my DB, so a missing database connection seems not the cause of my problem.
Does a session have some kind of timeout, after which it gets "finalized"?
Roel 
Which tutorial are you running? The FinalizedClientSession is just the name of the client Session implementation class, it looks like your error page is just printing the session instead of the error or returned value.
Try turning on logging to "finest" and see what is occuring in the log files. Or change your servlet/jsp to catch all error and print them out. Check the logs for System.out, System.err and the OC4J log.xml.

Connecting to DB

I am new to ALBPM. I was going through the documentation and trying to setup a connectivity with SQL 2000 database. I dont know which Java class library to use? It is giving error saying Java class library not found. I downloaded and installed JDBC driver for sql server and included that in external resource. Still having issues 
Try using the "inet-opta-2000.jar".
One problem you might also be having is that you might have checked the "Versionable" checkbox with exposing the JDBC driver. Leave this unchecked for JDBC.
Another problem you might be running into is when exposing the database itself, in the "Supported Types" dropdown, select MsSQL JDBC (i-net Driver).
hope this helps,
Dan
------------------------------------------------
I am new to ALBPM. I was going through the
documentation and trying to setup a connectivity with
SQL 2000 database. I dont know which Java class
library to use? It is giving error saying Java class
library not found. I downloaded and installed JDBC
driver for sql server and included that in external
resource. Still having issues 
I do not see that JAR installed on my server. Where Can I get that from?
thanks 
Hi,
I've just been through the same issue with BEA support. Here's their advice:
It does not come with ALBPM 6.0. You can find it for download at the inetsoftware website. There or some free trial drivers that are available.
http://www.inetsoftware.de/Download.htm
They also told me that the SQL Server 2005 connectivity they provide out of the box worked fine when they tested with SQL Server 2000, but I doubt this would be a supported scenario.

Causa:weblogic.jdbc.wrapper.CallableStatement_oracle_jdbc_driver_OracleCal

Hi,
I m using oracle 11g and weblogic 9.
i used oracle.jdbc.OracleCallableStatement in database call.
when i try to get the data igot error
Causa:weblogic.jdbc.wrapper.CallableStatement_oracle_jdbc_driver_OracleCallableStatementWrapper
java.lang.ClassCastException: weblogic.jdbc.wrapper.CallableStatement_oracle_jdbc_driver_OracleCallableStatementWrapper
the same config is working properly my glassfish configuration.
Thanks
Raj 
For several reasons, such as security and others, that I won't go into,
WebLogic wraps all JDBC objects. This can make it a leeetle bit more
complicated when you need to access Oracle non-standard JDBC
extensions. We provide an alternate Interface you can cast your
statement to, to get the Oracle calls:
weblogic.jdbc.vendor.oracle.OracleCallableStatement
Joe

Problem Connecting to an Oracle DB

Hello! I am trying to write a java applet that would connect to my database(i am using Oracle 10g Express) and then execute some queries. When i try to connect to the DB i get ClassNotFoundException: oracle.jdbc.driver.OracleDriver .. I have found java code for this here(http://www.java2s.com/Code/Java/Database-SQL-JDBC/AppletandOracleJDBC.htm) so i am quite sure that it is not a code problem. I have checked that ojdbc14.jar file is in C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib and set my CLASSPATH to C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar too (is that ok??? Do i have to download classes12.jar as well?? I have jdk1.6.0_12). Also i have to tell you that i have written a java program which connects normally to the database and executes any queries without any exception.However,each time i try to run the HTML page with the java applet inside i get ClassNotFoundException: oracle.jdbc.driver.OracleDriver .. exception. When i write java oracle.jdbc.driver.OracleDriver to check if the driver is ok i get an error: Exception in thread 'main' java.lang.NoSuchMethodError :main. I would appreciate any help.Thanx in advance for any answers...
It needs to be in the classpath of the applet, not of your windows environment. I have never worked with applets that closely, but if I recall correctly, you need to set the codebase attribute for that. Consult a basic applet tutorial for details. There's one here at Sun.com, Google can find it.
That said, it's a bad practice to have database connectivity logic in an applet. Rather keep it entirely in the server which serves the page with the embedded applet. Make use of applet-servlet communication possibility using java.net.URLConnection. This way you don't need to ship hack-sensitive database connectivity code and settings along with the applet. 
Specify the Oracle JDBC JAR file in the ARCHIVE attribute of the Applet tag.
<APPLET CODE="applet.class" ARCHIVE="applet.jar"
WIDTH="150" HEIGHT=150> 
and remember to
1) use the correct driver version. The one you're using is almost certainly NOT correct, as it's a legacy driver for Java 1.2 that hasn't been current for almost a decade.
2) remember you can only ever connect to a network resource on the exact same IP address as the one the applet was loaded from.

RMI

Is it possible to make a call to java stored procedure using RMI.
How can I run the RMI registry on the Oracle Server ? 
Is there rmiregistry inside the database 10g??
I want to have some classes inside the database and access to them (make an instance) from a remote location.
Any idea?
Thanks 
Hi,
It works the other way around meaning you can explicitly load an RMI client in the database and call-out a remote/external RMI Server. I describe in details how to make RMI-callout to SAP JCO RMI Server (with code samples), in my soon-to-be-released book http://www.amazon.com/gp/product/1555583296/
Kuassi, http://db360.blogspot.com/ 
barenca,
Using JDBC, you can invoke java code in the database from a remote location. Simply wrap your java code in a java stored procedure. Then you simply connect to your database (from the remote location) and execute your java stored procedure.
If you require any clarifications, don't hesitate to ask!
Good Luck,
Avi. 
I'm also having issues with using RMI in java stored procedures.
I have loaded the RMI client class, the external class interface, and the external class stub (compiler generated) into the Oracle 10g database server.
I have created a java stored procedure around the client class.
When I invoke the java stored procedure, it works, and gets the result back from the remote class. However, if I invoke it again, over the same database connection, I get an error:
ERROR:
ORA-03114: not connected to ORACLE
begin
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
In the trc file on the server, I can see that each time this happens, it records a core dump.
If I remove the RMI call from the client class, the java stored procedure works fine. So I'm confident that this has something to do with RMI.
I found a thread from 2000, where someone described the same results, but the thread never came to a solution.
If anyone has any insight, I'd sure appreciate it.
Thanks,
Cole 
I also have problems with the same situation. The first run of function works well; but when i start to run the function again in the same sql window, it waits. I use SDK 1.4.
Does anyone have any ideas? 
mennan,
On the second invocation, does it wait indefinitely, or not?
If it doesn't wait indefinitely, do you get an error message?
If you get an error message, please post the entire output you are seeing.
If you are invoking the stored procedure from SQL*Plus, remember to do the following before running the procedure:
set serveroutput on size 1000000
exec DBMS_JAVA.SET_OUTPUT(1000000)While you can't set any properties on the Oracle JVM, you can set them on your RMI server JVM.
The RMI Guide details some debugging properties you can set, which may help you.
Good Luck,
Avi. 
I actually solved my problem, though I don't know why the solution works. I reworked my code so that the RMI uses IIOP for communication. There was additional setup involved, but it solved the problem on the second invocation. If anyone has any suggestions why this worked, I'd be interested to hear them.
Cole 
Avi,
It waits indefinitely. I do not get any error messages. I can invoke the function a new SQL window in first run. I am using PLSQLDeveloper. I can only stop function with killing PLSQLDeveloper. And I also cannot delete RmiClient java source from the database(10G) after hte second attemp.
Briefly, i want to comminicate a RMI server within PL/SQL. For this reason, I have written RmiClient and RmiServer Classes. First I run them without Oracle. In a shell window, I run server in one unix machine and client another unix. They run succesfullly. I mean that I have no problem with codes.
I deploy java sources to Oracle(10.1.0.2.0) via (create or replace java source...) statement. I deploy the Stub File via loadjava utility. Then I write a wrapper function to call RMI cilent. I opened a new SQL window and I invoke the function. The first attempt of function was succesfull. But when I try to invoke the function the same SQL window, it did not respond. I am not getting any error messages. Only execution of script waits.
Thanks...
Message was edited by:
mennan 
I solved the problem. The solution was to upgrade Oracle 10.1 to 10.2
Thanks again...

Categories

Resources