Results 1 to 5 of 5
Thread: Jdbc problem.Help Needed
- 01-06-2009, 07:38 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 5
- Rep Power
- 0
Jdbc problem.Help Needed
mport java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Jdbc extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection(
"jdbcracle:thin:@localhost:8080:abhishek","sco tt ","tiger");
// @machineNameort:SID, userid, password
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Test JDBC Connection</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("<H1>Connection Established Successfully</H1>");
out.println("</BODY>");
out.println("</HTML>");
} catch (ClassNotFoundException e1) {
out.println("Connection Failed " + e1.toString());
} catch (SQLException e2) {
out.println("Connection Failed " + e2.toString());
} catch (Exception e3) {
out.println("Connection Failed " + e3.toString());
}
}
}
this is my code. My Sid is abhishek. am using oracle 9i.apache tomcat application server.But the problem i am facing is i am getting "Connection Failed java.sql.SQLException: Io exception: Got minus one from a read call "... Please help!!!!
- 01-07-2009, 06:14 AM #2
Member
- Join Date
- Jul 2008
- Posts
- 68
- Rep Power
- 0
I think you have a typo in your connection string try
Java Code:"jdbc:oracle:thin:@localhost:8080:abhishek"
- 01-08-2009, 07:35 PM #3
Member
- Join Date
- Jan 2009
- Posts
- 5
- Rep Power
- 0
No help!!!
have tried it.. but to no avail...what exactly should be the config in server.xml.. what jars do i have to place there? Please help!!!!:(
- 01-09-2009, 05:48 AM #4
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
which kind of JDBC drivers are you using?
OCI or Thin DriverLast edited by mtyoung; 01-09-2009 at 05:52 AM.
- 01-09-2009, 06:35 AM #5
Member
- Join Date
- Jul 2008
- Posts
- 68
- Rep Power
- 0
Similar Threads
-
Problem in JDBC
By Preethi in forum New To JavaReplies: 11Last Post: 01-08-2009, 05:18 PM -
Jdbc problem
By abhiN in forum JDBCReplies: 1Last Post: 03-21-2008, 05:10 AM -
JDBC problem
By Swamipsn in forum New To JavaReplies: 1Last Post: 08-13-2007, 06:05 PM -
JDBC Driver problem
By Swamipsn in forum New To JavaReplies: 3Last Post: 08-09-2007, 03:55 PM -
JDBC problem
By peiceonly in forum Threads and SynchronizationReplies: 2Last Post: 08-03-2007, 01:42 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks