[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

JSP reading Oracle Tables...

Can JSP read Oracle tables? I've seen stuff like this done in ASP.NET, but I'm completely unfamiliar with using JSP/Java to connect to an Oracle Database and read-in information and send Queries and use results from those in outputs. Is there a place I can grab some APIs for doing this or examples??

Thanks.
0
kak39
Asked:
kak39
2 Solutions
 
KruleCommented:
A JSP page can (almost) do everything that a Java class can do, although it shouldn't.

If you want to do this the quick'n'dirty way, there is a set of JSP Tag Libraries that allow you to connect to a database, define an SQL query and execute it, and then use the rows for processing in your jsp page. You can find that here: http://jakarta.apache.org/taglibs/doc/dbtags-doc/intro.html with documentation here: http://jakarta.apache.org/taglibs/doc/dbtags-doc/dbtags-1.0/index.html and the binaries necessary here: http://jakarta.apache.org/site/downloads/downloads_taglibs-dbtags.cgi

If you are looking for an alternative solution, I would suggest calling a servlet that does your processing for you (Using something of this nature: http://javaalmanac.com/egs/java.sql/ConnectOracle.html )

Hope this helps
0
 
mmarksburyCommented:
Like ASP.NET, you need to use the objects that JAVA provides for data access.

Driver DriverObj = (Driver)Class.forName("Insert Driver String").newInstance();
Connection ConnectionObj = DriverManager.getConnection("ConnectionString", "UsernameString", "PasswordString");
PreparedStatment StatementObj = ConnectionObj.prepareStatement("SELECT * FROM SOMETABLE");
ResultSet ResultsObj = StatementObj.executeUpdate();

while(ResultsObj.next())
{
  // Fun Stuff
}

That should help get you started.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now