• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

oracle database and jsp

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
help,,, im sori i don't know what category to put my problem with, but all i know is that i put 'oracle.jdbc.driver.OracleDriver' into a jsp page so thats the reason why i put it here on this forum... oh my, im stuck here for a week...
okay,,, so here's my problem.. i don't know how to explain this but here goes...
in my jsp page,,, i wanted to connect to oracle database and access the data inside it... this is what i did in my jsp page...
<%@ page language="java" import="java.io.*, java.util.*, java.lang.reflect.Array, java.sql.*" %>
<%@ page language="java" import=" oracle.jdbc.driver.OracleDriver, oracle.jdbc.driver.OracleResultSet"%>
Connection conn = null; // current db connection

try {
String username="scott";
String password="tiger";
String oracleport="1521";

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection("jdbc racle:thin:@Table:"+oracleport+":"+nene,username,password);
conn.setAutoCommit(false);

GetData();

} catch (SQLException e){

} finally { CloseConnection();
}
*let's just assume that the functions GetData() and CloseConnection() are error free and they correct fully functioning well,
'GetData()' is the function where it gets all the data from the oracle database and put it into an jspVariablearray,
'CloseConnection()' is a function where it closes the database, -->
when i run the page, there is no servlet exception that appear, but when i checked the values from the generated html code, it shows that its values are zero...
my guess in the problem is that it didn't connect from the database because i did a class of this whole code from a java file lets named it Database.java, when i compiled and debug Database.java in the software Sun One and Forte, it had accessed the values from the oracle database, it is just in the jsp page that it didn't accessed the values...
i saw two things that could have been the problem why it didn't connect in the database, 1) from the page import i extracted OracleDriver.class and OracleResultSet.class in its .zip file namely classes12.zip my friend told me that it shouldn't not been extracted from the .zip file but he didn't know why... i don't how to import a .zip file to a page...
2) is that i don't know if
conn = DriverManager.getConnection("jdbc racle:thin:@Table:"+oracleport+":"+nene,username,password);
is the correct method of connecting to the oracle database from a jsp page....
so this is where i need help from you guys..
a) how to import .zip file to a jsp page...
b) is there any other method to connect to an oracle database from a jsp page?
c) is my theory correct? that my problem is the connection of database?
d) did you understand my problem?
thanks in advance guys,,, i know you can do it!
 
nene batungbakal
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh my what happend im sori about my grammar and with the quote this is what the real code should look like...
conn = DriverManager.getConnection("jdbc:oracle:thin:@"+user.hostName+":"+oracleport+":"+user.oracleName,username,password);
 
nene batungbakal
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
another mistake... sorry...
conn = DriverManager.getConnection("jdbc:oracle:thin:@Table:"+oracleport+":nene",username,password);
this is what it really should look like for you guys.. sorry...
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You can set the classes12.zip in the server classpath.
The url for connecting to a database is jdbc racle:thin:@<machine-name>:<port-no>:<sid>","user","password".
You can confirm if you are using the correct values using forte.Click on the Runtime tab->databases->oracle-> test the values.

The other way of creating connecing to the database is using jdbc datasource wherin you create connection pool in the server.
If you are using Sun one appserver for deploying your application , I guess I can help you if you have any more issues in connecting to the database.
Let me know.
 
nene batungbakal
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks
i checked my connection method using the Sun One IDE, and it works...
i am now using macromedia dreamweaver to create my jsp page and my webserver is resin... but i cannot get my connection to work, this is what my import looks like this:
<%@ page language="java" import=" oracle.jdbc.driver.OracleDriver, oracle.jdbc.driver.OracleResultSet"%>
because i extracted OracleDriver.class and OracleResultSet.class from classes12.zip. is this correct?
[ May 06, 2003: Message edited by: nene batungbakal ]
 
Amol Desai
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You don't have to extract the classes from the zip file.
You have to set classes12.zip in the resin server classpath.
I guess I could help you if you post the erros messages that you get while connecting to the database
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic