tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anto Paul <antop...@gmail.com>
Subject Re: Database Connectivity of JSP(Tomcat 4.x) with Oracle 8i
Date Wed, 18 Jan 2006 13:26:18 GMT
On 1/18/06, gupta vidhi <vidhi_gupta2002@yahoo.com> wrote:
>
> i'd copied the classes12.zip from C:\jdbc\lib. there's no folder of
> ORACLE_HOME.
> now,what else to be done?

By ORACLE_HOME I meant where oracle is installed. You cannot attach
files while sending mail to this list.

The code should look like this

<%@ page import="java.sql.*"%>
<%@ page import="oracle.jdbc.driver.*"%>
<%
String url = "jdbc:oracle:thin:@192.168.4.220:1521:ora9i";
String user = "scott";
String password = "tiger";
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
Connection conn = DriverManager.getConnection (url,user, password);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery ("select empno from emp");
while (rs.next()) {
	out.print(rs.getString (1) + "<br>");
}

rs.close();
stmt.close();
conn.close();

%>

> i'm sending you my JSP page. kindly tell me what code should be
> written/added to execute it successfully.
> i'd created the table named as user1 in oracle 8.0 and inserted some values
> in it.
> the name of the database in which this table is been created is prime.
>
> Regards,
> Vidhi
>
> Anto Paul <antopaul@gmail.com> wrote:
> On 1/18/06, gupta vidhi wrote:
> > i've JDBC installed in other path than Tomcat.you asked me to put the JDBC
> driver library into WEB-INF\lib. there's WEB-INF directory,but it do not
> have lib as its sub directory.what can be done for this?
> > kindly tell me how to do the path setti ng of JDBC with JSP.
> > i'd made a page in JSP,but when executing its generating error as:
> >
> > javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] Data
> source name not found and no default driver specified
> > and so on.
> > kindly tell how to connect my JSP page with JDBC.
> >
>
> A JDBC tutorial is here
> http://www-db.stanford.edu/~ullman/fcdb/oracle/or-jdbc.html
>
> Don't use JDBC-ODBC bridge. From the error message it seems that
> it is using JDBC-ODBC bridge.
> You will get the JDBC driver from ORACLE_HOME\jdbc\lib. For 8i the
> file will be classes12.zip. Create a lib directory in WEB-INF
> directory. Tomcat is case sensitive and lib must be in small letters.
> Copy classes12.zip to WEB-INF\lib and rename it to classes12.jar. Now
> to connect to database use the JDBC URL like
> jdbc:oracle:thin:hr/hr@localhost:1521:orcl.
>
> Don't for to restart Tomcat after putting the JAR file in WEB-INF\lib.
>
> The Oracle installation provides some sample Java code. Look in
> jdbc folder for it.
>
> --
> rgds
> Anto Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
>  ________________________________
> Yahoo! Photos
>  Got holiday prints? See all the ways to get quality prints in your hands
> ASAP.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


--
rgds
Anto Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message