Helpful Information
 
 
Category: DB2 Development
i want to connect to remote DB2 database server

hi all
i have this servlet code and it work well but i need to connect to Remote DB2 DataBase server i need to know how and how i can get the port number for DataBase server thank you
try
{
//db driver
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");

try
{
//create connection that connect to DB2 DataBase and emp DB
dbconn = DriverManager.getConnection("jdbc:db2:emp","db2admin","db2admin");
//create statement
st=dbconn.createStatement();
sql = "select * from login where name='" + request.getParameter("name") + "' and pass='" +request.getParameter("pass")+"'";
//get DB results
results = st.executeQuery(sql);
//check if there is user name or not
while(results.next())
{

if (! results.next())
{
HttpSession session=request.getSession(true);
String sql1 = "select fname,lname from login where name='" + request.getParameter("name") +"'";
res = st.executeQuery(sql1);
res.next();
session.putValue("userName","<b>"+res.getString("fName").toUpperCase()+" "+res.getString("lName").toUpperCase()+"</b>");

ask your sysadmin or people for whom you are developing it.










privacy (GDPR)