Dear sir,
I have a problem about using a connection pool in a servlet.Server giving
error(java.sql.SQLException:Pool
cnnect failed:weblogic.common.ResourceException:None available).I create a
new connection pool name Pool.Iam using sqlserver7.0.In Jdbc connection
pool section in URL section:-jdbc:weblogic:pool:biku(where biku is my
system DSN name)in Driver classname:-weblogic.jdbc.pool.Driver.In
key=value section(user=sa
password=none because in sqlserver there is no password).And in "target"
section I chosen myserver.Please guide me where I done a mistake.
Following r my codes:-
It is my servlet file:-
------------------------
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
public class Pool extends HttpServlet
{
String queery,queery1=null;
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws
ServletException,IOException
{
Connection con=null;
ResultSet rs=null;
Statement stmt=null;
PrintWriter out = res.getWriter();
res.setContentType("text/html");
String str1=req.getParameter("Name");
String str2=req.getParameter("Password");
String str3=req.getParameter("Address");
String str4=req.getParameter
("ContactNo");
out.println(str1);
out.println(str2);
out.println(str3);
out.println(str4);
try
{
Driver myDriver=(Driver)
Class.forName("weblogic.jdbc.pool.Driver").newInstance();
}
catch(Exception e)
{
System.out.println("Error from Driver:" + e.toString());
}
try
{
con=DriverManager.getConnection
("jdbc:weblogic:pool:Pool",null);
}
catch(Exception e)
{
System.out.println("Error from getConnection:" + e.toString
());
}
try
{
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println("Error from Statement:" + e.toString
());
}
try
{
queery="INSERT INTO TABLE3 (Name,Password) VALUES
('"+str1+"',"+str2+")";
}
catch(Exception e)
{
System.out.println("Error from sqlStatement:" +
e.toString());
}
try
{
stmt.executeUpdate(queery);
}
catch(Exception e)
{
System.out.println("Error from Excecution:" + e.toString
());
}
try
{
queery1="INSERT INTO TABLE4 (Address,ContactNo) VALUES
('"+str3+"',"+str4+")";
}
catch(Exception e)
{
System.out.println("Error from sqlStatement:" +
e.toString());
}
try
{
stmt.executeUpdate(queery1);
}
catch(Exception e)
{
System.out.println("Error from Excecution:" + e.toString
());
}
}
}
It is my html file:-
-----------------------<html>
<head>An example</head>
<title>Test</title>
<body>
<form method="post" action="http://127.0.0.1:7001/Start5">
<b><i>Enter Your Name</i></B>
<input type="text" name="Name" size="25"><br>
<b><i>Enter Your Password</b></i>
<input type="password" name="Password" size="25"><br>
<b><i>Enter Your Address</i></B>
<input type="text" name="Address" size="25"><br>
<b><i>Enter Your ContactNo.</b></i>
<input type="text" name="ContactNo" size="25"><br>
<input type="Submit" value="Submit">
<input type="Reset" value="Reset">
</form>
</body>
</html>
With regards
Bikash