GetConnection(String URL) vs. (String URL, String user, String password)

Hi,
would have a question referring to the documention at http://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/jdbc/OracleDriver.html where the forms of getConnection are described.
I would like to convert from using a signature that takes the URL, user name, and password as separate parameters to using a signature that takes the URL, user name, and password all as part of a URL parameter.
While I was able to successfully connect to my database using the form getConnection(String URL, String, user, String password); I am not able to achieve the same when using getConnection(String URL).
Here are the code snippets, maybe someone can point out the reason why the second approach is not working?
approach 1 - working fine
String driver = "oracle.jdbc.driver.OracleDriver";
try {
          Class.forName(driver);
          } catch(java.lang.ClassNotFoundException e) {
          String connectionURL = "jdbc:oracle:thin:@localhost:1521:PMT";
          String pgUser = "\"James.Smith@000\"";
          String pgPwd = "\"js\"";
     try {
               Connection conn = DriverManager.getConnection(connectionURL, pgUser, pgPwd);
approach 2 - error: java.sql.SQLException: The Network Adapter could not establish the connection
String driver = "oracle.jdbc.driver.OracleDriver";
try {
          Class.forName(driver);
          } catch(java.lang.ClassNotFoundException e) {
String connectionURL = "jdbc:oracle:thin:\"James.Smith@000\"/\"js\"@localhost:1521:PMT";
     try {
               Connection conn = DriverManager.getConnection(connectionURL);
Thanks a lot in advance
Kind regards
Thomas

Let me get this clear.
You want a login dialog.
Some program calls the dialog and waits untile user respond
once the user press ok or cancel it reutrn the users input to the caller.
You can do this directly using JFrame
but you can do it wil JDialog if you use it as aModal dialog.
it will look like this
class LogInDialog  extends JDialog implements ActionListener{
   String value;
   public LogInDialog(){
      setModel(true);
    // This is what you invoke
    public String loadDialog(){
        setVisible(true);
        return value;
    public void actionListener(..... e){
        if (e.getSource() == bCancel)
           value = null;
        else if (e.getSource() == bOk)
           value = //generate the string
        dispose();
}

Similar Messages

  • Linking to an OBIEE report without showing the user and password

    Hi!
    we are trying to access to an obiee report from an external portal (coded with php).
    The idea is that the user clicks on a link an gets the report in pdf format. For that purpose we are using this url:
    http://ttivobiee01:7001/analytics/saw.dll?Go&Path=/shared/Prueba/ogp_obi&Action=Print&P0=1&P1=eq&P2="Criteria"."Key"&P3=1402&NQuser=user&NQPassword=pass&format=pdf
    But this url is expossing OBIEE's user and password.
    In order to avoid this security issue we tried to do an wget of the url but it doesn't return the report. Instead we get an html, which seams to download the report chunk by chunk (using javaScript).
    The question is, is there any way that we could let our portal ussers access to an obbie report without expossing the user and password?
    I have been looking into oracle forums and have found this: OBIEE Go URL with password protected
    but we couldn't use this aproach due to security issues.
    Thanks!
    Nuria

    Hi!
    We have finally done this (and it works!)
    <?php
    $urlInforme='http://obi:7001/analytics/saw.dll?Go&Path=/shared/Prueba/ogp_obi&Action=Print&P0=1&P1=eq&P2="Criterios"."Clave oficial"&P3=1402&NQuser=user&NQPassword=pass&format=pdf';
    $ch = curl_init($urlInforme);
    $ckfile = tempnam ("./", "CURLCOOKIE");
    $ch = curl_init ($urlInforme);
    curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec ($ch);
    $ch = curl_init ($urlInforme);
    curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
    $fp = fopen("salida.pdf", "w");
    curl_setopt($ch, CURLOPT_FILE, $fp);
    $output = curl_exec ($ch);
    curl_close($ch);
    fclose($fp);

  • How to retrieve query string value from the URL in my portlet

    Hi,
    When user clicks on "Advance Search", i am redirecting to page in the community. At the same i am adding some more values to the query string (to the URL).
    My URL will look like this.
    http://ctp-mc0149/portal/server.pt?space=CommunityPage&parentname=CommunityPage&parentid=0&in_hi_userid=200&cached=true&control=SetCommunity&PageID=202&CommunityID=200&searchType=2
    Now in one of my portlet in that page, i want to retrieve the query string values from the URL.
    Please help me regarding this.
    Thanks in advance.
    Thanks,
    sreekanth.

    Hi,
    Look at the following threads,
    For programmatically getting the iview properties,
    Programmatically getting iView Properties
    Also,
    Get Properties of IView Programmatically
    Permanent change of iView property programmatically
    Hope these threads help u.
    Regards
    Srinivasan T

  • Publishing server doesn't work - error 'The request URL doesn't contain the query string for the client OS'

    Hi,
    I'm trying to setup an App-V environment in my lab.
    I've used the App-V 5.0 Trial guide to help me configure all necessary components.
    I'm able to install everything without error.
    when come time to publish an app, it simply doesn't show up on my client.
    after looking at events on the client and server, I found that the Publishing server is returning under Admin the following message.
    'The request URL doesn't contain the query string for the client OS'
    My setup is pretty simple.
    App-V Server managament and Publishing on the same box
    App-V database on my SQL server.
    I'm able to see the publishing "webpage" by using http:://localhost:889.
    It only display this :
    -<Publishing Protocol="1.0"
    <Packages />
    </Publishing>
    I've published one app from the management console.
    any idea what could mean this error?
    thanks

    Hi,
    thanks for the link.
    I've validated the suggested debug steps. It seems that the problem is with my Publish server again.
    I've looked in the web.config file. It seems to be missing some parts compare to the example provided.
    Again, I've published an application from the management console. Management and Publishing are running on the same box, while SQL is remote.
    Here's the web.config
    <?xml version="1.0" ?>
    - <configuration>
    - <system.web>
    <compilation debug="false" targetFramework="4.0" />
    <machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" />
    - <authentication>
    - <!-- We don't support form authentication, but this will supress x-ray security warning
    -->
    <forms requireSSL="true" />
    </authentication>
    </system.web>
    - <system.webServer>
    - <modules runAllManagedModulesForAllRequests="true">
    <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
    - <security>
    - <requestFiltering>
    - <verbs>
    <remove verb="GET" />
    <add verb="GET" allowed="true" />
    </verbs>
    </requestFiltering>
    </security>
    </system.webServer>
    - <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    + <behaviors>
    - <serviceBehaviors>
    - <behavior name="">
    <serviceAuthorization impersonateCallerForAllOperations="true" />
    <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    - <bindings>
    - <webHttpBinding>
    - <binding name="SecureBinding">
    - <security mode="Transport">
    <transport clientCredentialType="Windows" />
    </security>
    </binding>
    <binding name="UnsecureBinding" />
    </webHttpBinding>
    </bindings>
    - <protocolMapping>
    <add scheme="http" binding="webHttpBinding" bindingConfiguration="UnsecureBinding" />
    <add scheme="https" binding="webHttpBinding" bindingConfiguration="SecureBinding" />
    </protocolMapping>
    - <standardEndpoints>
    - <webHttpEndpoint>
    - <!--
    Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
    via the attributes on the <standardEndpoint> element below
    -->
    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
    </webHttpEndpoint>
    </standardEndpoints>
    </system.serviceModel>
    </configuration>

  • No logical space left to create more user strings

    So, what I tried to do was to put over 700,000 strings into an array. That seems impossible according to this error.
    Error 1
    Unexpected error writing metadata to file -- 'No logical space left to create more user strings.'
    What do you recommend me to use for such a large number of string constants?
    I intend to search through them many times.
    Vlastimil Burian

    There is a limit on the number of strings you can define in an assembly but you could store the strings externally, for example in a file or in a database.
    Please refer to the following page for more information:
    http://stackoverflow.com/questions/1362635/c-sharp-compile-error-no-logical-space-left-to-create-more-user-strings
    Please remember to close your threads by marking all helpful posts as answer then start a new thread if you have a new question.

  • Setting up strings for user and passwords on iphone

    I frequently log into websites that require entering a user and password manually. Is there a way to create a string and then only have to enter one stroke or 2 instead of entering this every time?

    Log into whatever site you were wanting to do this for and it will ask if you wish the username/password remembered.
    Message was edited by: brendan002

  • How to change SSO user's password: Get LDAP URL

    Hi,
    I would like to add a 'change user SSO password' form to my BC4J application. The form's submit button fires an action that calls a PL/SQL package. This package receives 7 parameters, and uses de dbms_ldap package to change the user's password.
    Parameters:
    - LDAP Host
    - LDAP Port
    - User DN
    - SSO Username
    - Old Password
    - New Password
    - Retyped New Password (for confirmation)
    I'm trying with a DataForwardAction event whose purpose is to get the user's account information and the LDAP location, but I can't get the LDAP Location (ClassCastException) and the SSOUsername (NullPointerException).
    I'm using JDeveloper 10.1.2.0.0 (Build 1811)
    My question is: ¿What am I doing wrong? ¿Is there any easier way to do this?
    The code is below:
    import javax.servlet.http.HttpServletRequest;
    import oracle.adf.controller.struts.actions.DataActionContext;
    import oracle.adf.controller.struts.actions.DataForwardAction;
    import oracle.security.jazn.JAZNConfig;
    import oracle.security.jazn.spi.ldap.LDAPJAZNProvider;
    public class ChgPwdAction extends DataForwardAction
      public void onChange(DataActionContext ctx) throws Exception
        HttpServletRequest request = ctx.getHttpServletRequest();
        String host                = null;
        String port                = null;
        String userDN              = null;
        String SSOUsername         = null;
        String oldPwd              = null;
        String newPwd              = null;
        String confirmNewPwd       = null;
        try
          LDAPJAZNProvider ldapProvider = (LDAPJAZNProvider)JAZNConfig.getJAZNConfig().getJAZNProvider();
          host = ldapProvider.getJAZNConfig().getLocationURL().getHost();
          port = "" + ldapProvider.getJAZNConfig().getLocationURL().getPort();
        catch (ClassCastException e)
          //System.out.println(e);
          throw new Exception("Missing LDAP location");
        try
          userDN = request.getHeader("Osso-User-Dn");
        catch (NullPointerException e)
          //System.out.println(e);
          throw new Exception("Missing User DN.");
        SSOUsername   = request.getRemoteUser();
        oldPwd        = (String)request.getParameter("oldPwd");
        newPwd        = (String)request.getParameter("newPwd");
        confirmNewPwd = (String)request.getParameter("confirmNewPwd");
        request.setAttribute("Host", host);
        request.setAttribute("Port", port);
        request.setAttribute("UserDN", userDN);
        request.setAttribute("SSOUsername", SSOUsername);
        request.setAttribute("OldPwd", (String)ctx.getHttpServletRequest().getParameter("oldPwd"));
        request.setAttribute("NewPwd", (String)ctx.getHttpServletRequest().getParameter("newPwd"));
        request.setAttribute("ConfirmNewPwd", (String)ctx.getHttpServletRequest().getParameter("confirmNewPwd"));
        //System.out.println (userDN + "-" + SSOUsername);
      // To override a method of the lifecycle, go to
      // the main menu "Tools/Override Methods...".
    }Thanks in advance.

    Hi again,
    First of all, thanks for your reply.
    Yes, I know I can use JNDI instead of a call to a PL/SQL package (I visited this link: http://forum.java.sun.com/thread.jspa?threadID=592611&start=0 that explains how to do it), but in both cases I have the same problem: I don't know if it's possible to get the LDAP's environment specifications (PROVIDER_URL, SECURITY_PROTOCOL) dynamically.
    Our production environment's LDAP is not the same as our development environment's LDAP. This is why I want to get this information dynamically.
    I think that this information is stored in the jazn.xml file: Is there any way to get this information?
    Thanks a lot.

  • How do I copy the string portion of an enum into the string portion of a cluster?

    I want to do this for the an entire array of clusters.  I'm trying to use a for loop.  Can't figure out how to parse the string portion of the enum into the string portion of the cluster.
    Alternatively, I'd be happy if I could figure out some way to tie the enum to the array of clusters, but I figure that gets problematic.
    DH
    Solved!
    Go to Solution.

    Dark Hollow wrote:
    OK, let's say that the enumerated type has N elements.  I want to initialize an N element array of strings.  How do I reference each string in the enumerated type to get to each string?
    Easy way to do this is to use GetNumericInfo.vi, part of the Variant library, found in vi.lib\utility\VariantDataType\GetNumericInfo.vi.  Wire your enumeration to the Variant input; one of the outputs is an array of the strings in the enumerated type.
    The more complicated way is a for loop, in which you typecast the iterator terminal value to the enumerated type, then use Format Value.  You can get the maximum value of the enumeration by casting 0 to the enumerated type, then decrementing; cast that back to a numeric and add one to get the right value to wire to the N terminal.
    EDIT: just thought I'd add, since RavensFan's reply popped up while I was writing mine - I don't like the Strings[] approach because it doesn't work on RT targets, and I lost a lot of time once due to this trying to figure out why my code wouldn't run properly on an RT system but worked great on my development computer.

  • Part of a string contained in one element list's strings

    Hi evebody,
    I have process that use this sql request :
    SELECT $code
    FROM DUAL
    WHERE $code IN ('BMW','MERCEDES','TOYOTA','PEUGEOT');
    Actually, the code is a string which value is car brand. for example 'BMW'.
    I want to change my process and have the possibility to put in $code multiples car brand separated by '||' . For example, 'BMW||RENAULT'.
    In this way, howa could I change my sql request?
    ie I want to check if a part of string exists in a element list's string.
    PLEASE HELP ME
    THANKS

    One way is to use regular expressions:
    SQL> variable code varchar2(100);
    SQL> exec :code := 'TOYOTA';
    PL/SQL procedure successfully completed.
    SQL> SELECT  :code
      2    FROM  DUAL
      3    WHERE REGEXP_LIKE('||' || :code || '||','\|\|BMW\|\||\|\|MERCEDES\|\||\|\|TOYOTA\|\||\|\|PEUGEOT\|\|')
      4  /
    :CODE
    TOYOTA
    SQL> exec :code := 'BMW||RENAULT';
    PL/SQL procedure successfully completed.
    SQL> SELECT  :code
      2    FROM  DUAL
      3    WHERE REGEXP_LIKE('||' || :code || '||','\|\|BMW\|\||\|\|MERCEDES\|\||\|\|TOYOTA\|\||\|\|PEUGEOT\|\|')
      4  /
    :CODE
    BMW||RENAULT
    SQL> SY.

  • Server 2012 errors for timeout -- LDAP error number: 55 -- LDAP error string: Timeout Failed to get server error string from LDAP connection

    Hello, currently getting below error msg's utilizing software thru which LDAP is queried for discovering AD objects/path and resource enumeration and tracking.
    Have ensured firewalls and port (389 ) relational to LDAP are not closed, thus causing hanging.
    I see there was a write up on Svr 2003 ( https://support.microsoft.com/en-us/kb/315071 ) not sure if this is applicable, of if the "Ntdsutil.exe" arcitecture has changed much from Svr 03. Please advise. 
    -----------error msg  ----------------
    -- LDAP error number: 55
    -- LDAP error string: Timeout Failed to get server error string from LDAP connection

    The link you shared is still applicable. You can adjust your LDAP policy depending on your software requirements.
    I would also recommend that you in touch with your software vendor to get more details about the software requirements.
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • URL in sender SOAP channel with user and password

    Hi Expert,
    I have developed SOAP to proxy scenario.The serder WSDL is generated by using sender agreement. In the WSDL we are using default below URL.
    http://host:port/XISOAPAdapter/MessageServlet?channel=party:service:channel
    But the client requirement is that he want SAP user and password also in above url.
    Is this possible in sender SOAP channel?
    Any body can please help me for above issue?
    Thanks.
    Edited by: darshana-PI on Feb 1, 2012 5:26 PM

    Thanks prateek,
    we have used HTTP plain adapter for this and used below link to call that interface in PI. And its working.
    http://server:port/sap/xi/adapter_plain?service=<xxx>&namespace=<xxx>&interface=<xxx>&sap-user=<xxx>&sap-password=<xxx>&qos=BE
    I can understand the security related problem, but that was the requirement for end application.
    Thanks,
    Darshana.

  • Hi can anyone tell me how to make the forms url short to the end user

    Hi,
    Im using oracle forms 11gR2 and everything is working fine, but my question in how to make the forms url short to the end user.
    For example my forms url is  " http://localhost:9001/forms/frmservlet "  now i want to modify this url as   "myweb.gov.ae"
    can anybody suggest me the possibilities to change to default forms url to our own url as mentioned in the above example.
    Thanks & Regards,
    Hari

    You would have to either -
    * edit the code pointed to by the new action attribute to
    include the form
    processing and email generation, or
    * edit the form processing script to also include the insert
    record and
    check user name scripting
    The former is probably the better procedure, since I suppose
    you'd want to
    do the check user name before sending the email.
    Unfortunately, this means
    you will have to get your hands into the code, or hire
    someone to do it for
    you.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "ducati1" <[email protected]> wrote in
    message
    news:gkriis$et6$[email protected]..
    > Hi guys.
    > I have a page with a form on it here.
    >
    http://www.thechallenge.net.au/superredemption.php
    > I want the data placed in the textfields within the form
    to come to me in
    > an
    > email upon submission.
    > Now normally I would action the form to use this page
    here
    >
    http://www.thechallenge.net.au/Redemptionform.txt
    > But because the action of the form is now <?php echo
    $editFormAction; ?>
    > due
    > to an insert record and check user name server behavior
    I cannot use my
    > normal
    > method.
    > Can anyone tell me how I can get around this problem?
    >

  • I want to take a series of hex characters in a string control and produce an HDLC string indicator for example if the data string control is 3F27 then the HDLC string indicator is 7E003F2700B57E

    I want to take a series of hex characters in a string control and produce an HDLC string indicator for example if the data string control is 3F27 then the HDLC string indicator is 7E003F2700B57E

    "thanks for your help "
    Does that mean you figured it out already?
    If not, see this thread for some HDLC related code.
    http://forums.ni.com/ni/board/message?board.id=170&message.id=146859&query.id=3388#M146859
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Programmatically changing string text color in an array of string indicators

    Hi,
    I have an array of string indicators and I'm trying to format certain values different colors.  While I'm able to do this on a single string indicator I can't figure out how to handle the indexing of the array.  I have seen several examples with array of clusters but I am unable to translate to array of string indicators.
    Any help would be appreciated.
    Regards,
    ShotSimon
    Attachments:
    Changing text color in an array of string controls.vi ‏9 KB

    Instead of a string array, where all elements have the same format, you should use a table, which basically behaves as a 2D string array. But there, you can adjust all text attributes (if you are using LV 8.x). See this thread
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • String cannot be applied to java.lang.String in NetBeans 6 !?!?

    Guys,
    I have a problem. I am calling some API from jar file. Here is the method prototype in API jar:
    public Operator getAdminOperator(String name, String password, int admin);
    when I call this method in NetBeans 6 like the following:
    admin.getAdminOperator(userName, password, 1);
    where userName and password are both string, I get the following error:
    getAdminOperator(String, String, int) in common.admin.AdminRemote cannot be applied to (java.lang.String, java.lang.String, int)
    WTF?!?! If i try the same code in NetBeans 5 it works, and it works in JavaStudioCreator, but NetBeans 6 does not takes it! And because of this error, I am not able to see the Design view in the JSF! The code compiles just fine and runs if I deploy it in the server though, but i need to see the Design view.
    ANY ideas what is going on?

    Then this "String" class must be some other class and not java.lang.String. Did you write the API in question? Does it have a "String" class in one of its namespaces? Or perhaps you wrote a class named "String" and didn't put it in a package? If that's not the case, then contact the writer and ask them.

Maybe you are looking for

  • 2lis_03_BF transformation

    Hi, i am using standard Business content transformation for BF , when i trying to activate the transformation it is showing syntax error in start routine. error: E:In PERFORM or CALL FUNCTION "ROUTINE_9998", the actual parameter "SOURCE_PACKAGE" is i

  • Can I change target for Itunes music library?

    I have 2 hard drives on my laptop and will actually need to buy an external hard drive as my laptop has less space than my iPod. I can't import all my CD's yet. Also, the C drive hold iTunes but I have a D drive that has about 12gigs to hold more spa

  • Networking Tigerized eMac 700 MHz and PM 7200 OS7.6.1 - need help!

    Hello, I've looked on the boards and hit up Google but to no avail so I thought I'd try to ask in this forum for the help I need in sorting out my problem. I have an eMac 700MHz, and am trying to connect my old (but functioning) PowerMac 7200. I want

  • My jsp application works in embedded oc4j, but does not work on standalone

    env OC4J 10.1.3 here is the error: javax.servlet.jsp.JspTagException: java.sql.SQLException: Closed Resultset: next      at oracle.jsp.dbutil.tagext.dbNextTag.doStartTag(dbNextTag.java:105)      at index.jspService(_index.java:220)      [SRC:/mainPag

  • Profit center group wise

    my client requirment is to view the profit center group wise balance sheet  .please suggest me how to configu  with report writer