Home » Developer & Programmer » JDeveloper, Java & XML » Connectivity problme
Connectivity problme [message #92547] Fri, 10 September 2004 22:33
abdul
Messages: 18
Registered: May 2001
Junior Member
AOA to All.
I am waseem Manzoor from USA. I need a help from You.If any one can i will appreciate.And specially To Mr. Abdul Rehman bcos he worked a lot in java. I wrote the below code. This is connectivity code. This code is working properly in jsp and in jdk this is creating one error that oracle.jdbc package does not exist. But in jsp this is working properly. And i want to compile this class in jdk bcos i want to make bean for connectivity code and not use this code in every page. Hope u will understand my point. Only i need to compile this code. IF some one can help. I will appreciate.
Thanks
 
//-----------------------------------------------------------------------------------------------
package SISBean;
import java.sql.*;
import javax.sql.*;
import oracle.jdbc.pool.*;
public class SISBean
{
Connection Con;
Statement st;
ResultSet   rs;

public SISBean()
{
 try
 {
 
  
  DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
  Con = DriverManager.getConnection("jdbc:oracle:thin:@NAVEED:1521:oracle1", "student", "mba#1");
  st=Con.createStatement();
 }catch(Exception e){}
}
// *********
public ResultSet exQuery(String query)
{
  try{
     rs=st.executeQuery(query);
     }catch(Exception e)
       {System.out.println("Error executing query "+e);}
  return rs;
}
// ***********
public int exUpdateQuery(String query)
{
  int x=0;
  try{
    x=st.executeUpdate(query);
     }catch(Exception e)
     {System.out.println("Error executing update query "+e);}
  return x;
}
//************
public void closeAll()
{
  try{
    st.close();
    Con.close();
     }catch(Exception e)
     {System.out.println("Error In Statement Or Connection Closing "+e);}
}
 

//**************
}

//--------------------------------------------------------------------------------------------------------------------------
Previous Topic: query about learning java
Next Topic: Database migration from Sql Server to Oracle(urgent)
Goto Forum:
  


Current Time: Fri Apr 26 14:59:53 CDT 2024