Connecting to Oracle using JDBC issue
Hi All,
Im facing similar issues, please advise and help. Details as below,
System and java spec used:
Windows Edition : Windows Server 2008 R2 Standard
System type : 64-bit Operating System
NetBeansIDE version : 6.1
JDK Version : 1.6
DB : Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
Connection string: : <root>
<title>Oracle R12 Prod</title>
<jdbc-connection-string>jdbc:oracle:thin:<username>/<password>@<host>:<port>:<SID></jdbc-connection-string>
</root>
StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.ArrayIndexOutOfBoundsException: 7
at oracle.security.o3logon.C1.r(C1)
at oracle.security.o3logon.C1.l(C1)
at oracle.security.o3logon.C0.c(C0)
at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientHelper)
at oracle.jdbc.ttc7.O3log.<init>(O3log.java:290)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:251)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:252)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at db.dbConnect.makeConnection(dbConnect.java:55)
at org.apache.jsp.rep.rep1_005fgo_jsp._jspService(rep1_005fgo_jsp.java from :222)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:855)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:660)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:578)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:997)
at org.apache.jsp.rep.rep1_005fgo0_jsp._jspService(rep1_005fgo0_jsp.java from :111)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Can someone please help me on the above query
Similar Messages
-
Connecting to Oracle using JDBC
Hi all,
I am a new to Oracle. I am trying to connect to Oracle using JDBC
The URL with which I tried to connect was:
jdbc:oracle:oci8:@myServiceName,user='myLogin',password='myPassword'
I get an error (ORA-12154)
- TNS could not resolve service name
When I use the same userid, password and service and connect thru' SQL*Plus it goes thru'. Is there any parameter which I am missing. Can anyone throw some light on this. I am held up with this issue badly.
Thanks for all your help and time.
Regards,
LathaHi Latha,
Please try to use thin and add port number.
m_conn = DriverManager.getConnection("jdbc:oracle:thin:@" + hostURL + ":" + port + ":" + database, user, password);
Hong
null -
Connecting to Oracle using JDBC problem
When trying to connect using the following few lines:
String urn = "jdbc:oracle:thin:@localhost:1521:XE";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection _con = DriverManager.getConnection(urn, "user", "pass");
I get an ArrayIndexOutOfBounds Exception
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7
at oracle.security.o3logon.C1.r(C1)
at oracle.security.o3logon.C1.l(C1)
at oracle.security.o3logon.C0.e(C0)
at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientHelper)
at oracle.jdbc.ttc7.O3log.<init>(O3log.java:287)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:227)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:198)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
I am using JDK 1.4, and I installed the Oracle Database 10g Express Edition.
If anyone has used JDBC before, and knows how this should be done...
thanksHi All,
Even im facing similar issues, please advise and help. Details as below,
System and java spec used:
Windows Edition : Windows Server 2008 R2 Standard
System type : 64-bit Operating System
NetBeansIDE version : 6.1
JDK Version : 1.6
DB : Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
Connection string: : <root>
<title>Oracle R12 Prod</title>
<jdbc-connection-string>jdbc:oracle:thin:<username>/<password>@<host>:<port>:<SID></jdbc-connection-string>
</root>
StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.ArrayIndexOutOfBoundsException: 7
at oracle.security.o3logon.C1.r(C1)
at oracle.security.o3logon.C1.l(C1)
at oracle.security.o3logon.C0.c(C0)
at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientHelper)
at oracle.jdbc.ttc7.O3log.<init>(O3log.java:290)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:251)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:252)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at db.dbConnect.makeConnection(dbConnect.java:55)
at org.apache.jsp.rep.rep1_005fgo_jsp._jspService(rep1_005fgo_jsp.java from :222)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:855)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:660)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:578)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:997)
at org.apache.jsp.rep.rep1_005fgo0_jsp._jspService(rep1_005fgo0_jsp.java from :111)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) -
Connect to oracle using jdba thin driver
i want to use jdbc thin driver to connect to oracle 8i for linux intel.
my code is:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String dbURL = "jdbc:oracle:thin:@dbserver:1521:iasdb";
Connection con = DriverManager.getConnection(dbURL,"scott","tiger");
but an error is reported as "the network adapter can not establish connection".
why?
i can connect to oracle using JDBC-ODBC bridge successfully.i want to use jdbc thin driver to connect to oracle 8i for linux intel.
my code is:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String dbURL = "jdbc:oracle:thin:@dbserver:1521:iasdb";
Connection con = DriverManager.getConnection(dbURL,"scott","tiger");
but an error is reported as "the network adapter can not establish connection".
why?
i can connect to oracle using JDBC-ODBC bridge successfully. -
How do I connect to Oracle with JDBC using "dedicated processor".
Because of performance problems we want to try to connect to
oracle using dedicated processor. We can do this from SQL Plus,
does anybody know what we need to set up in order to utilize
this from JDBC?Which Java runtime error? (stack trace?)
-
User permission issue in connecting to Oracle using java in Cent OS
Hi ,
I am facing a peculiar issue and since I am new to Cent OS, I hope somebody can help me.
I am using Cent OS 4.2 and I installed Oracle client 10.2 in cent os 4.2.
I am having a java application which connects to Oracle server in another Linux system using Oracle OCI driver which comes along with Oracle client
I have a user called user1 which belongs to group group1 as primary group and my application runs under this user user1.
This user is a member of oinstall group (which is the group for oracle uesr which has access to oracle client directories/files)
But when my application tries to connect to Oracle server, I am getting connectivity error saying "Oracle driver not found" or "cannot load libocijdbc10.so". All environment variables like ORACLE_HOME, PATH,CLASSPATH, LD_LIBRARY_PATH are set properly.
The permissions to Oracle folder/files are rwx for owner(oracle user) , rx for group(oinstall) and none for others
What we observed are
1. When the application is start under root user, it works
2. When we give rx permission to others, it works
3. When we make oinstall group as the primary group for my user user1, it works
My questions here
1. Why it is not working even though my user user1 is a member of oinstall group
2. Why it is working when I make oinstall as the primary group
3. Is there any difference in security policy of RHEL and Cent OS
4. How can I access libraries from multiple folders which created by different user and belongs to different groups, if this is the case
I never faced this issue in RHEL4
Hope some body can help me.
Regards
SunilSorry, I should have been more specific. The error message I was referring to shows up in a pop-up windows when I try to run the program. The actual java error message (that shows up in the command prompt window) is as follows:
"Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\WINNT\system32\ocijdbc8.dll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:192)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:142)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:214)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:193)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at lookup.main(lookup.java:16)"
I'm running the program through Windows 200 Pro command prompt, and the version of java is, as I mentioned in the previous message, 1.4.1:
java -version
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode) -
HELP! Jdbc connection to oracle ClassNotFoundException classpath issues..
Okay I am a newbie to this but all the other posts concerning this just say add the classes12.jar to my classpath.
I am using websphere 5.0
connecting to a 9i db.
after trying to find out what my classpath is ( websphere 5.0 makes it difficult to see it) i found this:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="var"
path="SERVERJDK_50_PLUGINDIR/jre/lib/rt.jar"
rootpath="SERVERJDK_SRCROOT" sourcepath="SERVERJDK_50_PLUGINDIR/src.jar"/>
<classpathentry kind="src" path="Java Source"/>
<classpathentry kind="var" path="WAS_50_PLUGINDIR/lib/j2ee.jar"/>
<classpathentry kind="var" path="WAS_50_PLUGINDIR/lib/servletevent.jar"/>
<classpathentry kind="var" path="WAS_50_PLUGINDIR/lib/ivjejb35.jar"/>
<classpathentry kind="var" path="WAS_50_PLUGINDIR/lib/runtime.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/string.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/jaxen-full.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/utility.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/jspsql.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/xercesImpl.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/xalan.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/datetime.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/mailer.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/dom.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/jstl.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/standard.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/jdbc2_0-stdext.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/saxpath.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/sax.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/dbbeans.jar"/>
<classpathentry kind="lib" path="Web Content/WEB-INF/lib/jaxp-api.jar"/>
<classpathentry kind="lib" path="C:/oracle/ora92/jdbc/lib/classes12.jar"/>
<classpathentry kind="output" path="Web Content\WEB-INF\classes"/>
</classpath>
to me it looks like it is in my classpath.. (if thats what this is).
I have imported the classes12.jar file several times through out my project to no avail.
the error i get it here:
Error: It Screwed up agian java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
SystemOut O Connecting ... cisinv
Error: java.sql.SQLException: No suitable driver
SystemErr R Exception: null
from this code:
package Business;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
* @author jeffreak
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
public class beanDbConnect {
* Constructor for beanDbConnect.
public beanDbConnect() {
super();
private Connection con = null;
private Statement cmd = null;
private ResultSet rs = null;
public Connection connect()
//Declare variable
boolean blnSuccessfulOpen = false;
Driver driver;
String driverName;
String serverAddress;
//Begin try block
try
//Load JdbcOdbcDriver
driverName = "oracle.jdbc.driver.OracleDriver";
//oracle.jdbc.driver.OracleDriver
System.out.println("Loading ..." + driverName);
//try{
Class.forName(driverName).newInstance();
//catch (Exception err)
// System.err.println("Error: new instance: " + err.toString());
System.out.println("Database loaded successfully");
//catch (ClassNotFoundException e)
catch (Exception e)
System.err.println("Error: It Screwed up agian " + e.toString());
blnSuccessfulOpen = false;
try
//Instantiate connection to bean-defined DSN
//serverAddress = ("jdbc:oracle:thin:scott/tiger@localhost:1243:" + dbInstance);
System.out.println("Connecting ... " );
String serverName = "**********";//changed for post
String portNumber = "1521";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + "cisinv";
con = DriverManager.getConnection(url, "scott", "tiger");
System.out.println("Ready.");
blnSuccessfulOpen = true;
catch (SQLException e)
System.err.println("Error: " + e.toString());
//End try block
return con;
}//end connect()
Please help. ive been working on it for days =(.If you're running a Web app, put all JARs that your app needs in the WEB-INF/lib directory. That's always in the CLASSPATH.
I don't know WebSphere. Do you really have to edit something to add all those CLASSPATH entries?
In Tomcat, all I'd have to do is put a WAR file in the webapps directory.
Your code needs some work. You're not following Sun's Java coding standards. Capitalize your class name, for starters.
Is the username and password for your database still "scott" and "tiger"? Nice security there.
Your connect method makes a database connection. Do you leave it to users to close it? (You do close your connections when you're done with them, don't you?)
I'd make Connection a data member and create it in a constructor. I'd write a close method to close it up.
Doesn't WebSphere do connection pooling? Do you really want to write your own class to handle this?
MOD -
Cannot connect to database using JDBC
Hello!
I am trying to connect to my local database using this script:
import java.sql.*;
public class test{
public static void main (String[] args){
try
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
Statement StmtPersoane = conn.createStatement();
ResultSet CrsPersoane =StmtPersoane.executeQuery("select p.* from personal p");
int jMarca = 0;
while(CrsPersoane.next()){
jMarca = CrsPersoane.getInt("marca");
System.out.println(jMarca);
CrsPersoane.close();
StmtPersoane.close();
conn.close();
catch(SQLException e)
e.printStackTrace();
}When compiling i am getting this error: Error(7,58): cannot access class oracle.jdbc.driver.OracleDriver; file oracle\jdbc\driver\OracleDriver.class not found
I have set a CLASSPATH enviroment variable with value : D:\oracle10g\product\10.1.0\Db_1\jdbc\lib\ojdbc14.jar
Please provide some hints. Thanks in advace !Problem solved with the connection, but now i'm getting another error when i am trying to parse an error. Here is the code a little bit modified:
import java.sql.*;
import java.text.*;
import java.text.ParseException;
import java.util.*;
public class test{
public static void main (String[] args){
try
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
Statement StmtPersoane;
StmtPersoane = conn.createStatement();
ResultSet CrsPersoane =StmtPersoane.executeQuery("select marca from personal");
int jMarca;
jMarca = 0;
java.util.Date dataJava = new java.text.SimpleDateFormat("dd/mm/yyyy").parse("04/10/2006");
java.sql.Date dataSql = new java.sql.Date(dataJava.getTime());
System.out.println("Data: "+dataSql);
System.out.println("Angajatii sunt:");
while(CrsPersoane.next()){
jMarca = CrsPersoane.getInt("marca");
System.out.println(jMarca);
CrsPersoane.close();
StmtPersoane.close();
conn.close();
catch(SQLException e)
e.printStackTrace();
}The error:
Error(24,81): unreported exception: java.text.ParseException; must be caught or declared to be thrown
Any ideas ? -
Error in connection to oracle using java
hi ,
i am tring to make a connection to oracle database using java with this code
public class DataBase {
public DataBase(){
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "oracle.jdbc.dirver.OracleDriver";
Class.forName(driverName);
// Create a connection to the database
String serverName = "http://localhost:7777";
String portNumber = "1521";
String sid = "ora9i";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "scott";
String password = "tiger";
connection = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
JOptionPane.showMessageDialog(null,"Coud not find the database driver ");
// Could not find the database driver
} catch (SQLException e) {
JOptionPane.showMessageDialog(null,"Coud not connect to the database ");
// Could not connect to the database
public static void main(String[] args) {
new DataBase();
i always got the compilation error Coud not find the database driver
i am using oracle9i and jdk1.5.0_04 and my classpath is C:\oracle\ora92\jdbc\lib\ojdbc14.zip;C:\oracle\ora92\jdbc\lib\orai18n.zip
i am realy stuck with this so any one can help me with this probelm
thanks alot,thanks for your reply,
yes i changed the server name and i verified the location of the JDBC driver file(s) on my computer. any way i solved my problem.
you know there was a misunderstanding in what you mean by classpath, i thought that i have to change the classpath from control panel>system>advance>enviroment variable
and then select classpaht and edit it. i was doing this but this is didn't work.
then i don't know why i did that
i went to java program and select my project,right click on it and then select properties>java build path and then select "add external Jars" button and then i simply choose them and add them to my project. and finaly it worked.
thanks alot -
Unable to connect to oracle using type4 driver
hi
I was trying to connect to oracle Database using type 4 thin drivers on win98.
I downloaded the driver from oracle site and also downloaded some more drivers
from other sites.While connecting to data base I ran into problems I am working
for about two days on this thing but couldn't succeed.
I get the following message:
Connection refused ...........
The driver is succefully loaded but when it tries to connect using
conn = DriverManager.getConnection("jdbc:oracle:thin:@server:1521:orcl","userid","password");
it gives the above message.
now I think that I am giving the host name incorrect I couldn't find
any way in oracle to figure out the host name.
I am giving
"jdbc:oracle:thin:@127.0.0.1:1521:orcl"
I have also tried other options for host name like localhost etc.but it
didn't resolve.I think that the listener for oracle is not listening at the port 1521.
I tried telnet to check that but it failed to connect at this port.I tried to do this
with mysql to connect at port 3306 using telnet it succeeded.
Second thing is that I tried to create a service name in oracle using TCP/IP protocol
giving the above mentioned host names at all the attempts it gave the error that it has performed
an illegal operation .
I think that there are some settings needed for oracle to listen at this port which
I dont know or I am giving the host name wrong . I shall be extremely thankful if u help
me to solve this problem.
Regards
shAhzadIt has been a long time since I tried to run Oracle on Win98 (or Win95) for that matter, but I don't believe that there is a listener in the traditional sense since you would be using Personal Oracle. Your first step should be to make sure you can login to Oracle using the standard client and SQLPLUS. You could then use TNSPING to see if the listener is listening (you will need to setup TNSNAMES.ORA properly but you can use the Net8 Assistant or whatever). Next I would suggest you try using the OCI client instead of the thin client.
If you can, it would be much better to install Oracle on an NT, Win2K, or Linux machine. Oracle on Win98 is not really the same thing. -
I am unable to connect to oracle using thin driver
Hi,
I am writing a program to connecto database using thih driver,by using ipadress of server where oracle 8i is installed.I am getting an error
Exception in thread "main" java.sql.SQLException: No suitable driver
How to over come this.Any one please help me.I am getting error saying No suitable driver found
this is my function:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.112:1521:orcle8i","scott","tiger");
oracle 8i is my database name.I have created another database name with oracle in the server. will it cause any problem. -
Problem with connect to oracle by jdbc
hi,
First time i try to connect to the oracle db 10.2.0* EE in java and its problem. I use eclipse 3.4, jre1.5.0_17, driver ojdbc14.jar (dedicated to this oracle ver and jre).
package connect;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JDBC_Conn {
void polaczenie_z_baza() throws SQLException {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("connected");
} catch (Exception e) {
System.out.println("not connected");
Connection polaczenie=DriverManager.getConnection("jdbc:oracle:thin:@3.123.123.321:1521:RI3","user","pass");
public static void main(String[] args){
JDBC_Conn b = new JDBC_Conn();
try {
b.polaczenie_z_baza();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}and after run in console i see: "connected" but after 2 seconds i see error:
java.sql.SQLException: Wyjątek we-wy: The Network Adapter could not establish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:439)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at connect.JDBC_Conn.polaczenie_z_baza(JDBC_Conn.java:18)
at connect.JDBC_Conn.main(JDBC_Conn.java:24)This is important that i can login to the database by pl/sql developer using tnsnames.ora like this:
CIF2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 3.123.123.321)(PORT = 1521))
(CONNECT_DATA =
(SID = RI3)
)but when im logging by plsql developer i need to enter the name of database "DWH" too, another i cant login. The same when i log by sql plus, i need to enter the: user@DWH.
So please tell me could i add to this string:
"jdbc:oracle:thin:@3.123.123.321:1521:RI3","user","pass"
the DWH database? where i should to put it?
i try a lot of cases and cant login
thanks for helpi put:
String url = "jdbc:oracle:thin:"+user+"/"+pass+"@blahblahblah:blah:blah";
System.out.println( url );
Connection con = DriverManager.getConnection( url );and i have:
not connected
jdbc:oracle:thin:user/password@blahblahblah:blah:blah
java.sql.SQLException: Wyjątek we-wy: Invalid number format for port number
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:439)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at connect.JDBC_Conn.polaczenie_z_baza(JDBC_Conn.java:27)
at connect.JDBC_Conn.main(JDBC_Conn.java:37)the pass and user name i put corectly..
is it possible that DBA did some restrict to access DB?
Edited by: pawelwtorek on 2009-03-19 16:59 -
Unable to connect to Oracle using OS authentication (sqlplus / as sysdba)
Hello,
When I try to connect locally ,using OS authentication ( sqlplus / as sysdba ), on a Oracle database, I get "ORA-01031: insufficient privileges" error.
OS: Windows XP
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod.
connecting as sysdba using sys/pasword works.
I have setup :
-> Log on as a batch job
-> Log on as a service
I am also member of ORA_DBA group.
I mention that connecting "/ as sysdba" worked many months after I've installed the Oracle database. But at some moment in time connecting "/ as sysdba" was no longer possible.
C:\>sqlplus / as sysdba
SQL*Plus: Release 10.1.0.3.0 - Production on Wed May 23 11:08:52 2007
Copyright (c) 1982, 2004, Oracle. All rights reserved.
ERROR:
ORA-01031: insufficient privileges.
Thank you for any suggestion.Hi,
I have the same issues from the beginning..
I have two Oracle homes ( One for earlier installed SOA10g, and another for current installing SOA11g).
I have the right sqlora.net file. I have removed the old path and reset to point the new oracle home. I have this home entry as the first entry in my Universal installer too.
I AM ABLE TO CONNECT WITH sys USER AS SYSDBA on THE SAME SYSTEM ( I MEAN WHERE i INSTALLED THE DATABASE) USING THE command prompt.
But I am not able to connect as the SYSDBA with sys ACCOUNT through the SQLDeveloper tool. or RCU tool? Any help please. Again I am able to connect as a normal user through the SQL developer using the SYSTEM account.
-- Khaleel -
How to store .doc file in oracle using jdbc
Here is problem , storing microsoft excel file (or) .txt file to database(ORACLE) through JDBC .
how to retriveCongratulations! You are the one millionth person to ask how to store files in databases without searching for previous threads.
What do you win?
A hearty smack in the forehead and a strenuous endorsement to use Google, search and find the answer. -
Wierd message while connecting to ORACLE using sqlplus
Hi
Server:AIX 3 5
Oracle: 10.2.0.1 patched to 10.2.0.3
i tried connecting to oracle and getting a wierd error only via OS Authenticated user not while connecting as sys or "/ as sysdba"
$ sqlplus /
1224868 : map : Permission Denied
1224868 : map : Permission Denied
1224868 : map : Permission Denied
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Nov 27 00:40:18 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
any idea on this?
thanks
DeepakServer:AIX 3 5Is it true or mistake ? I don't think Oracle 10g has ever supported on that AIX version.
Anyway, what OS user did you use ?
Nicolas.
Maybe you are looking for
-
How to change VO query dynamically
Hi, Iam trying to change the VO query dynamically. My req. is I have 6 columns in a header page 3 columns(default single column) for sorting purpose and another 3 columns(default single column) for data querying purpose. al these are in one view so I
-
So I am really confused on this subject... I have the Creative Cloud subscription, therefore I have a webBasics site. It says on the Business Catalyst pricing page that with the webBasics package it comes with access to the file manager... But when I
-
Titles are automatically changing length and shortening - imovie '11 version 9.0.2
Titles are automatically changing length and shortening no matter what I do. I'm using imovie '11 version 9.0.2 I have tried everything and they keep reverting back to random sizes. I have several 4 sec still pictures and I want the titles to match
-
ABAP Objects: Introduction to Programming SAP Applications
Hi, does anybody knows any tutorial that would explain me how to install and make available in my SAP installation the examples and database that comes with this book ABAP Objects: Introduction to Programming SAP Applications The point is that i coul
-
System Performance - ERROR Workitems
Hi Friends , I have the following query . I have no of workitems in ERROR status and workflow has been stopped . I dnt want to process those workflows further . I dnt want those ERROR workitems to be cleaned from my sysetm . I think this ERROR wor