473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Re: Problem connection to an Oracle Database ??


Originally posted by Nelson Broat
Hi, I could use some advice. I'm not sure if this is simply a matter
of improperly displaying results that have been returned, or one of
not properly connecting to the database. What follows is a jsp I
threw together to pull data from a table and display it dynamically
within my I.E. browser.

Did I include all the neccessary Classpaths? When the first classpath
was included with all of the rest on my second IMPORT statement, I
kept receiving "could not compile" error messages. So I put it in
its own IMPORT statement.

Am I issuing the appropriate getConnection method? Thanks for any and
all advice. Appreciate it. Here is the jsp:

<%@ page import="com.epicentric.jdbc.*"%>

<%@ page import="java.util.*,
java.text.*,
java.io.*,
java.net.URL,
com.epicentric.common.*,
java.sql.*"
%>

<%@ include file="/include/common.jsp"%>

<%@taglib uri="epi-tags" prefix="epi_html" %>
<%@taglib uri="module-tags" prefix="mod" %>
<epi_html:controllerURL />
<epi_html:checkTicket />

<%

//instantiate variables
Connection con = null;
Statement stmt = null;
ResultSet rs = null;

try {
//Load the JDBC driver
Class.forName("oracle.jdbc.driver.OracleDriver").n ewInstance();

//Get the connection getConnection("oracle driver", "userID",
"password")
con = DriverManager.getConnection("jdbc:oracle:thin:@dns _name:portnum-
ber:oracle_instancename","userid","password");

stmt = con.createStatement();

//sql statements: create, update, query
rs = stmt.executeQuery("SELECT * FROM DB.DB_RESOURCE WHERE
DB.DB_RESOURCE.CODE = '**'");

while (rs.next())
System.out.println(rs.getString(1));

rs.close();
stmt.close();
con.close();
}
catch(Exception ex) {
System.out.println("Error " + ex.toString());

}
%>

Nelson

Have you included Oracle jdbc driver in your classpath? Depending on
your Oracle version, it would be ORACLE_HOME/jdbc/lib/classesXXX.zip or
classesXXX.jar file.

Regards
/Rauf

--
Posted via http://dbforums.com
Jun 27 '08 #1
0 1572

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Harry | last post by:
Using Oracle 8i enterprise on win 2000 (sp3) Installed the standard configuration & whenever I make a connection it takes about 10 secs. It's running on a P1900 with 1gb Ram so no reason there...
0
by: JWM | last post by:
I am trying to implement Oracle connection pooling for the following code, which was written by someone else. Here is my main question -- this java file creates code that is executed every hour,...
1
by: Cliff Cooley | last post by:
Can anybody suggest what may be causing the following problem ? I have an ASP script that opens a connection to an Oracle database using a DSN connection string, such as : Set dbConn=...
9
by: mcbill20 | last post by:
Hello all. I just installed Oracle 10g developer tools on a machine running XP Pro and Office XP. Before this I had just the Oracle 9 client installed. I the previous configuration, I was able to...
6
by: Bala Nagarajan | last post by:
Hello, I am using Oracle 9i in my application and facing a problem with the connection string. In the datasource attribute of the connection string i had to specify an entry in "tnsnames.ora"...
1
by: mingki | last post by:
Hi Developers, I am a .Net developer of a Large Online Retailling Company. I would like to have your help on a Connection Pool issue. Recently we have developed a Web Application on ODP .Net...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
1
by: Subangini | last post by:
"Hi, I am trying to migration Oracle database to mysql database using visual coding. I am having problem in the Do until loop, can u tell me what is the mistake. Oracle Database - Oracle...
4
by: =?Utf-8?B?RFNJU3VwcG9ydA==?= | last post by:
Hi, I have this ASP.NET application developed with VS.NET 2003 VB.NET and deplyed on Windows 2K server IIS 5. This application uses the following: - Oracle 10G databse - MS Data Access Block...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.