How is better to connect, use a class or ..

hi,
i have a web application with ten classes. I hava a class DatabaseClass which provides only the connection to the database with a method call getMyConnection f.i.
I thought to remove this class and put the databse conncetion
String(server name,database name ,user,pass..) to the web.xml file and let other classes to call this parameter from web.xml and make own connnection instead of to create an instance of DatabaseClass. What could be a problem, what is advantage, disadvantage.?
thanks

I don't know, it's your idea.

Similar Messages

  • How can I make server use single class loader for several applications

    I have several web/ejb applications. These applications use some common libraries and should share instances of classes from those libraries.
    But applications are being deployed independently thus packaging all them to EAR is not acceptable.
    I suppose the problem is that each application uses separate class loader.
    How can I make AS use single class loader for a set of applications?
    Different applications depend on different libraries so I need a way that will not share library for all applications on the domain but only for some exact applications.
    When I placed common jar to *%domain%/lib* - all works. But that jar is shared between all applications on the domain.
    When I tried to place common jar to *%domain%/lib/applibs* and specified --libraries* attribute on deploying I got exception
    java.lang.ClassCastException: a.FirstDao cannot be cast to a.FirstDaoHere http://download.oracle.com/docs/cd/E19879-01/820-4336/6nfqd2b1t/index.html I read:
    If multiple applications or modules refer to the same libraries, classes in those libraries are automatically shared.
    This can reduce the memory footprint and allow sharing of static information.Does it mean that classes should be able to be casted ?

    You didn't specify which version of the application server you are using, but the config is similar as long as you know what to look for. Basically, you need to change the classloader delegation. Here's how it is done in 8.2
    http://download.oracle.com/docs/cd/E19830-01/819-4721/beagb/index.html

  • How to create database connection using DB2Driver in JDeveloper 10.1.2.1.0?

    I am trying to create a JDeveloper/Data Connection using com.oracle.ias.jdbc.db2.DB2Driver. The driver is registered from a User Libraries: DataDirect JDBC. I have the following class path for the library:
    E:\DataDirect\3.4\lib\YMdb2.jar;E:\DataDirect\3.4\lib\YMbase.jar;E:\DataDirect\3.4\lib\YMutil.jar
    I have no trouble configuring the connection but when I test it and I got ‘No suitable driver Vendor code 0’. What’s wrong? I have successfully created several database connections using Oracle thin driver. This is first time I am using a third party driver. Has any one successfully create a database connection using the com.oracle.ias.jdbc.db2.DB2Driver?

    Hi
    Since the error points to the unavailability of the driver class,can you double check your library claspath entries again.
    I just tried a DB2 connection using the following properties and the connection went through fine:
    Driver class name: com.oracle.ias.jdbc.db2.DB2Driver
    URL: jdbc:merant:db2://<host_name>:50000;DatabaseName=SAMPLE
    Thanks
    Prasanth

  • How to debug RFC connection using RfcOpenEx?

    Hi,
    I use COOPC1 to test a RFC connection and this transaction uses RfcOpenEx which fails.
    How can I debug this connection?
    Best regards
    Marty

    Hi,
    in fact the conection from SAP to the destination works using SM59. but the system reply with a connection using RfcOpenEx but this function fails because there is a mixup with the parameters maybe a wrong type.
    I will try to debug from the tcode COOPC1 when I start a subscription.
    Thanks
    Marty

  • How to get DB Connection using IConnectorService

    Hi All
    I need some documents or help on how to make a jdbc connection using IConnectorService framework. Can anybody help?
    Warm Regards
    Shubhadip

    Hi Shubhadip,
    I have some usefull code for you.
    //This method is to perform the connection to the DataBase, where
              // the Database name is myDatabase
              public IConnection getConnect()
                   IConnection myconnection = null;
                   IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
                   Object connectorservic = PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);
                   IConnectorGatewayService cgService = (IConnectorGatewayService)connectorservic;
                   mylogger = request.getLogger();
                   ConnectionProperties cp = new ConnectionProperties(request.getLocale(), request.getUser());
                   try {
                         myconnection = cgService.getConnection("myDatabase", cp);
                         catch (Exception e)
                               mylogger.severe(e.getMessage());
                   return myconnection;
    Kind Regards,
    Al-Suwaiyel

  • How to share internet connection using socketserver?

    Hello guys is this possible? i want to share my internet connection programmaticaly using java for example i have a one computer that has internet connection and i want to run socketserver from the computer that has internet connection and share the internet connection to another computer that has no internet connection using socket how to do that in java?

    jhovarie wrote:
    Hello guys is this possible? i want to share my internet connection programmaticaly using java for example i have a one computer that has internet connection and i want to run socketserver from the computer that has internet connection and share the internet connection to another computer that has no internet connection using socket how to do that in java?No, this is mostly a admin (networking ) issue. if you want to do so, you require a router (switch), one end should be connected to internet connection, and then connect the rest of the computers to router. you will be able to access the internet.

  • How is the db connection used... and how to use the queries

    dear sir,
    i have to important question.
    i am pasting the code of a jsp file below.... please look in to this...
    in this page.. how is he making a database connection... and in this page
    where are the select statements and queries.... i have tried many times reading
    this ..but i could not find the queries ..not even any one.
    if anyone sees this jsp file also ... he will not be able to see the queries.
    can u please help me .. how to do this type of connection and also how to use queries
    like select insert and delete and update .
    an example will help me out...please help me...
    Ramesh
    the file is below....
    <%@ include file="jtfincl.jsp" %>
    <%@ page language="java" %>
    <%@ page import="oracle.apps.ibu.common.IBUContext" %>
    <%@ page import="oracle.apps.ibu.common.IbuException" %>
    <%@ page import="oracle.apps.ibu.common.Employee" %>
    <%@ page import="oracle.apps.ibu.common.EmployeeInfo" %>
    <%@ page import="oracle.jdbc.driver.*" %>
    <%@ page import="oracle.apps.jtf.aom.transaction.*" %>
    <%@ page import="oracle.apps.jtf.base.resources.*" %>
    <%@ page import="oracle.apps.jtf.base.interfaces.MessageManagerInter"%>
    <%@ page import="oracle.apps.ibu.registration.IbuRegistration" %>
    <%@ page import="oracle.apps.ibu.registration.CustomerVO" %>
    <%@ page import="oracle.apps.ibu.common.IDNamePair" %>
    <%@ page import="oracle.apps.ibu.common.*" %>
    <%@ page import="oracle.apps.ibu.registration.*" %>
    <%@ page import="java.math.BigDecimal" %>
    <jsp:useBean id = "_displayManager"
    class = "oracle.apps.ibu.common.DisplayManager"
    scope = "application" />
    <jsp:useBean id = "ibuPromptManager"
    class = "oracle.apps.ibu.common.PromptManager"
    scope = "application" />
    <%
    String appName= "IBU";
    boolean stateless=true;      // used for jtfsrfp.jsp
    SiteProperty.load();
    String username = SiteProperty.getGuestUsername();
    String password = SiteProperty.getGuestPassword();
    %>
    <%@ include file="jtfsrfp.jsp" %>
    <%
         String forwardURL = null;
         String backURL = null;
    String emailAddress = null;     
         long employeeID = -1;
         String submitType = (String) request.getParameter("submitType");
         IBUContext context = new IBUContext(fwSession);
         String errorKey = "";
         String errorMessage = "";
         String errorStack = "";
         boolean currentStatus = true;
    Object lockx = new Object ();
         OracleConnection conn = null;
    try
         TransactionScope.begin(lockx);
    try
    conn = (OracleConnection)
    TransactionScope.getConnection();
         catch ( Exception e )
    throw new FrameworkException("Error getting connection..");
    if ( conn == null )
    throw new FrameworkException("Error getting connection..");
         String[] textMsgs = new String[3];
         MessageManagerInter msgMgr = Architecture.getMessageManagerInstance();
         textMsgs[0] = msgMgr.getMessage("IBU_RG_CONTRACT24");
         //textMsgs[0] = " is not a valid employee email address.";
         textMsgs[1] = msgMgr.getMessage("IBU_RG_CONTRACT25");
         //textMsgs[1] = " Cannot get the employee id.";
         textMsgs[2] = msgMgr.getMessage("IBU_RG_CONTRACT13");
         //textMsgs[2] = "submitType is null, please check program.";
         if ( (submitType != null) && "LOGIN".equals( submitType ) )
         forwardURL="jtflogin.jsp";
         backURL="jtflogin.jsp";
         else if ( (submitType != null) && "EMPLOYEE_CHECK".equals( submitType ) )
         forwardURL="ibuemplcheck.jsp";
         backURL="ibuemplcheck.jsp";
         else if ( (submitType != null) && "EMPLOYEE_NUMBER_SUBMIT".equals( submitType ) )
         backURL="ibuemplcheck.jsp";
    emailAddress = (String) request.getParameter("emailAddress");     
         pageContext.setAttribute("emailAddress", emailAddress , PageContext.REQUEST_SCOPE);
         employeeID = IbuRegistration.getEmployeeID(conn,emailAddress);
         if (employeeID == -1)
              throw new IbuRegException(emailAddress + "  "+textMsgs[0] + "  " +textMsgs[1]);
         //validate employee
    currentStatus = Employee.isValidate(conn,emailAddress);
    //currentStatus = IbuRegistration.isEmployeeValid(conn,emailAddress);
         if (!currentStatus)
              throw new IbuRegException(emailAddress + "  " + textMsgs[0]);
         EmployeeInfo employee = Employee.findEmployee(conn,employeeID);
         pageContext.setAttribute("employee", employee , PageContext.REQUEST_SCOPE);
         pageContext.setAttribute("employeeIDStr", Long.toString(employeeID) , PageContext.REQUEST_SCOPE);
         forwardURL="ibuemplinput.jsp";
         else
         { // Cancel button was pressed
         throw new IbuRegException(textMsgs[2]);
         /* "ibuccsii.jsp"; */
         catch ( IbuException e )
    TransactionScope.setRollbackOnly();
         errorMessage = e.getMessage();      
         errorStack = IbuRegException.getStack(e);
         pageContext.setAttribute("errorMessage", errorMessage , PageContext.REQUEST_SCOPE);
         pageContext.setAttribute("errorStack", errorStack , PageContext.REQUEST_SCOPE);
         forwardURL = backURL;
         catch (IbuRegException e)
    TransactionScope.setRollbackOnly();
         errorMessage = e.getMessage();      
         errorStack = e.getStack();
         pageContext.setAttribute("errorMessage", errorMessage , PageContext.REQUEST_SCOPE);
         pageContext.setAttribute("errorStack", errorStack , PageContext.REQUEST_SCOPE);
         forwardURL = backURL;
         catch ( Exception e )
    TransactionScope.setRollbackOnly();
         errorMessage = e.getMessage();      
         errorStack = IbuRegException.getStack(e);
         pageContext.setAttribute("errorMessage", errorMessage , PageContext.REQUEST_SCOPE);
         pageContext.setAttribute("errorStack", errorStack , PageContext.REQUEST_SCOPE);
         forwardURL = backURL;
    //throw new FrameworkException( e , "IBU_UNEXPECTED_EXCEPTION");
         finally
    TransactionScope.releaseConnection( conn );
    TransactionScope.end ( lockx );
         if (forwardURL == null)
         forwardURL="jtflogin.jsp";
    %>
         <jsp:forward page= "<%= forwardURL %>" />
    <%@ include file="jtferlp.jsp" %>

    dear sir,
    i have to important question.
    i am pasting the code of a jsp file below.... please look in to this...Note that this is an OCI forum. Since your code is using Oracle's JDBC driver to connect, I would suggest posting in the JDBC forum for more information.
    in this page.. how is he making a database connection...
    try
    conn = (OracleConnection)
    TransactionScope.getConnection();
         catch ( Exception e )
    throw new FrameworkException("Error getting connection..");
    and in this page
    where are the select statements and queries.... There may be queries in the Employee objects or in the include files.
    Justin

  • How to share internet connection using 10.6 Server

    Hi
    My server connects to the internet via ethernet and I'd like to setup something like internet sharing so that I have a WiFi connection in the same office as the server.
    I read how to do this using Gateway Setup Assistant but I already have a DHCP setup with lots of static maps and have no wish to overwrite all that.
    I've turned on NAT and attempted to create a new Subnet using DHCP but it doesn't offer me Airport in the network interface menu (only en0 and fw0). Airport is turned on in network system prefs.
    Hope someone can help.
    Cheers
    James

    I've turned on NAT and attempted to create a new Subnet using DHCP but it doesn't offer me Airport in the network interface menu (only en0 and fw0). Airport is turned on in network system prefs.
    Have you actually configured the AirPort network with its own IP address settings (in a different subnet from the wired ethernet port)?
    Having the interface enabled isn't enough to make it a viable gateway interface. It needs an IP address/subnet mask too.

  • How to print a footer using CL_GUI_ALV_TREE class

    Dear Abapers.
    I'm using SET_TABLE_FOR_FIRST_DISPLAY method from CL_GUI_ALV_TREE class to display a report in an ALV Tree and I need to display the footer.
    Using the PRINT_END_OF_PAGE event from class CL_GUI_ALV_GRID we can display the header, but I need to use CL_GUI_ALV_TREE and there is no method for END_OF_PAGE.
    Can you please help me?
    Many thanks.
    Estela

    Dear Abapers.
    I'm using SET_TABLE_FOR_FIRST_DISPLAY method from CL_GUI_ALV_TREE class to display a report in an ALV Tree and I need to display the footer.
    Using the PRINT_END_OF_PAGE event from class CL_GUI_ALV_GRID we can display the header, but I need to use CL_GUI_ALV_TREE and there is no method for END_OF_PAGE.
    Can you please help me?
    Many thanks.
    Estela

  • How to create multi connections using JCO in different application servers

    Hi all,
    I want to connect to sap using jco from different servers at the same time.
    There are 3 Jave application servers now. But I can only connect the sap servers using ONE server ( random ) at same time. It means when one server connect to sap , the other 2 servers CANNOT connect to sap.
    Anyone konw what wrong?
    Thanks in advance.
    Ned

    ......

  • How to share internet connection using 5G wifi/channel 36~48

    I'm using a 15 inch late 2013 MacBook Pro with retina display running 10.10.1 and iPhone 5S A1530 running iOS 8.1.
    I use an Apple thunderbolt to ethernet adapter at work for internet and it's all cool and fine.
    The problem comes when I try to share the internet connection with my phone through wifi. It's alright if I use channel 1 to 11. But when I try the 5G channels: 36, 40, 44, 48, it just doesn't work. The wifi icon in the top right corner of my screen has a wave animation and then nothing. It just goes back to grey instead of an arrow pointing upwards. In the slimmest hope of a display error, I search nearby wifi signal with my phone and nothing.
    I have a 5G router at home and both my laptop and my phone can connect to its 5G signal. So the hardware should be fine.
    It's weird since it should be working as Apple decided to put an option there for user to choose from all the channels, among which lie the four 5G channels.
    So to conclude, my laptop with a functioning 5G wifi module can share internet connection through 2.4G wifi but not 5G.
    Hope someone could help me with it. Thanks.

    I've turned on NAT and attempted to create a new Subnet using DHCP but it doesn't offer me Airport in the network interface menu (only en0 and fw0). Airport is turned on in network system prefs.
    Have you actually configured the AirPort network with its own IP address settings (in a different subnet from the wired ethernet port)?
    Having the interface enabled isn't enough to make it a viable gateway interface. It needs an IP address/subnet mask too.

  • How to Share Internet connection using cable with ...

    i am using N70, i wonder any way to share my pc broadband connection with my phone using cable. anyone know?

    nobody know ?

  • How different Web Services can use a class which parses an XML file

    I am using RAD6.1 for developing and deploying web services.As I am using 15 web Services which uses a common class which is used to parse an XML file.As this XML file should be parsed only once and should be used by all the web services.I have made this common class as Singleton but it works as singleton for only one webservice and for other web service again it is parsing the xml file.I want to parse this xml file only once and used by all the web services.In my case tis file is parsed 15 times for 15 web services, but it should be parse donly once and used by all 15 services.Please give me the solution.
    Thanks and Regards
    Sayeeduzzaman

    Hello,
    the 15 Webservices should have a static attribute which contains the xml:
    private static String xml;
    then initialise the xml like this:
    if (xml == null)
    xml = parseIt();
    else
    //do nothing, XML already initialised!
    }

  • How to check if still using a class or id

    Just wondering if there is a tool which will tell me if i am
    still using a particular id or class on my site
    Many thanks
    Mark

    "quiero mas" <[email protected]> wrote in message
    news:g1nof8$dms$[email protected]..
    > Just wondering if there is a tool which will tell me if
    i am still using a
    > particular id or class on my site
    I do that using Find and Replace.
    Patty Ayers | www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet

  • How to configure https connection using a http proxy in weblogic server

    Hi,
    I have a proxy in Aqualogic Service Bus that points to a https external service. Our development environment internet access is supported by a http proxy server. The ALSB proxy fails to connect, with the following error message:
    <con:fault xmlns:con="http://www.bea.com/wli/sb/context">
    <con:errorCode>BEA-380002</con:errorCode>
    <con:reason>
    Tried all: *1 addresses, but could not connect over HTTPS to server: sitenet43.serasa.com.br port: 443*
    </con:reason>
    <con:location>
    <con:node>RouteTo_ConsultarSerasa</con:node>
    <con:path>request-pipeline</con:path>
    </con:location>
    </con:fault>
    I've added the following parameters to jvm args:
    -Dhttp.proxyHost=10.128.0.50
    -Dhttp.proxyPort=3126
    -Dhttp.proxyUser=<someUserName>
    -Dhttp.proxyPassword=<somePassword>
    Accessing the page in Internet Explorer or Firefox is working fine. Somebody knows any additional configuration to this case?
    Thanks in advance
    Rogério Cruz

    In osb you can configure a HTTP proxy server. Once this is done all BS http/https requests will be through the configured proxy server.
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/consolehelp/global_resources.html#wp1137225
    Manoj

Maybe you are looking for

  • Fail to import ESS business package..Urgent!

    Dear All NWDI expert, I have installed the NWDI and trying my first step to customize the standard ESS business package. We are on ESS business package 13. The following are the list of step that i have done. Can anyone tell me which step i make mist

  • Cannot find Main Header in XMBMessage

    Hi I am implementing a JDBC Receiver using the J2SE Adapter Engine. We've already implemented another JDBC Receiver which works fine, but for the payload shown below I receive the following exception from the J2SE Adapter Engine:   com.sap.aii.messag

  • Why can't got element from XML

    I try to load an XML element from an XML file using HTTPService Object . But The loaded object always null . Here is my XML Content <?xml version="1.0" standalone="no"?> <manifest identifier="imsmanifest.xml" version="1.3" xmlns=" http://www.imsgloba

  • Cant use jar file - JAVA -

    - JAVA - Basically I have few files in one package in every one of them I worte: "pack preyPackage;" And I have some .jar file that I try to use. So I drag it into the oracle compiler, but I still couldnt use it. But if I delete the row: "pack preyPa

  • QuickTime 7.1

    So what can you do with this program? Can you load movies onto it and save them or do you have to purchase QuickTime Pro? How does this QuickTime 7.1 program help with anything exactly? I would really like to be able to watch movies and stuff on my i