Hi all! I really hope someone can do a huge favor and help my group out!

We are students and we are trying to complete an assignment to create an interface page using jsp and oracle.

Using XP pro we have installed all of the above.
We then configured apache http server to listen on port 8080. So http://localhost:8080/ returns the apache page. Oracle has been installed as http://localhost:8081/apex (this brings up the login page)

In Oracle we have created a user ge password ge and made a table with 'first_name' and 'last_name' just for testing purposes. That's it.

Now, we have been trying to create a jsp page that will connect to Oracle with no luck so far.

Now the tricky stuff. We downloaded the jdbc-odbc bridge. We went into control panel>>admin>>odbc connections and made a SYSTEM DSN called ge2. (What should the configuration be right here???).

Now, since we are using Dreamweaver 8 on my test_1.jsp page I clicked the + sign (create a new connection) and here I must tell it what to use. Ex: Oracle Thin, JDBC-ODBC, etc. We selected the JDBC-ODBC and then we have to fill in the following properties...

Battery died. On a Mac now. Will edit later today.

Now, I have read that creating the database connection in the page is and old way and is now considered to be Wrong! Instead you must create a servelet, whatever that is, and connect through that.

If you guys need more detail or anything like that just let me know.

We appreciate it!

// Sorry I could not find a way to edit my own post //

Hi all! I really hope someone can do a huge favor and help my group out!

We are students and we are trying to complete an assignment to create an interface page using jsp and oracle.

Using XP pro we have installed all of the above.
We then configured apache http server to listen on port 8080. So http://localhost:8080/ returns the apache page. Oracle has been installed as http://localhost:8081/apex (this brings up the login page)

In Oracle we have created a user ge password ge and made a table with 'first_name' and 'last_name' just for testing purposes. That's it.

Now, we have been trying to create a jsp page that will connect to Oracle with no luck so far.

Now the tricky stuff. We downloaded the jdbc-odbc bridge. We went into control panel>>admin>>odbc connections and made 2 SYSTEM DSN's. (What should the configuration be right here???).

DSN#1 Name: ge; Driver: Oracle in XE
Configuration: Data Source Name: ge; TNS Name: XE; UserId: GE/ge
Test results in 'Connection Successful'

DSN#2 Name: GE2; Driver: Microsoft ODBC for Oracle;
Configuration: Data Source Name: GE2; User Name: GE/GE; Server: 127.0.0.1
Test results in 'Connection Successful'


Now, since we are using Dreamweaver 8 on my test_1.jsp page I clicked the + sign (create a new connection) and here I must tell it what to use. Ex: Oracle Thin Driver, Sun JDBC-ODBC, etc. We selected the Sun JDBC-ODBC and then we have to fill in the following properties...

Connection Name:
Driver: "Field pre-populated with: 'sun.jdbc.odbc.JdbcOdbcDriver;"
URL: "Field pre-populated with: 'jdbc:odbc:[odcb dsn]
User Name:
Password:
Dreamweaver shold connect: Radio 1 = using driver on testing server , Radio 2 = Using Driver on this machine (Selected).

After this all I get back is:

"[Microsoft][ODBC Driver Manager] Data source anme not found and no default driver specified"


Now, I have read that creating the database connection in the page is and old way and is now considered to be Wrong! Instead you must create a servelet, whatever that is, and connect through that.

If you guys need more detail or anything like that just let me know.

We appreciate it!

SaveName.jsp

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<%@ page import = "java.sql.*"%>
<%@ page import = "java.io.*"%>

<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
out.println("hello" );
Connection con = DriverManager.getConnection("jdbc:odbc:reg","ge","ge");
out.println("hello java world" +con);
String name = request.getParameter( "username" );
out.println("hello "+name);
session.setAttribute( "theName", name );
out.println("hello");
con.close();

}catch(Exception e)
{
e.printStackTrace();
System.out.println("exception occured"+e);
}
%>


Test_2.jsp

<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>

hi,

if you are using oracle ver greater than 9 then
oracle driver shall be

Class.forName("oracle.jdbc.OracleDriver");

I tried with oracle 10g express edition
with oracle xe driver it worked for me.

you shall change your connection string and driver as follows:


Class.forName("oracle.jdbc.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:ge","GE","ge");

im using Tomcat 5.5.
hope u too using tomcat.

well, ANY version of Oracle released in the last decade has JDBC drivers.
Using the bridge driver is ALWAYS wrong! ALWAYS!

And so is doing database access from JSP.

This article has been dead for over six months. Start a new discussion instead.