Home » Fusion Middleware & Colab Suite » Weblogic & Application Server » Build a webpage connectivity with oracle database using jsp
Build a webpage connectivity with oracle database using jsp [message #77110] Sun, 05 September 2004 08:17 Go to next message
Vikram
Messages: 16
Registered: March 2000
Junior Member
If anyone can help me in making the connectivity of the webpage with oracle database using jsp then plz help me & if possible then send me the connecting string & any reference site or book
thanks
vikram
Re: Build a webpage connectivity with oracle database using jsp [message #77245 is a reply to message #77110] Mon, 06 December 2004 23:43 Go to previous messageGo to next message
Yogesh Vyas
Messages: 1
Registered: December 2004
Junior Member
Please explain me how to do it.

Many Thanks,
Yogesh
Re: Build a webpage connectivity with oracle database using jsp [message #77266 is a reply to message #77245] Fri, 24 December 2004 10:23 Go to previous messageGo to next message
vishwas
Messages: 2
Registered: July 2002
Junior Member
First, make sure your web server is configured to load the appropriate JDBC driver classes.

If you can't do that (because you're not the web administrator, for example),
you can do it from the page by writing the appropriate Class.forName

[<]%! Class.forName("my.appropriate.Driver"); %[>]
e.g. [<]%! Class.forName("oracle.jdbc.driver.OracleDriver");%[>]

Next, import the SQL classes in the page tag:
[<]%@ page ... import="java.sql.*" %">
e.g. [<]%@ page import="java.sql.*"%[>]

Then, create the database connection using the JSP declaration tag:
[<]%! Connection connection = DriverManager.getConnection(...) %[>]
e.g [<]%! Connection conn = DriverManager.getConnection("jdbcracle:thin:@testmachine:1521:SID", "scott", "tiger");%[>]

Finally, make a query and display the results:
[<]% Statement statement =
connection.createStatement();
ResultSet resultSet =
statement.executeQuery("select * from emp"); %[>]

The results are:

    [<]% while (resultSet.next()) { %[>]
  • [<]%= resultSet.getString(1) %[>] [<]% } >


And that's it.
Re: Build a webpage connectivity with oracle database using jsp [message #77275 is a reply to message #77266] Sat, 15 January 2005 04:47 Go to previous message
dffd
Messages: 1
Registered: January 2005
Junior Member
fdfdfd
Previous Topic: What is nmump.exe? It's grabbing my entire CPU.
Next Topic: exceptions were raised when calling procedure in c#.net through ODP for .net
Goto Forum:
  


Current Time: Fri Apr 19 13:33:57 CDT 2024