PRoblem when i am trying to authinticate to AD us gss

I am trying to access active directory using JAAS nut when i run my code a get the attached message
D:\JDeveloper10G\jdk\bin>java jasldap
GSSException: No valid credentials provided (Mechanism level: Failed to find any
Kerberos Ticket)
at sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredent
ial.java:133)
at sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Krb5MechF
actory.java:72)
at sun.security.jgss.GSSManagerImpl.getCredentialElement(GSSManagerImpl.
java:149)
at sun.security.jgss.GSSCredentialImpl.add(GSSCredentialImpl.java:389)
at sun.security.jgss.GSSCredentialImpl.<init>(GSSCredentialImpl.java:60)
at sun.security.jgss.GSSCredentialImpl.<init>(GSSCredentialImpl.java:37)
at sun.security.jgss.GSSManagerImpl.createCredential(GSSManagerImpl.java
:96)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:1
78)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:1
58)
at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5
Client.java:155)
at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:105)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2637)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:283)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.ja
va:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.jav
a:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
67)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.jav
a:82)
at searchLDAP.performSearch(searchLDAP.java:93)
at searchLDAP.run(searchLDAP.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:337)
at actions.search(actions.java:11)
at jasldap.samaccountname(jasldap.java:14)
at jasldap.<init>(jasldap.java:6)
at jasldap.main(jasldap.java:22)
javax.naming.AuthenticationException: GSSAPI [Root exception is javax.security.s
asl.SaslException: GSS initiate failed [Caused by GSSException: No valid credent
ials provided]]
can anyone help me here
and my code is here
import java.io.*;
public class jasldap
public jasldap()
samaccountname();
public void samaccountname(){
          actions pSA = new actions();
          pSA.search("f3482","sAMAccountName");
          if (searchLDAP.modException != null){
               System.out.print(searchLDAP.modException);
public static void main (String[] args)
jasldap ld=new jasldap();
the seconed class is
import javax.security.auth.Subject;
public class actions {
     KerberosaAuth pKA = new KerberosaAuth();
     public String search(String sUserName, String sFilter){
          pKA.KerberosAuth();          
          String sTRDN = sUserName;
          String sResults = new String();
          sResults = (Subject.doAs(pKA.lc.getSubject(), new searchLDAP(sTRDN, sFilter)).toString());
          return sResults;
import java.util.Hashtable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
class searchLDAP implements java.security.PrivilegedAction {
     private static Matcher mGMatch;
     private static Pattern pGPattern;
     private static String sGDesc = new String();
     private static String sRegex = ",DC=fgb,DC=ae";
     private static String sGRegex = ",OU=Domain Groups";
     private static String ssGRegex = "CN=";
     private static String sReplace = "";
     public String sTRUN = new String();
     public String sFilter = new String();
     public static String sName = new String();
     private static final long serialVersionUID = 1-1;
     public static String sResults = new String();
     public static String ssResults = new String();
     public static String sUserAttrib = "";
     public static String modException;
     public String sTRDN = new String();
     public String sErrorResult = new String();
     public static String[] sAttrIDs;
     public static String sSAMField = new String();
     public static String sNameField = new String();
     public static String sDepartmentField = new String();
     public static String sMailField = new String();
     public static String sIsAccountLockedField = new String();
     public static String sEmployeeIDField = new String();
     public searchLDAP(String ssTRDN, String ssFilter) {
          sTRDN = ssTRDN;
          sFilter = ssFilter;
     public Object run() {
          performSearch(sTRDN,sFilter);
          return sResults;
     private void performSearch(String sTRDN, String sFilter) {
          /* Specify the ids of the attributes to return */
          sAttrIDs = new String[6];
          sAttrIDs [ 0 ] = "sAMAccountName";
          sAttrIDs [ 1 ] = "department";
          sAttrIDs [ 2 ] = "mail";
          sAttrIDs [ 3 ] = "employeeID" ;
          sAttrIDs [ 4 ] = "displayName";
          sAttrIDs [ 5 ] = "IsAccountLocked";
          String[] sGAttrIDs = {"description"};
          String[] ssGAttrIDs = new String [ 3 ];
                              ssGAttrIDs [ 0 ] = "memberOf";
                              ssGAttrIDs [ 1 ] = "userAccountControl";
                              ssGAttrIDs [ 2 ] = "sAMAccountName";
          Hashtable env = new Hashtable(11);
               env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
               env.put(Context.PROVIDER_URL,"ldap://hoadc0.fgb.ae:389/DC=fgb,DC=ae");
               env.put(Context.SECURITY_AUTHENTICATION, "GSSAPI");
               env.put("javax.security.sasl.server.authentication", "true");
          String filter = "(&("+ sFilter+"=" + sTRDN + ")(!(objectclass=computer)))";
          modException = null;
          SearchControls constraints = new SearchControls();
                    constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
                    //constraints.setReturningAttributes(sAttrIDs);
                    constraints.setTimeLimit( 6000 );
                    constraints.setDerefLinkFlag( false );
                    constraints.setReturningObjFlag( false );
          try {
               /* Create initial context */
               sName = null;
               ssResults = null;
               modException = null;
               DirContext ctx = new InitialDirContext(env);
               NamingEnumeration answer = ctx.search ("OU=Departments", filter , constraints );
                    while (answer != null && answer.hasMore()) {
                         /* return the partially qualified name CN="", OU="" */
                         SearchResult nextEntry = ( SearchResult )answer.next();
                         sName = (nextEntry.getName());
                         ssResults = sName;
                         Attributes aAnswer = ctx.getAttributes(sName + ",OU=Departments",sAttrIDs);
                         if (sTRDN.contains("*")){
                         }else{
                              int numLabels = sAttrIDs.length;
                              for (int i = 0; i < numLabels; i++) {
                                   if ((aAnswer.get(sAttrIDs)) != null) {
                                        sAttrIDs[i]=(aAnswer.get(sAttrIDs[i]).get().toString());
                              if (sAttrIDs[3].contains("employeeID")){
                                   sAttrIDs[3]="";
                              if (sAttrIDs[5].contains("IsAccountLocked")){
                                   sAttrIDs[5]="";
               try {
               Attributes aGAnswer = ctx.getAttributes(sName + ",OU=Departments",ssGAttrIDs);
                    if (aGAnswer.toString().contains("514")){
                         sResults = ((aAnswer.get("sAMAccountName").get()) + " , " + "*******ACCOUNT IS LOCKED*******");
                         System.out.println(sResults + '\n');
                         if (sTRDN.contains("*")){
                         }else{
                              sAttrIDs[5] = "ACCOUNT IS LOCKED";
                    }else{
                         sResults = (sName);
                    Attribute amemberOf = aGAnswer.get("memberOf");
                    if (amemberOf != null){
                                        /* print each value */
                              NamingEnumeration eGroup = amemberOf.getAll();
                              while (eGroup.hasMore()) {
                                   sGDesc = (eGroup.nextElement().toString());
                                   pGPattern = Pattern.compile(sGRegex);
                                   mGMatch = pGPattern.matcher(sGDesc);
                                   while(mGMatch.find()) {
                                        pGPattern = Pattern.compile(sRegex);
                                        mGMatch = pGPattern.matcher(sGDesc);
                                        sGDesc = mGMatch.replaceAll(sReplace);
                                        Attributes aGroup = ctx.getAttributes(sGDesc, sGAttrIDs);
                                        /* "sDesc" is the description of the group */
                                        String sDesc = (aGroup.get("description").get().toString());
                                        /* The following replaces the distinguished name "SGDesc" with the cn for display*/
                                        pGPattern = Pattern.compile(ssGRegex);
                                        mGMatch = pGPattern.matcher(sGDesc);
                                        sGDesc = mGMatch.replaceAll(sReplace);
                                        pGPattern = Pattern.compile(sGRegex);
                                        mGMatch = pGPattern.matcher(sGDesc);
                                        sGDesc = mGMatch.replaceAll(sReplace);
                                        System.out.println(sGDesc +": "+ " (" + sDesc + " )");
               } catch (NamingException le) {
                    modException = (le.toString());
                    sErrorResult = modException;
                         System.out.println(sName + ": "+'\n'+ "Authorization Groups: ");
                         if (sTRDN.contains("*")){
                              NamingEnumeration enumUserInfo = aAnswer.getAll();
                                   while(enumUserInfo.hasMoreElements()) {
                                        sResults = (enumUserInfo.nextElement().toString());
                                        System.out.println(sResults);
          } catch (NamingException e)
          {/* open catch */
               modException = (e.toString());
               sErrorResult = modException;
          }/* close catch */
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import com.sun.security.auth.callback.TextCallbackHandler;
public class KerberosaAuth {
     *Kerberos Authentication
     LoginContext lc = null;
               public void KerberosAuth() {
                    java.util.Properties p =
                         new java.util.Properties(System.getProperties());
                    p.setProperty("java.security.krb5.realm", "fgb.ae");
                    p.setProperty("java.security.krb5.kdc", "hoadc0.fgb.ae");
                    p.setProperty("java.security.auth.login.config", (getClass().getResource("Jaas.conf")).toString());
                    System.setProperties(p);
                    try {
                         lc =
                              new LoginContext("GssConf",     new TextCallbackHandler());
                         // Attempt authentication
                         lc.login();
                    } catch (LoginException le) {
                         System.err.println("Authentication attempt failed: " + le);
                         System.exit(-1);
My domain name is fgb.ae and Acive directory Domain Controloer is hoadc0
Please help me here

If you are using Windows 2000 SP4, you will need to
add
registry key "allowtgtsessionkey" to enable Kerberos
session key.
For details refer to following docs:
http://java.sun.com/j2se/1.5.0/docs/guide/security/jgs
s/tutorials/Troubleshooting.html
Look for "KDC has no support for encryption type"
Solution 2.
SeemaCan you confirm this works with Windows Server 2000?
Are there any full working examples of this?
There's another related thread here: http://forum.java.sun.com/thread.jspa?messageID=9554063
Message was edited by:
connorsadler

Similar Messages

  • The "unknown error" problem when I am trying to sign in to the apple store on my Iphone 5

    "unknown error" problem when I am trying to sign in to the apple store on my Iphone 5, which was recently replaced with new one by the warranty (maybe this is the reason). However, it signed in on this device at first, but now it is not... What should I do?

    Mobile Me was withdrawn well over a year ago. If you still see Mobile Me in your system preferences it is because you have an old operating system.
    iCloud has replaced mobile me, but you would need OS X 10.7.2 or better to use iCloud.

  • Problems when I have tried execute two consecutive selects

    Hi,
    I am trying to execute two consecutive selects, when the second sql has been executed, it response "Operation failure of ado2xfa. Imposible find the element in the colection that corresponds with the name" (I have translated the message).
    The error happens when I execute the second DB.open
    In the data conection I have selected "text" in the commandType with "select * from t1"
    First I tried to execute both sqls but, if I try to execute just the "select * from t2" in the first sql command I obtain the same error.
    In the data view I have just one db connection linked with table T1, do I need to create one db connection per table?
    For example if I want to connect with 6 different tables I will need 6 different DB connection objects.
    Somebody know what is the problem?
    Thanks
    Rubén
    var DB;
    var record;
    var i;
    DB = xfa.sourceSet.Oracle
    record = xfa.record.Oracle
    try {
    DB.close();
    } catch (e) {}
    DB.resolveNode("#command").query.select.value = 'Select * from T1';
    DB.open();
    DB.first();
    for (i=0;i <= record.nodes.length;i++)
    console.println(record.nodes.item(0).value);
    DB.next();
    DB.close();
    DB.resolveNode("#command").query.select.value = 'Select * from T2';
    DB.open(); <--------LINE THAT PRODUCE THE ERROR---------

    It's because the data connection has been set up to expect the fields returned from T1. When you query T2 different fields are returned and it doesn't know what to do with them so it throws an error. You would need to 2 data connections, 1 for T1 and 1 for T2.
    Chris
    Adobe Enterprise Developer Support

  • Problems when I am trying to run RMAN?

    Dear all,
    The following errors occurs when I typed "RMAN" in cmd:
    RMAN-00554: initialization of internal recovery manager package failed
    RMAN-03000: recovery manager compiler intiitalization failed
    RMAN-06000: could not open recovery manager library file D:\oracle\ora92\RDBMS\ADMIN\RECOVER.BSQ
    LFI-00108: Open expect the file [RECOVER][BSQ] to exist.
    Does anyone encounter this error?
    Please advice,
    Amy

    Hemant,
    I appreciate your quick response. I check the alert.log and found the followings:
    Beginning log switch checkpoint up to RBA [0x42.2.10], SCN: 0x0000.6b5bf4d0
    Thread 1 advanced to log sequence 66
    Current log# 1 seq# 66 mem# 0: /u01/oracle/uatdata/log01a.dbf
    Wed Feb 13 12:20:40 2008
    Completed checkpoint up to RBA [0x42.2.10], SCN: 0x0000.6b5bf4d0
    Wed Feb 13 12:39:15 2008
    Beginning log switch checkpoint up to RBA [0x43.2.10], SCN: 0x0000.6b5c45ac
    Thread 1 advanced to log sequence 67
    Current log# 2 seq# 67 mem# 0: /u01/oracle/uatdata/log02a.dbf
    Wed Feb 13 12:59:16 2008
    Completed checkpoint up to RBA [0x43.2.10], SCN: 0x0000.6b5c45ac
    Wed Feb 13 13:28:32 2008
    Beginning log switch checkpoint up to RBA [0x44.2.10], SCN: 0x0000.6b5ca841
    Thread 1 advanced to log sequence 68
    Current log# 3 seq# 68 mem# 0: /u01/oracle/uatdata/log03a.dbf
    Wed Feb 13 13:49:06 2008
    Completed checkpoint up to RBA [0x44.2.10], SCN: 0x0000.6b5ca841
    Wed Feb 13 14:17:46 2008
    ORACLE Instance UAT - Can not allocate log, archival required
    Wed Feb 13 14:17:46 2008
    ARCH: Connecting to console port...
    Thread 1 cannot allocate new log, sequence 69
    All online logs needed archiving
    Current log# 3 seq# 68 mem# 0: /u01/oracle/uatdata/log03a.dbf
    I think something problem with redo log file but cannot identify what is it. Do you have any ideas?
    Thanks,
    Amy

  • Hi, I have problem when i am trying to listen e-radio from firefox. When I press "listen live" a new window opens but it seems tha media player is missing. How do I solve this?

    The site i refer to is e-radio.gr if you want to try...

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem.
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    It is hard to tell which plugin is needed to play that webcast. You appear to have Flash and WMP and Silverlight. Other popular but less used plugins are RealPlayer and QuickTime.
    See:
    * [[Popular plugins]]
    * http://kb.mozillazine.org/Testing_plugins
    You can check the page source to see which MIME type is specified for that content or post a link if that web page can be accessed publicly without authorization.

  • Having problems when SAP is trying to login into system

    Hi SAP is getting a message saying that route permission denied (hostIP1 to hostIP2,32XX).
    Could anyone please advise?Thanks in advance.

    issue resolved.

  • Problems when trying to do a clean OS X install

    I have some problems when I'm trying to do a clean install of my 15" MBP. I'm using the Install DVD that came with the computer, but it seems like it won't read it. I find it very weird since it has no problems with reading audio CD's, and even the Snow Leopard upgrade DVD works just fine. But when I'm holding down the option key as the computer boots up, the Install DVD is not listed as a bootable device, and if I do nothing at the boot up I can hear the drive spinning and then stopping, and it happens continuously until I restart the computer and force ejects the DVD.
    Can anybody tell me if I'm doing something wrong or my MBP has a malfunction?
    Thanks in advance!
    //Raun

    KXsig wrote:
    hold C after Power button and let it go for "as long as it takes" - by "as long as it takes" I mean till absurds 5~10 minutes or so. The slow reading in boot DVD's/CD's is usual, here I performed more then 5 installations using the same DVD and in more then one occasion this symptom was presented. Be patient.
    I agree with KXsig that the boot off the installation DVD is abnormally long, each and every time. I find sometimes it can take upwards of 3 minutes to go from the Apple logo to the language selection screen. However, the machine should acknowledge the disc and begin booting to it (Apple logo with spinning gear) within a few seconds. If it's getting hung up on a solid gray screen or if you're at the EFI boot drive selection menu it should acknowledge the disc almost immediately.
    If all other media is fine, then I suspect the issue would be with the disc versus the optical drive.

  • Problem when trying to start Weblogic server

    Hi,
    I have a problem when in was trying to start the weblogic server from the
    Weblogic Console.It Loads all the necessary files and finally it comes out
    giving an error "Server start message not received in allotted time, server
    process killed.".
    But at the same time i can start the server cooly by running the
    "Wlserver.exe".Can any help me on this problem
    regards
    Ramesh
    Baan Company

    Hi!
    I'm quite sure that this is a time out problem. I need about 3 minutes to start
    up my weblogic server. It's no problem to start it from a command prompt
    (startWeblogic.cmd), but using weblogic console application I always got a time
    out after 120 seconds. On a faster computer, where the start up process can be
    finished in less then 120 seconds it was no problem to start the server with the
    same amount of EJBs.
    Does anyone know how to increase the time out parameter for the weblogic console
    application?
    Best reagards,
    Przemek
    Ramesh wrote:
    Yes Its resource problem i suppose..
    My friend who is working with WL advised me to us 128 MB RAM to work with
    Weblogic server.
    Justin i need one more help
    I registered my servlet in Weblogic.properties.But when i try to load
    it from the command tab says "Property change error on LOAD".I dont know
    what
    properties i have to change to load this.
    Even the existing example servlets i coundnt Load.!!!!
    Can any one help on this problem
    Justin Knowlden <[email protected]> wrote in message
    news:[email protected]...
    I actually got WL to work on my system yesterday. I found that it was aresource
    problem. I had to shut down my X Server; if you don't know what the XServer is,
    it's (basically) the app that runs a window manager. It was consuming toomuch
    of my processing time. WL is now the only thing running on that machine.
    Since you have NT, You may want to try shutting down all uneccesarydevices and
    app's.
    Ramesh wrote:
    My System is
    Win NT 4.00
    Pentium pro 199 mhz
    and 80 mb RAM
    Is that because of the Memory Problem?
    I dont know because i am able run it well when it trought command
    prompt.
    Justin Knowlden <[email protected]> wrote in message
    news:[email protected]...
    I posted a comment about this last week and have to receive a reply. Ialso saw
    a post from April about this and there were no replies to it, either.
    My problem exists on Linux whether I use the console or not. What are
    the
    specs
    for your machine?
    Mine:
    Linux 2.2.15
    P/Pro 199 MHx
    128 MB RAM
    Ramesh wrote:
    Hi,
    I have a problem when in was trying to start the weblogic server
    from
    the
    Weblogic Console.It Loads all the necessary files and finally it
    comes
    out
    giving an error "Server start message not received in allotted time,server
    process killed.".
    But at the same time i can start the server cooly by running the
    "Wlserver.exe".Can any help me on this problem
    regards
    Ramesh
    Baan Company--
    Justin Knowlden <[email protected]>
    Software Developer
    MyPoints.com, Inc.
    Justin Knowlden <[email protected]>
    Software Developer
    MyPoints.com, Inc.
    Przemyslaw Rychlewski Tech@Spree Software Technology GmbH
    mailto:[email protected] http://www.tech.spree.de
    Tel +49 (0)30 235 520-34 Bülowstrasse 66
    Fax +49 (0)30 217 520-12 10783 Berlin

  • Problem when trying the Stored Procedures in JDBC receiver side

    Hi,
    I am facing some problem when i am trying to configure a scenario in the receiver side of JDBC adpater.
    We have never got stored procedures to work as messages go in 'Delivering'   status always. It's as if control never gets back to the adapter engine after the stored procedure call is made by the JDBC adapter. Then I went to checkt in the IE where the message has successfuly sent. Then I went to check
    in AE where the message is in "Delivering" state for long time.
    So checked the Default trace File and Thread dumps.
    In Thread dumps, i found a strange thing like one thread is hanging on condition wait at the below location :
      at java/lang/StringCoding.getEncoder(StringCoding.java:331(Compiled Code))
      at java/lang/StringCoding.encode(StringCoding.java:472(Compiled Code))
      at java/lang/String.getBytes(String.java:651(Compiled Code))
      at com/sap/aii/adapter/jdbc/SAXHandler.constructResponseStream(xml2sql.java:841(Compiled Code))
      at com/sap/aii/adapter/jdbc/SAXHandler.SQLcallStmt(xml2sql.java:988)
    Can you please help me in solving this issue as it is very critical to me ?
    Thanks,
    Prakash.

    Dear Prakash,
       There are number of reasons for SAX error. May be structure is not well defined, statement is not written correctly. These following links help you to solve your issue.
         SQL Queries(JDBC sendor CC)
         Oracle DB - XI - SQL DB
         JDBC Scenerio.
    Regards,
    JP.

  • I have a problem when i use fetch LAZY

    Hi All
    i have faced a problem when i have tried FETCH LAZY instead of FETCH EAGER
    The problem is the table generator return null instead of valid primary key value
    I dont get what is the problem every thing is ok With the FETCH EAGER
    please help me in this problem either by give me a directions to solve this problem or give me an example about FETCH LAZY
    Hassan Kbbewar.

    i need a complete example of ejb with fetch lazy relationship ...

  • When I'm trying to buy any thong there is massage says "Please contact itunes support to complete this transaction

    Shortly my problem when I'm trying to buy any thong there is massage says "Please contact itunes support to complete this transaction????????"

    Hi ..
    Use the email form here > Apple - Support - iTunes Store - Contact Us

  • When i am trying to download a free apps it ask me about payment info

    pls let me know why my new i phone 4s making me problem when i am trying to download free apps like facebook skype so pls solve the problem on urgent basis

    http://support.apple.com/kb/HT2534

  • Problem when communicating with postgres

    Hi everyone,
    i have got a problem when i am trying to communicate with postgres.
    i am calling a bean in which i have methods for insertion. for ur convinience i here provide the class.
    package Harish;
    import java.sql.*;
    import java.util.*;
    import java.lang.*;
    public class Exception_IP_List
         Connection con;
         Statement st;
         //Constructor
         public void Exception_IP_List()
         //Getting the Connection with the database
         public Connection getConnection()
              try {
                   Class.forName("org.postgresql.Driver");
                   con = DriverManager.getConnection("jdbc:postgresql://localhost/CF","postgres"," ");
                   System.out.println("Connection Created");
                   st = con.createStatement();
                   System.out.println("Statement Created");
              }catch(Exception e){
                   e.printStackTrace();
              }finally{
                   return con;
         } //end of getting connection with database
         //Inserting the exception IP details into the database
         public int insertExceptionIPList(String ipAddress)
    int insert = 0;
              try {
                   getConnection();
                   String sql = "INSERT INTO exception_ip_list (ip_Address)"
                                            + " VALUES (?)";
                   PreparedStatement pstmt = con.prepareStatement(sql);
                   pstmt.setString(1, ipAddress);
                   insert = pstmt.executeUpdate();
                   System.out.println("Insert " +insert);
                   /*if there is any insertion in this table the table
                        Update will be updated as well
                   if(insert > 0)
                        String sql1 = "update Update set Status='yes' where code='100' ";
                        Statement st1 = con.createStatement();
                        st1.executeUpdate(sql1);
              } catch(Exception e){
                   System.out.println(e);
              }finally{
                   return insert;
         }//end of inserting class
              //Closing Connection to Database
         public void closeConnection()
              try{
                   con.close();
                   System.out.println("Connection closed");
              }catch(Exception e){
                   e.printStackTrace();
         //Main Method for Exception_ip_list Class
         public static void main(String args[])
              Exception_IP_List exiplist = new Exception_IP_List();     
              //exiplist.getConnection();
              //exiplist.insertExceptionIPList("192.168.1.150");
              //System.out.println("data successfully inserteD");
              //exiplist.deleteExceptionIPList("191.11.22.33");
              //System.out.println("Item Deleted");
              //exiplist.getExceptionIPList();
              //exiplist.closeConnection();
    following is the jsp files to access the method insertExceptionIPList
    <%@ page language="java"%>
    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <form name="exiplist" method="post" action="test1.jsp">
         <input type="text" name="ip"><br>
         <input type="submit" name="SUBMIT" value="SUBMIT">
    </form>
    </body>
    </html>
    <%@ page language="java" import="java.sql.*, Harish.*" %>
    <jsp:useBean id="exiplist" scope="page" class="Harish.Exception_IP_List" />
    <%=request.getParameter("ip")%><br>
    Inserted: <% int i = exiplist.insertExceptionIPList(request.getParameter("ip")) %>
    i am really confused, what is the mistake i made? .
    please help and its urgent. thanks
    harish.

    Hello Harish,
    I was introduced to databases at university with postgres. I now use SQL Server 7.
    Anyway, what is the problem exactly - which exceptions are being thrown?
    I have to admit, these forums don't present code very well and it makes it more confusing to read.
    What are you inserting into your database - what is the context of your application ?
    I did notice your constructor will be treated like a method. It does not matter in this case as it doesnt do anything, but you can't have void or any return type in your constructor - it has implicit instructions to return an instance of this class when it is called. If it is empty, omit it altogether.
    I understand you getConnection() method.
    I've never used the prepared statement:
    String sql = "INSERT INTO exception_ip_list (ip_Address)" + " VALUES (?)";
    PreparedStatement pstmt = con.prepareStatement(sql);
    pstmt.setString(1, ipAddress);I assume the '?' in the sql string gets replaced with 'ipAddress' parameter variable? Are you sure 1 is the correct number - I know sql counts from 1 but java counts from 0.
    You have created statement st and haven't used it, but later created st1 ?
    For your JSP's, try
    test0.jsp
    <%@ page language="java"%> <!-- this is not needed -->
    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <form name="exiplist" method="post" action="test1.jsp">
    <input type="text" name="ip"><br>
    <input type="submit" name="SUBMIT" value="SUBMIT">
    </form>
    </body>
    </html>
    test1.jsp
    <%@ page language="java" import="java.sql.*, Harish.*" %> <!-- this is not needed -->
    <jsp:useBean id="exiplist" scope="page" class="Harish.Exception_IP_List" />
    <html>
    <body>
    <%=request.getParameter("ip")%><br>
    Inserted: <% int i = exiplist.insertExceptionIPList(request.getParameter("ip")); out.print(i); %>
    </body>
    </html>
    Please let me know how this works,
    Darren B

  • Problem when trying to refresh oracle screens with latest data

    hello experts,
    i have one problem,i want to refresh the oracle screen with the latest data from the data
    base.
    It is a two stage process.At first step one user will select a row from the screen and then he will press a button .
    now the second screen will appear and the detail of the employee will be displayed.
    First step has been completed and the data is coming in the second form via parameters and i can see the full information of the employee.
    Now i want to refresh the oracle form i.e. suppose if my dba has made any changes in the oracle table( EMP table) i want that after pressing the refresh button user can see the
    latest data from the database.
    in WHEN_BUTTON_PRESSED trigger i have written this codes.
    enter_query;
    execute_query;
    but they are not giving the expected result.
    And one more thing please suggest whether in the second form i should use database item
    or non database item.
    When i am using database item when i am trying to close second from one pop up is appearing
    and asking that whether i want to save the changes.
    please suggest how can i remove this message from my application.
    Regards
    Anutosh

    Hi,
    what data did you transfer via parameters to the second form ?
    how did you populate the datablock in the second form ?
    Typical solution would be:
    (For my example the block is both forms is named EMP, and is based on the table SCOTT.EMP)
    In Form 1, transfer the primary key-value of the current record to a global or parameter (will use global in my example):
    e.g. you have a WHEN-BUTTON-PRESSED-Trigger with the following code:
    <pre>
    :GLOBAL.EMPNO:=:EMP.EMPNO;
    CALL_FORM('FORM2');
    </pre>
    In Form 2, you have a WHEN-NEW-FORM-INSTANCE-Trigger with code:
    <pre>
    DEFAULT_VALUE('GLOBAL.EMPNO', NULL);
    IF :GLOBAL.EMPNO IS NOT NULL THEN
    GO_BLOCK('EMP');
    EXECUTE_QUERY;
    :GLOBAL.EMPNO:=NULL;
    END IF;
    </pre>
    On block EMP in Form 2 there is a PRE-QUERY-Trigger with following code:
    <pre>
    IF :GLOBAL.EMPNO IS NOT NULL THEN
    :EMP.EMPNO:=:GLOBAL.EMPNO;
    END IF;
    </pre>
    And at last, in your refresh-button would be the following code:
    <pre>
    :GLOBAL.EMPNO:=:EMP.EMPNO;
    GO_BLOCK('EMP');
    EXECUTE_QUERY;
    :GLOBAL.EMPNO:=NULL;
    </pre>
    Hope this helps

  • I got problem when trying to contact my iphone 4 using facetime,it did ringing,but my iphone 4 did not receive that call as if nothing happen.But,when the call ended,that call appeared in the missed call list.fyi both are connected to internet.

    i got problem when trying to call my iphone 4 using facetime with my Macbook Pro 13',it did ringing,but my iphone 4 did not receive that call as if nothing happen.But,when the call ended,that call appeared in the missed call list.fyi both are connected to internet.Help!! thank you in advance

    i got problem when trying to call my iphone 4 using facetime with my Macbook Pro 13',it did ringing,but my iphone 4 did not receive that call as if nothing happen.But,when the call ended,that call appeared in the missed call list.fyi both are connected to internet.Help!! thank you in advance

Maybe you are looking for

  • CISCO ISE 1.2.0.899 - Self registration email address field Limit

    Hi I was wondering if someone out there can resolve an issue I am seeing, when a user goes to the self registration portal and enters an email address it only allows 24 characters to be entered, in the documentation it states that up to 48 characters

  • XML parser performance

    Hello, I was wondering if anybody had any experience in regards to the relative performance (i.e., speed) of the different Java XML parsers out there. Specifically, javax.xml.parsers.DocumentBuilder.parse() vs. any others. My goal is to reduce the am

  • How to setup hotmail account in Apple Mail?

    Just got a new 17" MBP... however I'm not sure how to setup my hotmail account in Apple Mail.

  • Hi how to restrict * in seelction screen

    Hi abapers, In selection screen am having field s_matnr. After giving input as * and pressing F4 its fetches all the materials.But i want to restrcit using * and then pressing F4. How can i do it.

  • No option in contextual menu to encode video/audio in OSX Lion 10.7.1

    Hey Apple Support, As the title says, there is no option in my install of OS X Lion to encode video or audio by right clicking. I've included a screen shot to show you what I see when I try to convert, I've tried various formats like .mov, .avi, .mpg