JDBC ORACLE EXCEPTION
when i use a connected(conn) java.sql.Connection to operate oracle db,the script:
conn.setAutoCommit(true);
throws exception "io exception:no in stream mode!"
and when call:
Statement stm = conn.createStatement(...);
throws exception:"java.lang.ClassCastException: java.sql.SQLException"
what's the reason?
Hi,
Can you tell me the details of the JDBC driver you are using?
You can look at the samples provided in OTN for JDBC.
Check the source file of XMLType Sample present at this location to get an idea of how to connect to database.
http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/9i_jdbc/content.html#xmltype
Basic to Advance level samples on JDBC are provided at http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/content.html
Have a look at them.
Regards,
Anupama
Similar Messages
-
Trying to Install RMS application 13.2.2 and I get past the pre-installation checks and when I get to the Data Source details and enter the data source details with the check box checked to validate the schema/Test Data Source I get the following error:
Error Connecting to database URL jdbc:oracle:oci:@rmsdbtst as user rms13 java.lang.Exception:UnsatisfiedLinkError encountered when using the Oracle driver. Please check that the library path is set up properly or switch to the JDBC thin client oracle/jdbc/driver/T2CConnection.getLibraryVersioNumber()
Checks performed:
RMS Application code location and directory contents:
[oracle@test-rms-app application]$ pwd
/binary_files/STAGING_DIR/rms/application
[oracle@test-rms-app application]$ ls -ltr
total 144
-rw-r--r-- 1 oracle oinstall 272 Dec 7 2010 version.properties
-rw-r--r-- 1 oracle oinstall 405 Jan 16 2011 expected-object-counts.properties
-rw-r--r-- 1 oracle oinstall 892 May 13 2011 ant.install.properties.sample
-rw-r--r-- 1 oracle oinstall 64004 Jun 6 2011 build.xml
drwxr-xr-x 9 oracle oinstall 4096 Jun 16 2011 rms13
drwxr-xr-x 3 oracle oinstall 4096 Jun 16 2011 installer-resources
drwxr-xr-x 3 oracle oinstall 4096 Jun 16 2011 antinstall
drwxr-xr-x 2 oracle oinstall 4096 Jun 16 2011 ant-ext
drwxr-xr-x 5 oracle oinstall 4096 Jun 16 2011 ant
-rw-r--r-- 1 oracle oinstall 11324 Dec 18 09:18 antinstall-config.xml.ORIG
-rwxr-xr-x 1 oracle oinstall 4249 Dec 18 10:01 install.sh
drwxr-xr-x 4 oracle oinstall 4096 Dec 18 10:06 common
-rw-r--r-- 1 oracle oinstall 16244 Dec 19 10:37 antinstall-config.xml
-rw-r--r-- 1 oracle oinstall 689 Dec 19 10:37 ant.install.log
[oracle@test-rms-app application]$
Application installation:
[oracle@test-rms-app application]$ ./install.sh
THIS IS the driver directory
Verified $ORACLE_SID.
Verified SQL*Plus exists.
Verified write permissions.
Verified formsweb.cfg read permissions.
Verified Registry.dat read permissions.
Verified Java version 1.4.2.x or greater. Java version - 1.6.0
Verified Tk2Motif.rgb settings.
Verified frmcmp_batch.sh status.
WARNING: Oracle Enterprise Linux not detected. Some components may not install properly.
Verified $DISPLAY - 172.16.129.82:0.0.
This installer will ask for your "My Oracle Support" credentials.
Preparing installer. This may take a few moments.
Your internet connection type is: NONE
Integrating My Oracle Support into the product installer workflow...
[move] Moving 1 file to /binary_files/STAGING_DIR/rms/application
Installer preparation complete.
MW_HOME=/u01/app/oracle/Middleware/NewMiddleware1034
ORACLE_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/as_1
ORACLE_INSTANCE=/u01/app/oracle/Middleware/NewMiddleware1034/asinst_1
DOMAIN_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/user_projects/domains/rmsClassDomain
WLS_INSTANCE=WLS_FORMS
ORACLE_SID=rmsdbtst
JAVA_HOME=/u01/app/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0
Launching installer...
To make sure I have connectivity from the app server to the database (on a database server) here are the steps followed:
[oracle@test-rms-app application]$ tnsping rmsdbtst
TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 19-DEC-2013 10:41:40
Copyright (c) 1997, 2008, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test-rms-db.vonmaur.vmc)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = rmsdbtst)))
OK (0 msec)
[oracle@test-rms-app application]$
[oracle@test-rms-app application]$ sqlplus rms13@rmsdbtst
SQL*Plus: Release 11.1.0.7.0 - Production on Thu Dec 19 10:46:18 2013
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@test-rms-app application]$
[oracle@test-rms-app application]$ ping test-rms-db
PING test-rms-db.vonmaur.vmc (192.168.1.140) 56(84) bytes of data.
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=1 ttl=64 time=0.599 ms
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=2 ttl=64 time=0.168 ms
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=3 ttl=64 time=0.132 ms
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=4 ttl=64 time=0.158 ms
64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=5 ttl=64 time=0.135 ms
--- test-rms-db.vonmaur.vmc ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4001ms
rtt min/avg/max/mdev = 0.132/0.238/0.599/0.181 ms
[oracle@test-rms-app application]$
[oracle@test-rms-app application]$ uname -a
Linux test-rms-app.vonmaur.vmc 2.6.18-128.el5 #1 SMP Wed Jan 21 08:45:05 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
[oracle@test-rms-app application]$
[oracle@test-rms-app application]$ cat /etc/*-release
Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
[oracle@test-rms-app application]$
The database is created and all the batch file scripts have been successfully deployed. Now working on the application server. The Weblogic server is installed and 11g forms and reports are installed successfully.
Any help would be helpful.
Thanks,
Ram.Please check MOS Notes:
FAQ: RWMS 13.2 Installation and Configuration (Doc ID 1307639.1) -
How to specify JDBC Oracle url using deployment tool - Entity Bean
Hello I'am new to EJB.
When creating a entity bean-managed persistence and you need to specify the jdbc url with user name
and password to establish a connection object, how does one specify that in the deployment
tool?
Heres an example of what has in the J2EE tutorial has in AccountEJB to get an connection object
private String dbName = "java:comp/env/jdbc/AccountDB";
private void makeConnection() throws NamingException, SQLException {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup(dbName);
con = ds.getConnection();
Now if my oracle jdbc url is to be jdbc:oracle:thin:@Abe:1521:dev
ie My host is Abe, port number 1521 and database name of dev and username/password will be system/manager.
what would my dbName be at the top?
Would my JNDI lookup of a DataSource resource "java:comp/env/jdbc/AccountDB" become "java:comp/env/jdbc/dev" for starters?
In the Resource Factories Reference Code I've add a reference of
Coded Name: jdbc/dev
Type: javax.sql.DataSource
Authentication: Container
and down the bottom of the I've put JNDI Name: MyAccount
according to the AccountClient code of:
Context initial = new InitialContext();
Object objref = initial.lookup("MyAccount");
and put User Name of "system" and Password of "manager"
I'am sure in the source code I have to put
Class.forName("oracle.jdbc.driver.OracleDriver")
else you would get that no sutitable driver error, maybe you don't have to if ejb server is smart enough?
What I'am confuse about is where to specify the jdbc url of "jdbc:oracle:thin:@Abe:1521:dev" ??
Know it won't work because of this vital part. Do you have to put that somewhere else in the deployment tool or properties file, or some other tool??
Please help
Thanks
Abraham KhalilWhen running the client after successful deployment with jdbc, I'am getting
javax.naming.CommunicationException: java.rmi.MarshalException: CORBA MARSHAL 1398079699 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : minor code: 1398079699 completed: Maybe
org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : minor code: 1398079699 completed: Maybe
at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:923)
at com.sun.corba.ee.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:281)
at com.sun.corba.ee.internal.corba.TCUtility.unmarshalIn(TCUtility.java:274)
at com.sun.corba.ee.internal.corba.AnyImpl.read_value(AnyImpl.java:554)
at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_any(CDRInputStream_1_0.java:605)
at com.sun.corba.ee.internal.iiop.CDRInputStream.read_any(CDRInputStream.java:252)
at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.readAny(Util.java:203)
at javax.rmi.CORBA.Util.readAny(Unknown Source)
at org.omg.stub.com.sun.enterprise.naming._SerialContextProvider_Stub.lookup(Unknown Source)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:133)
at javax.naming.InitialContext.lookup(Unknown Source)
at AccountClient.main(AccountClient.java:21)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:151)
at javax.naming.InitialContext.lookup(Unknown Source)
at AccountClient.main(AccountClient.java:21)
One thing I don't like about EJB is that everything is transparent which is good! But its much
harder to debug! :( Tried to see if I can figure it out. Hope someone has seen this problem before? -
Error when using jdbc:oracle:kprb:
Hi folks!
I'm having a hard time trying to solve this one, here's the situation:
I've developed a java stored procedure and ulpoaded to the database using loadjava, which gave me no problems.
Then i've set permissions for the procedure:
BEGIN
dbms_java.grant_permission(
grantee => 'XMLADMIN',
permission_type => 'SYS:java.io.FilePermission',
permission_name => '/home/xmlgate/inbound/*',
permission_action => 'read');
dbms_java.grant_permission(
grantee => 'XMLADMIN',
permission_type => 'SYS:java.io.FilePermission',
permission_name => '/home/xmlgate/outbound',
permission_action => 'write');
dbms_java.grant_permission(
grantee => 'XMLADMIN',
permission_type => 'SYS:java.lang.RuntimePermission',
permission_name => 'setFactory',
permission_action => '');
dbms_java.grant_permission(
grantee => 'XMLADMIN',
permission_type => 'SYS:oracle.aurora.security.JServerPermission',
permission_name => 'Debug',
permission_action => '');
dbms_java.grant_permission(
grantee => 'XMLADMIN',
permission_type => 'SYS:oracle.aurora.security.JServerPermission',
permission_name => 'LoadClassInPackage.oracle.sql.*',
permission_action => '');
dbms_java.grant_permission(
grantee => 'XMLADMIN',
permission_type => 'SYS:oracle.aurora.security.JServerPermission',
permission_name => 'LoadClassInPackage.oracle.jdbc.*',
permission_action => '');
COMMIT;
END;
But when i run the code inside the databse it always gives java.lang.NullPointerException.
Here's the main class:
package packupload;
import java.sql.*;
import java.util.*;
import oracle.jdbc.driver.*;
public class connection {
// Return a JDBC Connection appropriately either outside or inside Oracle8i
public static Connection getConnection() throws SQLException {
String username = "xmladmin";
String password = "xxxxxxxx";
String thinConn = "jdbc:oracle:thin:@192.168.xxx.xxx:1521:www";
String default8iConn = "jdbc:oracle:kprb:";
Connection cn = null;
try {
// Register the JDBC Driver
Driver d = new oracle.jdbc.driver.OracleDriver();
//Connect with Native (kprb) Driver if inside Oracle8i
if (insideOracle8i())
cn = DriverManager.getConnection(default8iConn);
else
cn = DriverManager.getConnection(thinConn,username,password);
cn.setAutoCommit(false);
return cn;
} catch (Exception e) { throw new SQLException("Error Loading JDBC Driver" + insideOracle8i());
public static boolean insideOracle8i() {
// If oracle.server.version is non-null, we're running in the database
String ver = System.getProperty("oracle.server.version");
return (ver != null && !ver.equals(""));
Any help would be greatly aprecciated.
Pedro SilvaHi..
I did it but here i am wondering becoz my RFC connection SAPSLDAPI works fine
But at transaction SLDCHECK..it throws an error like
Calling function LCR_LIST_BUSINESS_SYSTEMS
Retrieving data from the SLD server...
Function call returned exception code 4
=> Check whether the SLD is running!
Summary: Connection to SLD does not work
=> Check SLD function and configurations
But the SLD URL pops up and opens wih put any error.in a same fashion,it happens in SXMB_ADM--> integration engine config.it says connections to SLD doesnot work
any idea to verify
Thanks
Gopal -
JDBC, Oracle: access denied
I can load Oracle driver
Class.forName("oracle.jdbc.driver.OracleDriver");
But in this string:
String url = "jdbc:oracle:thin:@195.52.61.6:1521:ORCL";
java.sql.Connection con = java.sql.DriverManager.getConnection(url, "SCOTT", "TIGER");
happens exception:
java.security.AccessControlException: access denied (java.net.SocketPermission 195.52.61.6:1521 connect,resolve)
I have found in this forum many same messages. Can anybody explain problem?Are you using an applet?
-
JDBC-ORACLE CONNECTIVITY ISSUE WITYH OCI8 DRIVER using oracle 11g client..
JDBC-ORACLE CONNECTIVITY ISSUE WITYH OCI8 DRIVER using oracle 11g client..
I am getting below error when i m trying to access oracle db using oracle 11g client. It works with earlier oracle client versions. how do i resolve this. is there any issue with version of ojdbc6.jar that i am using??? I cant use thin driver since its an old application for which i dont have source files.
Apr 6, 2013 1:00:59 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:346)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at PettyCash.SysDate.getSysSubSys(SysDate.java:232)
at org.apache.jsp.PettyCash.index_jsp._jspService(org.apache.jsp.PettyCash.index_jsp:186)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Code is as follow for reference
import oracle.jdbc.driver.*;
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
conn = DriverManager.getConnection ("jdbc:oracle:oci8:@" + database,db_user, db_pass);
eNVIRONMENT VARIABLES set are as follows:
classpath
C:\Program Files\apache-tomcat-5.5.12\common\lib\servlet-api.jar;C:\Program Files\apache-tomcat-5.5.12\webapps\ROOT\WEB-INF\lib\classes12.jar;C:\Program Files\apache-tomcat-5.5.12\webapps\ROOT\WEB-INF\lib\ojdbc6.jar;
JAVA_HOME
C:\Program Files\Java\jdk1.5.0_04
PATH
C:\Program Files\Java\jdk1.5.0_04\bin
ORACLE_HOME
D:\Oracle11\product\11.2.0\client_1\BINApr 8, 2013 5:24:06 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.abc.index_jsp._jspService(org.apache.jsp.abc.index_jsp:280)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595) -
Connection reset using JDBC Oracle thin Driver (towards 10g DB)
Hi we have a home-grown application and a Oracle 10g (10.2.0.1) database.
We created a scheduled servlet that gets a JDBC connection from a persistent connected cache (an OracleDataSource object registered using OracleConnectionCacheManager). The servlet runs every 15 minutes and runs the query "SELECT SYSTIME FROM DUAL" on 10g Database as XYZ user. The datapool was created yday on web-app and all queries ran successfully for about 5 hours after which it reported a connection reset error.
I can then conclude that we cannot keep the server session alive for the JDBC client by running frequent SQL queries.
We didnt get any messages on the DB server side that indicate the release of the session
Ultimately, we are struggling with reset connections from our applications that are
using the JDBC thin oracle driver; after a couple of hours of idle
connections, we receive the below error from the JDBC driver:
Jul 5, 2007 10:59:53 AM oracle.jdbc.driver.DatabaseError throwSqlException
WARNING: DatabaseError.throwSqlException(e): Unable to find ORA number from
exception Jul 5, 2007 10:59:53 AM oracle.jdbc.driver.DatabaseError
findMessage
WARNING: DatabaseError.findMessage(errNum, obj): returned Io exception:
Connection reset Jul 5, 2007 10:59:53 AM
oracle.jdbc.driver.PhysicalConnection getWarnings
INFO: PhysicalConnection.getWarnings()
Any suggestions please ?
VkThe code itself is fine; the problem is with one of:
1) the connection URL
2) intermediate networking
3) the database itself
1) your connection URL is "jdbc:oracle:thin:@127.0.0.1:1521:orcl"
- is Oracle really running on the default port, 1521
- is the installation SID really "orcl"
2) lots of possibilities, but only a couple are likely
- is TCP/IP configured and running on your host
- is there a persoanl firewall rpduct running? perhaps it's blocking the connection
3) Is Oracle running?
Is the listener running? -
Jdbc oracle jdbc-thin driver subname
I am working on Windows 2000 environment, using oracle8i 8.1.7 JDBC-Thin driver for use with JDK 1.2.x. The oralce8i 8.1.7 database is on another linux box. I can access the linux box through its ip address, but not by its hostname since it's not accessiable by the dns server. In my code, in the JDBCUrl, I used ip address instead of the hostname, e.g. "jdbc:oracle:thin:@10.0.113.108:1521:ora1". But I got the error like: "java.sql.SQLException: Io exception: The Network Adapter could not establish the connection". If I add a entry in my working machine's hosts file to map the hostname, I can fix the problem. But I don't know if this is the solution, or there is other better solutions.
Thanks
nullUsing a hosts file entry is a common solution for problem where the dns lookup does not contain an entry for a RDBMS server platform.
The real solution is to resolve this issue :
"where the dns lookup does not contain an entry for a RDBMS server platform." -
Access to Weblogic 7.0 SP1 datasource throws Oracle Exception
Hi,
I am trying to access a DataSource & Connection Pool set up in a Weblogic 7.0
SP1 instance, from a client app running in a different JVM than the app server
itself. The code I used is given below,
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
ctx = new InitialContext(ht);
if (ctx != null) ds = (DataSource) ctx.lookup("sample.SQLServer2KDS");
Connection conn = ds.getConnection("system", "password");
The connection pool points to a SQL Server 2000 database. But the getConnection
throws an Oracle exception, given below. We don't have any reference to oracle
drivers anywhere and we don't have any installations of Oracle. When I put the
Oracle JDBC driver in the classpath of my client application, this problem went
away.
Does anyone else encounter this ? Does anyone know if this is fixed by BEA ?
Thanks,
-Arun
weblogic.rjvm.PeerGoneException: ; nested exception is:
weblogic.utils.NestedException: oracle/sql/BfileDBAccess - with nested exception:
[java.lang.NoClassDefFoundError: oracle/sql/BfileDBAccess]
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:127)
at weblogic.jdbc.common.internal.RmiDataSource_WLStub.getConnection(Unknown Source)
at sample.DBClient.getConnection(DBClient.java:37)
at sample.DBClient.main(DBClient.java:57)
Caused by: weblogic.utils.NestedException: oracle/sql/BfileDBAccess - with nested
exception:
[java.lang.NoClassDefFoundError: oracle/sql/BfileDBAccess]
at weblogic.rjvm.RJVMImpl.gotExceptionReceiving(RJVMImpl.java:592)
at weblogic.rjvm.ConnectionManager.gotExceptionReceiving(ConnectionManager.java:896)
at weblogic.rjvm.t3.T3JVMConnection.hasException(T3JVMConnection.java:632)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:399)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:23)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
--------------- nested within: ------------------
weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested
exception:
[weblogic.rjvm.PeerGoneException: ; nested exception is:
weblogic.utils.NestedException: oracle/sql/BfileDBAccess - with nested exception:
[java.lang.NoClassDefFoundError: oracle/sql/BfileDBAccess]]
at weblogic.jdbc.common.internal.RmiDataSource_WLStub.getConnection(Unknown Source)
at sample.DBClient.getConnection(DBClient.java:37)
at sample.DBClient.main(DBClient.java:57)You need to have classes12.zip in your CLASSPATH, even though you are not using Oracle
as your database.
This problem will be fixed in the WLS release coming out in spring, 2003.
"Arun Panicker" <[email protected]> wrote in message news:[email protected]...
>
Hi,
I am trying to access a DataSource & Connection Pool set up in a Weblogic 7.0
SP1 instance, from a client app running in a different JVM than the app server
itself. The code I used is given below,
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
ctx = new InitialContext(ht);
if (ctx != null) ds = (DataSource) ctx.lookup("sample.SQLServer2KDS");
Connection conn = ds.getConnection("system", "password");
The connection pool points to a SQL Server 2000 database. But the getConnection
throws an Oracle exception, given below. We don't have any reference to oracle
drivers anywhere and we don't have any installations of Oracle. When I put the
Oracle JDBC driver in the classpath of my client application, this problem went
away.
Does anyone else encounter this ? Does anyone know if this is fixed by BEA ?
Thanks,
-Arun
weblogic.rjvm.PeerGoneException: ; nested exception is:
weblogic.utils.NestedException: oracle/sql/BfileDBAccess - with nested exception:
[java.lang.NoClassDefFoundError: oracle/sql/BfileDBAccess]
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:127)
at weblogic.jdbc.common.internal.RmiDataSource_WLStub.getConnection(Unknown Source)
at sample.DBClient.getConnection(DBClient.java:37)
at sample.DBClient.main(DBClient.java:57)
Caused by: weblogic.utils.NestedException: oracle/sql/BfileDBAccess - with nested
exception:
[java.lang.NoClassDefFoundError: oracle/sql/BfileDBAccess]
at weblogic.rjvm.RJVMImpl.gotExceptionReceiving(RJVMImpl.java:592)
at weblogic.rjvm.ConnectionManager.gotExceptionReceiving(ConnectionManager.java:896)
at weblogic.rjvm.t3.T3JVMConnection.hasException(T3JVMConnection.java:632)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:399)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:23)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
--------------- nested within: ------------------
weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested
exception:
[weblogic.rjvm.PeerGoneException: ; nested exception is:
weblogic.utils.NestedException: oracle/sql/BfileDBAccess - with nested exception:
[java.lang.NoClassDefFoundError: oracle/sql/BfileDBAccess]]
at weblogic.jdbc.common.internal.RmiDataSource_WLStub.getConnection(Unknown Source)
at sample.DBClient.getConnection(DBClient.java:37)
at sample.DBClient.main(DBClient.java:57) -
Weblogic seems to swallow Oracle Exception
Hi,
Weblogic seems to swallow the Oracle Exception when using EntityManager, can someone also verify this ?
Here is what I did:
SQL> create table AMS_TEST (TEST_ID INTEGER primary key, name VARCHAR2(125), CONSTRAINT X UNIQUE (name));
Table created.
SQL> CREATE SEQUENCE SEQ_TEST_ID;
Sequence created.
And EJB 3 Been as follows:
@Entity
@Table(name = "AMS_TEST")
@SequenceGenerator(name="seg_test_id_gen", sequenceName = "SEQ_TEST_ID")
public class DummyBean {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seg_test_id_gen")
@Column(name = "TEST_ID", length =38)
private Long mTestId;
@Column(name = "NAME", length =125)
private String mName;
public DummyBean(String name) {
mName = name;
public String getName() {
return mName;
And the in StateSessionBean method
public void test() {
getEntityManager().persist(new DummyBean("test"));
If the method call twice, it should throw an Oracle's Unique constraint exception due to the unique constraint on "name".
But instead, weblogic only throws "Unknown reason" exception.
Is there a way to report the real exception so that one know that's the cause of failure ?
Chester
<Feb 8, 2008 9:01:21 PM PST> <Error> <EJB> <BEA-010026> <Exception occurred during commit of transaction Name=[EJB com.ascentmedia.ams.content.AssetManagerBean.test()],Xid=BEA1-00187801BCA41A74F1B8(9411978),Status=Rolled back. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyException],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=60,NonXAServerResourceInfo[WL_JDBC_LLR_POOL.AMS_DS]=(ServerResourceInfo[WL_JDBC_LLR_POOL.AMS_DS]=(state=rolledback,assigned=AdminServer),nonXAResource=JDBC LLR, pool=AMS_DS, table=WL_LLR_ADMINSERVER),SCInfo[ams3+AdminServer]=(state=rolledback),properties=({weblogic.transaction.nonXAResource=WL_JDBC_LLR_POOL.AMS_DS, weblogic.transaction.name=[EJB com.ascentmedia.ams.content.AssetManagerBean.test()], weblogic.jdbc=t3://192.168.2.8:7001, weblogic.jdbc.llr=AMS_DS}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=AdminServer+192.168.2.8:7001+ams3+t3+, XAResources={WLStore_ams3__WLS_AdminServer, WLStore_ams3_JDBCStore},NonXAResources={})],CoordinatorURL=AdminServer+192.168.2.8:7001+ams3+t3+): weblogic.transaction.RollbackException: Unknown reason
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1818)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:333)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:227)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1(BaseRemoteObject.java:611)
at weblogic.ejb.container.internal.StatelessRemoteObject.postInvoke1(StatelessRemoteObject.java:57)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvokeTxRetry(BaseRemoteObject.java:431)
at com.ascentmedia.ams.content.AssetManagerBean_whuwo6_AssetManagerRemoteImpl.test(AssetManagerBean_whuwo6_AssetManagerRemoteImpl.java:1677)
at com.ascentmedia.ams.content.AssetManagerBean_whuwo6_AssetManagerRemoteImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:586)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:474)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:470)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
.>I am getting a similar error with an Hibernate implementation of EntityManager. I had an error on my code that made a EntityManager#persist call on a entity that had another transient entity setted in a ManyToOne relationship that weren't tagged with cascade anotation.
The only way I managed to dig for the error was to force a EntityManager#flush on my EJB bean code that happily threw the correct exception (IllegalStateException, which is correctly documented on section 3.2.3 of the EJB 3.0 specification - persistence).
There should be a standard way to retrieve the cause of an rollback from a EJB call that the EntityManager throws during commit. Without that, it will be kind of difficult to rely on container managed transaction.
This was the stack trace I got on my log:
####<18/02/2008 16h22min33s BRT> <Error> <EJB> <rcouto> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1203362553258> <BEA-010026> <Exception occurred during commit of transaction Name=[EJB br.com.touchtec.lsd.impl.LSDBean.createScript(java.lang.String,java.util.Locale,java.lang.String,br.com.touchtec.net.Reference)],Xid=BEA1-0000B42F7CD37B374FDD(27009473),Status=Rolled back. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyException],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=1,seconds left=30,XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=rolledback,assigned=AdminServer),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@16c0ff5,re-Registered = false),SCInfo[lsd+AdminServer]=(state=rolledback),properties=({weblogic.transaction.name=[EJB br.com.touchtec.lsd.impl.LSDBean.createScript(java.lang.String,java.util.Locale,java.lang.String,br.com.touchtec.net.Reference)], weblogic.jdbc=t3://172.19.64.51:7001}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=AdminServer+172.19.64.51:7001+lsd+t3+admin+7001+, XAResources={weblogic.jdbc.wrapper.JTSXAResourceImpl},NonXAResources={})],CoordinatorURL=AdminServer+172.19.64.51:7001+lsd+t3+admin+7001+): weblogic.transaction.RollbackException: Unknown reason
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1818)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:333)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:227)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1(BaseRemoteObject.java:606)
at weblogic.ejb.container.internal.StatelessRemoteObject.postInvoke1(StatelessRemoteObject.java:57)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvokeTxRetry(BaseRemoteObject.java:426)
at br.com.touchtec.lsd.impl.LSDBean_jz0i8w_LSDImpl.createScript(LSDBean_jz0i8w_LSDImpl.java:153)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:63)
at $Proxy69.createScript(Unknown Source)
at br.com.touchtec.lsd.it.web.ScriptAction.save(ScriptAction.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at br.com.touchtec.twf.core.TWFActionInvocation.invokeAction(TWFActionInvocation.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at br.com.touchtec.twf.validation.WorkflowInterceptor.doIntercept(WorkflowInterceptor.java:91)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at br.com.touchtec.twf.validation.ValidationInterceptor.doIntercept(ValidationInterceptor.java:124)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at br.com.touchtec.twf.process.ProcessContextInterceptor.intercept(ProcessContextInterceptor.java:104)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at br.com.touchtec.twf.process.ProcessStackInterceptor.intercept(ProcessStackInterceptor.java:64)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at br.com.touchtec.twf.userContext.InjectUserContextInterceptor.intercept(InjectUserContextInterceptor.java:54)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at br.com.touchtec.twf.ejb.EJBInjectorInterceptor.intercept(EJBInjectorInterceptor.java:77)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at br.com.touchtec.twf.session.SessionCleanUpInterceptor.intercept(SessionCleanUpInterceptor.java:48)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3368)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2117)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2023)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
.> -
Hi all,
where can I download an JDBC-Oracle-Driver except of Oracle itsself?
Tnx
MarkoYou could use the thin[i] driver.
Or, if you find a provider other than Oracle... you can... but, exactly, why do you want to do that??? -
Hello All genius plz,
I make a user in Oracle and add a table in it then i want to connect it with my java application what can i do Which driver i select Form DSN .And if any one send me sample code so i will be very thankful to u on [email protected]
1 think i clear here that i already try lot of techinique like adding classes12.zip folder in my lib directory and also extracting and then add it. Setting classpath and try lot of DSN driver but nothing is work please help me on that.
Regards
Uzair Baig
(Always belive in logic)Hello All genius plz,Ah! Finally someone understands! :)
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@127..0.1:1521:uzair","system","manager");
Is that correct. and which driver i select form DSN
1)Oracle ODBC driver OR 2)Microsoft ODBC driver for OracleThe connection string you are using will allow you to connect to your Oracle database using the Oracle thin (type 4) driver. The type 4 driver does not require any ODBC DSN. The type 4 driver does not use ODBC. The type 4 driver allows you to connect to your Oracle database from any machine that has the type 4 driver in it's CLASSPATH, there is no need for the Oracle client or any Oracle network setup on the client (TNS).
The connection string looks OK to me, except the IP address which appears to be missing a zero (0).
Make sure 1521 is the port that Oracle is listening for connections. The port number is user defined and is sometimes changed to allow for multiple listeners or for security reasons. -
I'm trying to connect the oracle database
similiar with the problem posted by our friend, apchar_boiir
i was wandering, doesn't the jdbc driver exist once we install the jds1.4?
is so, how am i gonna connect to the oracle database?
let's say my company pass me the ip and host
and i'm suppose to develop an application which has to connect to their database
the code is like this:
Connection conn = null;
try
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(
"jdbc:oracle:thin:10.0.11.2:1512:test",
"user",
"password");
catch(Exception e){}
is there any problem with my code?
please help...I'd already download the driver, "ojdbc14-Oracle9i 9.2.0.1.jar"
Now i try to test for the connection
Therefore, i move the driver to C:\ and I create a oracle.java in the same directory
The source code is like this:
import java.sql.*;
import java.io.*;
public class oracle {
public static void main(String args[]) throws SQLException{
String dbDriver = "oracle.jdbc.driver.OracleDriver";
String dbURL = "jdbc:oracle:thin:@10.0.11.2:1521:test";
String dbUser = "icem_trainer";
String dbPassword = "icem_trainer";
Connection conn = null;
Statement stmt = null;
try {
Class.forName(dbDriver).newInstance();
conn = DriverManager.getConnection(dbURL, dbUser, dbPassword);
stmt = conn.createStatement();
catch(Exception e) { }
if (conn!=null)
System.out.println("Yess!!!");
else
System.out.println("No!!!");
anyway, the output seems like i couldn't connect to the oracle database
I tested it using the similiar method for MySQL,
I use the MySQL-Java-Connector.jar as the driver, and it works
please help -
I am running a servlet on Lunux/Apache/Tomcat and I need to make a JDBC connection to Oracle on another computer. I have moved the Oracle 'classes12.zip' to the ...j2sdk1.4.1/bin directory and I have also added it to the CLASSPATH environment variable.
When I try to execute
DriverManager.registerDriver(new Oracle.jdbc.driver.OracleDriver());
I get the following error
'java.lang.NoClassDefFoundError oracle/jdbc/driver/OracleDriver'
Any advice please?
Thanks for the help
GlenHi everyone,
I have a similar "Class not found exception" when using classes12.zip in the WEB-INF/lib folder (under win2000)
A servlet tries to make a connection and bombs out.
I am using "oracle.jdbc.driver.OracleDriver" with the zip file in the above folder..? Mysql and MSSQL both work but this one doesn't ...
Is there an issue with the .zip extension?? does in HAVE to be .jar??
My URL is jdbc:oracle:thin:@<name>:<port>:<sid> but that's another issue... DO I have to provide a username and password and if so could someone post up this URL please..
Thanks
Dave -
Java 1.6 + JDBC + Oracle, what is wrong?
I Instaled the Oracle Enterprise 11.2, The Database Control Tool report me the following informations:
Status : Active
Instance name : orcl
Version: 11.2.0.1.0
Read only : Not
Oracle Home : C:\app\xxxx\product\11.2.0\dbhome_1
Host : localhost
Listener : LISTENER_localhost
Database Vault : not instaled
In my app java i add the ojodbc6.jar that i find on the directory where Oracle database was instaled.
My connection class
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import org.apache.log4j.Logger; public class DataSourceDAO { private static Logger log = Logger.getLogger( DataSourceDAO.class ); protected Connection connection; private static final String OracleDriver = "oracle.jdbc.driver.OracleDriver"; private static final String OracleURL = "jdbc:oracle:thin:@localhost:1521:orcl"; private static final String OracleUSER = "SYSTEM"; private static final String OraclePASSWORD = "minhasenha"; public DataSourceDAO( ) { init( ); } private void init( ) { try { Class.forName( OracleDriver ); connection = DriverManager.getConnection( OracleURL, OracleUSER, OraclePASSWORD ); } catch ( Exception e ) { log.error( e ) ; throw new RuntimeException( " Impossivel localizar DataSource " ); } } public final void connect( ) throws SQLException { if ( connection == null ) { init( ); } } public final void close( ) throws SQLException { if ( connection != null ) { connection.close( ); } } public final void commit( ) { try { if ( connection != null ) { connection.commit( ); } } catch ( SQLException e ) { log.error( e ) ; throw new RuntimeException( "Impossivel comitar!", e ); } } public final void rollback( ) { try { if ( connection != null ) { connection.rollback( ); } } catch ( SQLException e ) { log.error( e ) ; throw new RuntimeException( "Impossivel desfazer!", e ); } } }
This code was workng in a pc with oracle 11g express editon, but with oracle Enterprise Edition the following erro happens:
Error:
012-06-11 02:46:03,590][enviar] ERROR br.com.ftt.view.TratarClienteVIEW ErroConnection 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.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at br.com.ftt.view.TratarClienteVIEW.enviar(TratarClienteVIEW.java:352)
at br.com.ftt.view.TratarClienteVIEW.inserir(TratarClienteVIEW.java:233)
at br.com.ftt.view.TratarClienteVIEW.access$0(TratarClienteVIEW.java:220)
at br.com.ftt.view.TratarClienteVIEW$1.widgetSelected(TratarClienteVIEW.java:140)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at br.com.ftt.view.TratarClienteVIEW.main(TratarClienteVIEW.java:59)
[2012-06-11 02:46:03,606][main] ERROR br.com.ftt.view.TratarClienteVIEW java.lang.NullPointerExceptionuser9981176 wrote:
This code was workng in a pc with oracle 11g express editon, but with oracle Enterprise Edition the following erro happens:Expanding on the previous answer....because there is nothing wrong with the code.
The error indicates a box to box connection problem. Usual causes but others are possible.
1. Database isn't up (or listener isn't up)
2. Wrong port
3. Wrong host
4. Firewall issue.
Maybe you are looking for
-
Do I need to abandon Thunderbird because too slow.
I have been using Thunderbird for many years under Windows XP Professional. There were no problems and there was a quick response from the programme. My bank forced me to abandon Window XP. I choose for Windows 8., which I installed on my old compute
-
Hi! Is there something else in Snow Leopard putting disks to sleep during routine use? I'm finding that it's much slower at populating some lists - for example, the list of most recent files accessed in MSWord, and the list of local directory files i
-
Hello, Can anyone help me with an ftp problem? I have a brand new T61 and I can not get any ftp program to work. I am currently using FileZilla which works just fine on another computer with the same os (Vista). I am using exactly the same settings o
-
Standard vs Retina Display?
Which is better and why?
-
Hi all, I try to ready DOC file using the following code but i face the folowing error. IS there any way to read DOC or DOCX files? declare f utl_file.file_type; s varchar2(200); begin f := utl_file.fopen('OUTPUT','x.doc','R'); utl_file.get_line(f,s,