473,624 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.epi centric.jdbc.*" %>

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

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

<%@taglib uri="epi-tags" prefix="epi_htm l" %>
<%@taglib uri="module-tags" prefix="mod" %>
<epi_html:contr ollerURL />
<epi_html:check Ticket />

<%

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

try {
//Load the JDBC driver
Class.forName(" oracle.jdbc.dri ver.OracleDrive r").newInstance ();

//Get the connection getConnection(" oracle driver", "userID",
"password")
con = DriverManager.g etConnection("j dbc:oracle:thin :@dns_name:port num-
ber:oracle_inst ancename","user id","password") ;

stmt = con.createState ment();

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

while (rs.next())
System.out.prin tln(rs.getStrin g(1));

rs.close();
stmt.close();
con.close();
}
catch(Exception ex) {
System.out.prin tln("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 1591

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

Similar topics

3
14515
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 for slowness. Once I'm connected the queries work pretty much instantanously but to connect using SQLPLUS, Toad, ODBC, OLEDB all take about 10 secs. I connect using OLEDB from Visual Basic development environment & after the 1st connection...
0
4744
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, but once per week, the oracle server is brought down for backup. At that time, I get an error that looks like I have the wrong credentials for the database. For every subsequent attempt to run the hourly process, I am getting a broken pipe error,...
1
4713
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= Server.CreateObject("ADODB.Connection") dbConn.Open "DSN=somedsn; UID=someuser; PWD=somepassword" With the ASP running on an IIS 5 server, using the Oracle 8 driver to connect to an Oracle 9 database, there are no connection problems, and
9
17017
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 access any of the Oracle tables on another machine but now I am having problems. Unfortunately, I don't remember the correct syntax for the ODBC connect string and I am hoping that is my whole problem. I am trying to connect to an Oracle 9...
6
17717
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" file for it to work correctly. If i copy and paste the entry in the "tnsname.ora" file it complains the connection string is too long. I want to avoid using the "tnsnames.ora" file since it exposes the server (and needles to say the configuaration!)...
1
12108
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 to work with Oracle Database 10g. To gain the performance, connection pool enable is a must. Everything work fine throughout the development period and the performance is Great, however while the Web Application is deployed to the production,...
3
10287
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 I use System.Data.Common.DBConnection and .DBCommand. How can I keep aware from connection losses (network not availeable, db-server not available...)? Are there any strategies to detect this broken connections, and how can I
8
9624
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 work from
1
2456
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 rdb with VMS operating system Mysql- version 5 Visual basic - version 6.0 Since my host machine Oracle is an older version I have problem, do
4
6372
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 from MS Enterprise Library June 2005 (with the other blocks like exception, security...) - Use Crystal Report Components for printing reports online And everything was fine until recenntly we started getting this error randomly and the only way to...
0
8175
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8625
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.