How to hide username/password in JDBC program.

hi All,
The support tat I get here is simply gr8.
Can someone suggest or send me a link as to how I hide the username /password ....i.e database connection in the jdbc program so as to avoid changing the program everywhere in case username and passwd changes ?????
I simply want to change the following code
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName).newInstance();
// Create a connection to the database
Sring serverName = "127.0.0.1";
String portNumber = "1521";
String sid = "oratest";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "scott";
String password = "tiger";
connection = DriverManager.getConnection(url, username, password);
Ta,
sunny

well i kind of support what my fellow poster neeelima.srtidhar said..
Use of Connection Pooling via JNDI which is either provided by appln server or using custom built frameworks is the best method which i can think of instead of reinventing the wheel by creating a Properties file and then writing a Utility Class which ultimately endup in creating connection Object without any sort of optimal usage.
checkout the below articles for reference of how to do it.
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
http://www.informit.com/articles/article.asp?p=352320&rl=1
http://www.codeproject.com/useritems/pool_client_jboss.asp
http://edocs.bea.com/wls/docs81/jdbc/programming.html
http://www.castor.org/jdo-pooling.html
http://homepages.nildram.co.uk/~slink/java/DBPool/
and if you are thinking of reinventing those that could be possible using the below article
http://www.javaworld.com/javaworld/jw-05-2002/jw-0517-jdbcdriver.html?page=1
Hope that might help:)
REGARDS,
RaHuL

Similar Messages

  • Problem with USERNAME & PASSWORD creation--JDBC connection with MYSQL

    How to connect to JDBC with Mysql Connector
    i installed mysql & created table, it works fine
    During Password---> I gave it as tiger , no username
    i installed mysql connector
    i saved the .jar file path in class path
    HOW TO CREATE USERNAME & PASSWORD & DATASOURCE NAME ---> Is it the password -tiger or something else like (ADMinstrative tools-ODBC-services--etc )
    Pl, help,
    tks
    Xx

    How to connect to JDBC with Mysql Connector
    i installed mysql & created table, it works fine
    During Password---> I gave it as tiger , no usernameTiger? This ain't Oracle.
    I think you should give a username and password. How can it look up a password without a username? Better GRANT the right permissions, too.
    Read the MySQL docs a bit more closely. Your path isn't the way to go.
    %

  • How to hide warning messges in a program?

    how to hide warning messges in a program?

    Are you talking about extended program check? If so, you have to enter  "#EC * at the end of each line that is issuing a warning message.

  • How to hide username and passward in  web reports

    Dear friends
    Im runing one report on web but its showing the username and passward in the URL (address bar) can you please help me how to hide that passward.......
    let suppose the username/passward is scott/tiger
    thanks with regards

    for hide the password follow thses steps
    user_name := get_application_property(username);
    pass := get_application_property(password);
    conn := get_application_property(connect_string);
    con_url := 'userid='||user_name||'/'||pass||'@'||conn;
    /* Convert the connect string into a hexadecimal character string. */
    FOR i IN 1..LENGTH(con_url) LOOP
    v_a := ltrim(to_char(trunc(ascii(substr(con_url,i,1))/16)));
    if v_a = '10' THEN v_a := 'A';
    elsif v_a = '11' THEN v_a := 'B';
    elsif v_a = '12' THEN v_a := 'C';
    elsif v_a = '13' THEN v_a := 'D';
    elsif v_a = '14' THEN v_a := 'E';
    elsif v_a = '15' THEN v_a := 'F';
    end if;
    v_b := ltrim(to_char(mod(ascii(substr(con_url,i,1)),16)));
    if v_b = '10' THEN v_b := 'A';
    elsif v_b = '11' THEN v_b := 'B';
    elsif v_b = '12' THEN v_b := 'C';
    elsif v_b = '13' THEN v_b := 'D';
    elsif v_b = '14' THEN v_b := 'E';
    elsif v_b = '15' THEN v_b := 'F';
    end if;
    con_url_temp := con_url_temp||'%'||v_a||v_b;
    END LOOP;
    path:='/reports/rwservlet?server=repserver4&destype=cache&'||con_url_temp||'&report='||rep_path);
    web.show_document(path);
    kuljeet pal singh

  • How to pass username/password through WebService proxy client to E-BS.

    Hi
    We are using ADF Webservice proxy client to integrate E-Business suite with ADF. It asks for username/password to access details from E-BS. In the generated webservice XSD file, a method is available with 2 parameters.
    1) SOAP header( Contains Username, responsibility and 2 more fields)
    2) Class object(Nested Object)
    However i didn't find "*Password*" field anywhere in it. Then how can I pass "*Password*" along with username to invoke this method?
    When i checked SOAP, the password is defined like this
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXX</wsse:Password>a
    Thanks
    Raja

    hi Dario
    Thank you for your post. It is really helpful. Now I got stuck with a doubt, in this piece of code
    final Binding binding = ((BindingProvider) servicePort).getBinding();
    List<Handler> handlerList = binding.getHandlerChain();
    if (handlerList == null)
    handlerList = new ArrayList<Handler>();
    They didn't mention properly about "*servicePort*". What object is this?
    I checked in Oracle document, even in that I was not clear with that piece of code.
    public class HandlerWS{ 
    @Resource WebServiceContext ctx;
    @WebMethod()
    public String getProperty(String propertyName) {  
    return (String) ctx.getMessageContext().get(propertyName);
    public class Main {
    public static void main(String[] args) {
    HandlerWS test;
    try {
    test = new HandlerWS(new URL(args[0] + "?WSDL"), new
    QName("http://example.org", "HandlerWS") );
    } catch (MalformedURLException murl) { throw new RuntimeException(murl); }
    HandlerWSPortType port = test.*getHandlerWSPortTypePort*();
    What is this HandlerWSPortType object???. Can you give me little more explanation about it?
    Thanks

  • How to supply username/password and hostname when calling a web service

    The Workshop Help contains a chapter named "To Use the Java Proxy in a Separate Java Application". It includes the following code:
    public class Main
    public static void main(String[] args)
    try
    HelloWorld_Impl proxy = new HelloWorld_Impl();
    HelloWorldSoap soapProxy = proxy.getHelloWorldSoap();
    System.out.println(soapProxy.Hello());
    catch (Exception e)
    e.printStackTrace();
    Questions:
    1. How is the username and password supplied in case the Hello World web service is secured?
    (I have not found any Javadoc for weblogic.webservice.core.rpc.ServiceImpl, but from the code assist I see a constructor taking two Strings....)
    2. Is there a way to supply a hostname, and port, in case the Hello World web service exists on more than one host?

    If I need to specify the wsdl url it fails as wsdl it self is protected. How do I pass in the userId/password while getting the wsdl.
    E.g:
    /*Line below fails as userId/password is not passed.*/
    HelloWorld_Impl proxy = new HelloWorld_Impl(wsdlLocation);
    HelloWorldSoap soapProxy = proxy.getHelloWorldSoap("username", "passwd");
    System.out.println(soapProxy.Hello());

  • Hide username&password in SCP

    Hi all, suppose we have to configure automatic backup
    Router(config)#archive
    Router(config-archive)#path scp://username:password@hostname
    Router(config-archive)#write memory
    Is there any way to hide username and password in config?

    Not sure there is a way to do this as the router is being the client in this scenario. If you can make it the server, then there are some options:
    http://www.cisco.com/en/US/docs/ios/12_2t/12_2t2/feature/guide/ftscp.html
    Sent from Cisco Technical Support iPad App

  • How to pass username;password in to header Variable

    Hi All,
    I have to invoke client SOAP WSDL based web service, He has given the URL. I want to invoke it from bpel. It is sync based web service.
    Please have look at sample input data. in the header section there is element called Token.  what i need to do here I need to pass the user name and password those separated by ;
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.xxxxxxx.com/2005/">
       <soapenv:Header>
          <ns:AuthorizationToken>
             <ns:Token>username;password</ns:Token>
          </ns:AuthorizationToken>
       </soapenv:Header>
       <soapenv:Body>
          <ns:WEBGet>
             <ns:key>pass the input value</ns:key>
          </ns:WEBGet>
       </soapenv:Body>
    </soapenv:Envelope>
    Please advise me how to pass these values when i am invoking it through BPEL.
    Thanks,

    Please help me out, It is little bit urgent.

  • How to set username/password in OSB Business Service

    Hi
    I need to call thirt party http service that utilizes Http Basic authentication i.e. username / password. If I call the same service through Oracle SOA I can either
    put the username/password inside composite.xml but that way the password is visible. So have set the usrname/password insid the console.
    Now want to use OSB to call the sam service. Created business service but where do I add the username/password. Is there a plac inside sbconsole I can set the username password.
    Thanks

    You must a "Service Account" available in OSB and assosciate it with the Business service you invoke.

  • How to Hide username and password in command line using maxl

    Hi,
    How to encript my user name and password in command line prompt when I am login to Essbase server using batch file:
    *1_Here is my batch file:*
    Name of the bat file AV_Assig_Var1.bat
    rem This batch file defines the following variables:
    set $1 = 'admin';
    set $2 = 'password';
    essmsh AV_Asig1.mxl admin password
    ===========================
    *2_Here is my maxl file:*
    Name of the bat file AV_Asig1.mxl
    /* Create a process log */
    spool on to 'D:\lova\spool_log.txt';
    /* login (using variables from a batch file */
    login $1 $2 on 10.42.100.229;
    /* create application and database */
    create application AV_Asig1;
    create database AV_Asig1.AV_DB;
    /* End process log */
    spool off;
    exit;
    *3_Command line prompt*
    D:\Ess>AV_Assig_Var1.bat
    D:\Ess>rem This batch file defines the following variables:
    D:\Ess>rem 1: username
    D:\Ess>rem 2: password
    D:\Ess>essmsh AV_Asig1.mxl admin password
    Essbase MaxL Shell - Release 9.3.1 (ESB9.3.1.0.0A181)
    Copyright (c) 2000, 2007, Oracle and/or its affiliates.
    All rights reserved.
    MAXL> login admin password on *10.46.100.222*; /* I want to hide this information */
    OK/INFO - 1051034 - Logging in user [admin].
    OK/INFO - 1051035 - Last login on Monday, June 14, 2010 12:44:03 PM.
    OK/INFO - 1241001 - Logged in to Essbase.
    MAXL> create application AV_Asig1;
    OK/INFO - 1051061 - Application AV_Asig1 loaded - connection established.
    OK/INFO - 1054027 - Application [AV_Asig1] started with process id [6792].
    OK/INFO - 1056010 - Application AV_Asig1 created.
    MAXL> create database AV_Asig1.AV_DB;
    OK/INFO - 1054014 - Database AV_DB loaded.
    OK/INFO - 1056020 - Database AV_Asig1.AV_DB created.
    MaxL Shell completed
    D:\Ess>
    I am looking forward to inputs from anybody.
    Thanks & Regards,
    Deepthi.

    Beyond that thread, I gave a presentation at Kaleidoscope last year around MaxL that goes into quite a bit of depth re encryption and a whole bunch of other MaxL goodies.
    To download it, go to www.odtug.com, click on Tech Resources, Essbase/Hyperion, and use the search box for MaxL.
    There are two presentations, one by Tracy McMullen and the other by me. Tracy's is a good introduction to the various command groups; my presentation focused on a few areas in depth, one of which was encryption. The title is "Master Essbase with MaxL Automation".
    You will need to join ODTUG to download the presentation, but there is a junior membership that is free.
    Regards,
    Cameron Lackpour
    P.S. ODTUG Kaleidoscope 2010 is coming up in two weeks, starting on 27 June 2010 -- for those of you still on the fence, it is an awesome conference and I urge you all to come. The content this year will be fantastic.

  • How to hide the password in .class file?

    Hi All,
    I try to use a Connect.java file to connect to MySQL. The URL is similar to the following:
    "jdbc:mysql://192.168.1.1/database?user=name&password=123456"
    When I compile the .java file to a .class file, I can still see the full URL line in the machine codes of the Connect.class file.
    How to avoid exposing the password in the line?
    Thank you.
    Anthony Pong

    1) Use obfuscate option in your Java compiler
    2) There is Jakarta tool BCEL - which can be used for
    obfuscation, etcObfuscation tools don't obfuscate single literal string contents, which is the problem here.
    You'll have to make sure that your string doesn't appear as a single string anywhere. One technique is to break up your password into pieces, and scatter the declarations around, and join them up in the code to construct your password.
    (Oh yeah, and don't call your variables "static private final String passwordPiece1="foo";" either :-), or use an obfuscation tool to hide these variable names).

  • Can I pass username & password in JDBC URL in Crystal Reports 2008?

    Hi,
    I tried to put this URL in the CRConfig.xml file : jdbc:postgresql://hostname:5432/db_name?user=user_name&password=pw
    Without the user and password parameters, it works fine but I always have to enter the database information when I create a new report or refresh an existing report.
    With the parameters, when I create a new report, if I click on "Create new connection", Crystal Reports freezes. If I click on the connection in "My connections", then I get an "Invalid argument" error message.
    How can I configure the database information so that I don't always need to enter it manually?
    Thanks,
    Marianne

    Hi Marianne,
    We don't recommended you do that. The text is in the clear so anyone could use your log on info. You may be able to add your user name to the Report by editing the connection properties from the Set Location dialog box but to add your password would give anyone who opened your report your log on info.
    And the info would be passed to the DB over the network in the clear so someone could hack your info.
    Thank you
    Don

  • How to hide username?

    Hi, I'd like to hide my username, that is, the name I use to log in to Skype from some or all of my contacts, I stupidly made my username contain my real name which is very unique and I don't want some people I contact to know this information. Any help would be greatly appreciated!
    Solved!
    Go to Solution.

    Hi, Tony1030, and welcome to the Community,
    A Skype user name is public information ... and Skype does not permit a user name to be changed/edited once it is created. 
    You could create a new account and abandon the one you no longer wish to use.  This would mean, of course, having to add all of your contacts into your new account.  More information here: 'Can I delete my Skype account?'
    Best regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • How to hide the password's list from the Tools - Options - Passwords

    Hi I am an IT in a experimental school and we work 99% online with the teacher & students in the class.
    My boss need to '''hide''' from the teachers the option to see the stored password for thousands subscription sites that my boss have pay.
    It their any way that we can hide / remove the option to see the stored passwords.
    Thank you for you help in advanced.

    See also [[Protecting stored passwords using a master password]]
    Do you need those passwords to be entered automatically on websites or does only your boss need to have access to them and use the passwords?
    Your above posted system details show outdated plugin(s) with known security and stability risks.
    *Next Generation Java Plug-in 1.6.0_15 for Mozilla browsers
    Update the [[Java]] plugin to the latest version.
    *http://java.sun.com/javase/downloads/index.jsp (Java Platform: Download JRE)

  • How to hide username in comments section of sharepoint 2013 blog page

    I have a blog page in SharePoint 2013. In that, in the comments section, i have to hide the username of the person who posted the comment.
    I also have to hide it from the page source, hence i cannot use css. Please suggest some solution,if possible using xslt.

    Open the blog.xsl file which is located in "/_layouts/XSL/blog.xsl"
    For safe side take the back up of blog.xsl file and open it and find the below div
    <div class="ms-PostFooter">
    <!-- For the author field, render it using the span style and preceed it with the word "by"-->
    <span class="ms-postfootercolor"><xsl:value-of select="$thisNode/../@resource.wss.ByPrefix"/></span><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:call-template name="RenderAuthor"/>
    <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><span class="ms-postfootercolor"><xsl:value-of select="$thisNode/../@resource.wss.blog_postfooter_at"/><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
    <xsl:choose>
    <xsl:when test="$ContainerId"><xsl:text disable-output-escaping="yes">&lt;#= spMgr.RenderFieldByName("PublishedDate", listItem, listSchema) #&gt;</xsl:text></xsl:when>
    <xsl:otherwise><xsl:value-of select="@PublishedDate" disable-output-escaping="yes"/></xsl:otherwise>
    </xsl:choose></span>
    <div>
    In the above div remove the span tag
    <!-- For the author field, render it using the span style and preceed it with the word "by"-->
    <span class="ms-postfootercolor"><xsl:value-of select="$thisNode/../@resource.wss.ByPrefix"/></span><xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text><xsl:call-template name="RenderAuthor"/>
    If you any help please let me know

Maybe you are looking for

  • How can i display image in RTF template when Oracle Apps running in Windows

    Can any body help how can i display image in RTF template when oracle apps running in Windows Server. Thanks Ravi

  • How do I get the rowid or the DataModel from a DataTable inside a DataTable

    Hi, I have a simple application which I cannot get to work. I have two entity classes: Parent and Child. I want to create a page which lists all of the Parents, and in a column of the Parent row has an inner dataTable which displays the Children of t

  • Gradients are messed up...?

    Weird problem here, haven't really noticed before, but now it became very apparent in a certain case. Switched from InDesign CS2 on Windows to CS3 on Mac a couple of months back, and still have some things to learn :) Anyway, to get back to the probl

  • Comms with parallel port

    Hi I am trying to send  a command to a printer via the parallel port, but am having no joy. I have set  the BIOS printer port setting to 'Bidirectional', and created a small test program as  attached. I need to send an  <ESC>A, 10 (hex), <ESC>Z in or

  • 5.1 sound great demo using Windows Media Pla

    Here is a fast URL for a .wma file that will really works your sound card in 5.. I have an Audigy 2 card that has been working well for me. I added a GigaWorks S700 speaker system to use as a portable surround demo for movie sound. I am impressed wit