It's not a secret anymore!*
The moose likes Websphere and the fly likes Problem in connecting Oracle9i  thru wsad5.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Problem in connecting Oracle9i  thru wsad5.0 " Watch "Problem in connecting Oracle9i  thru wsad5.0 " New topic
Author

Problem in connecting Oracle9i thru wsad5.0

srinivasa reddy
Greenhorn

Joined: Sep 13, 2003
Posts: 11
hi,
I am just trying one of the example in this site,i am using Oracle 9.0.01 and WSAD5.0, i could not connect to database,
java.sql.SQLException: [Microsoft][ODBC driver for Oracle][Oracle]no result
I have included classes12.zip in the path,created the odbc driver.As i am new to java and wasd , sending detailed procedure to get connection with oracle 9i will be more helpful.
Here i am sending the code.
import java.io.*;
import java.util.*;
import javax.servlet.*;
import java.sql.*;
import javax.servlet.http.*;
public class OriellyExamples extends HttpServlet{
Connection dbConnection;

/* public void init()
{
// ServletConfig config=getServletConfig();

// System.out.println(getServletName()+":Initializing...");

// String driverClassName=config.getInitParameter("driverclassname");

// String dbURL=config.getInitParameter("dburl");

// String username=config.getInitParameter("username");

// String password=config.getInitParameter("password");

/* try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

}catch(ClassNotFoundException e){System.out.print("beep");}

/* try
{
dbConnection=DriverManager.getConnection("jdbc
dbc b1","hello","welcome");
}catch(SQLException e){}

System.out.println("Initialized");*/
// }

public void service(HttpServletRequest req,HttpServletResponse
res) throws ServletException,IOException {
PrintWriter pw=res.getWriter();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Class.forName("oracle.jdbc.driver.OracleDriver");

dbConnection = DriverManager.getConnection("jdbc dbc:esr","scott","tiger");
//dbConnection = DriverManager.getConnection("jdbc racle:thin:@localhost:1521:esr","scott","tiger");
Statement smt=dbConnection.createStatement();

ResultSet r = smt.executeQuery("SELECT * FROM emp");

pw.println("<html>");
pw.println("<body>");

pw.println("<h1>hello</h1>");

while(r.next())
{
int j=r.getInt("ID");
String s = r.getString("name");
pw.println("ROW = " + " " +s+ " " + j);
}
pw.println("</body>");

pw.println("</html>");
smt.close();

dbConnection.close();
}
catch(Exception e)
{
pw.println("<html>");

pw.println("<h1>"+e+"no result</h1>");

pw.println("</html>");
}
}
Exception is:java.sql.SQLException: [Microsoft][ODBC driver for Oracle][Oracle]no result
help appreciated
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in connecting Oracle9i thru wsad5.0
 
Similar Threads
Help! DriverManager.getConnection problem
load on startup causing problems
Help ! DriverManager.getConnection problem
Oracle9i Connectivity thru wsad5.o
Connection to a db