Connection using bean

how do we make connection to a ms-acess database using bean....i want to avoid going to control panel and overther go to ODBC...

http://search.java.sun.com/Search/java?col=javafrm&qp=%2Bforum%3A48&qt=%22dsn+less%22

Similar Messages

  • Database connection using beans

    Hi, I'm very new to JSP. I'm trying to write an application which has a Login page which the user uses to login to a Oracle database (with their own User ID and password). Once the user has successfully logged in I would like to use the same connection to all the other pages the user is traversing until the user logs out. I have come to know that this is possible using beans in JSP or using the connection pool, but I'm not 100% sure how. Can someone please provide me some sample code of the Login page, the beans and a third page which uses the connection. I really appreciate your time and efforts. Thanks a lot in advance for all your efforts and support.
    Cheers
    Balaji

    What you have to learn is how to use session variables after you have successfully logged in your pages. What the next succeeding pages will do is to check if this session variable is not null or valid and then proceed with the display of the pages or redirect it to the login page otherwise. You can implement this sesion variable as a bean to store all the details for a particular user.
    Typically you will use
    Object o = session.getAttribute("yourSessionVariable");
    if (o ==null)
    // go to login page OR
    // create a session variable
    // like session.setAttribute("yourSessionVariable", new Object());
    }else
    //proceed with the display
    Here, o is your bean.
    Hope this helps

  • Jsp and database connection using bean

    * I want create a bean to handle database connectivity.The
              <jsp:usebean> tag uses
              no argument constructor ..so I cannot pass the userid and password to
              the constructor.
              So how can I create a database connection when the user_id and password
              will be a part of parameter ?
              * Now I'm opening database connection in the jsp scriplets. Everytime I
              refresh the
              jsp page a new connection is created ? Is it not going to choke the
              database ? I cannot use connection pool because every user logs in with
              different userid.
              Thanks
              

    You can pass your arguments in this way:
              <jsp:usebean id="myBean" scope="page"/>
              <jsp:setProperty name="myBean" property="userId", value=<%= user_id%>/>
              <jsp:setProperty name="myBean" property="password", value=<%=
              user_password%>/>
              of course, in your bean class, you should create two setter methods,
              setUserId and setPassword.
              Hopefully, this will help you.
              sonia WEN
              Chiranjib Misra wrote:
              > * I want create a bean to handle database connectivity.The
              > <jsp:usebean> tag uses
              > no argument constructor ..so I cannot pass the userid and password to
              > the constructor.
              > So how can I create a database connection when the user_id and password
              > will be a part of parameter ?
              >
              > * Now I'm opening database connection in the jsp scriplets. Everytime I
              > refresh the
              > jsp page a new connection is created ? Is it not going to choke the
              > database ? I cannot use connection pool because every user logs in with
              > different userid.
              >
              > Thanks
              

  • How to make common database connection using bean, etc.

    anyone know how to make a coomon database connection because on my web pages each of them need to connect on the database for their specific objectives... please help
    regards
    blingbling
    Edited by: BlingBling15 on Oct 22, 2007 1:16 PM

    Making a 'common' connection and passing it around is a bad idea. And making a new connection on every page, as you seem to have already guessed, also involves an overhead that you can do without.
    Like drvijayj2k2 has mentioned, you should use connection pooling.
    Take a look at the Apache Commons DBCP [1] and it's examples [2].
    [1] http://commons.apache.org/dbcp/
    [2] http://wiki.apache.org/jakarta-commons/DBCP
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • JDBC Thick connection using ADF

    Hi All,
    I am doing Thick Oracle connection using ADF but i am getting this error...
    java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path
    following is my code..
    try {
    Class.forName("oracle.jdbc.OracleDriver");
    Connection con=DriverManager.getConnection("jdbc:oracle:oci8:@dbndevp", "mfonline", "mfonline");
    System.out.println(con.isValid(1));
    } catch (Exception e) {
    e.printStackTrace();
    So how can i do it in ADF......
    -Thanks
    Edited by: Santosh Vaza on Dec 31, 2010 6:14 PM

    Suppose i have a backing bean class then how would i get connection to database, Suppose that i am using 2 connections to 2 different database.Case 1: If you are using ADF Business Components (or some other framework that implements "business services" layer)
    In this case ADF BC implement the "business services" layer in the application architecture and they are responsible for the interaction with the DB. You should encapsulate there all the program logic that interacts directly with the DB. You can invoke ADF BC methods from managed beans but you should not implement any direct DB operations in managed beans (in particular you should not open DB connections, parse and execute SQL statements in managed beans). If you need to work with 2 different databases, then you have to define 2 different ApplicationModules (with connections to these databases). There is an important disadvantage - ADF BC does not support global transactions (e.g. XA-compatible transactions), so if you need distrubuted transactions, then either you could use DB-links (if both databases are Oracle ones) or you will need a different framework.
    Case 2: If you are not using any framework that implements "business services" layer
    In this case you should not use DriverManager, but you could get DB connections from JDBC DataSources. In this way you would benefit from the connection pooling of the DataSources and you would avoid the heavy overhead of creating and closing DB connections. (When you close a DB connection acquired from a DataSource, in fact it is not closed but it is just checked back into the DataSource's connection pool).
    Dimitar

  • How many number of database connections used in a transaction

    Hi All,
    We are using weblogic 8.1 with Oracle 9i both running on windows 2000. We are trying to estimate the potential resource usage in the system we are building. As part of this activity we want to find out how the database connections are used for entity beans -
    If a session bean calls more than one entity beans
    (each method in the entity bean doing one update) does weblogic use the same database connection for all the entity beans or does it use seperate connections ? Is such behaviour documented somewhere ?
    Here the assumption is all the entity beans are linked to the same datasource.
    If the (default) behaviour is to use seperate connections is there a way to make it use one connection across multiple entity beans.
    Thanks
    Kingshuk

    Hi Bodapati,
    Sorry for the delay in replying to this.
    There is optimization, which will use the XA
    connections from the pool. Can you tell me what your
    observations are? I may be able to see if we can tune it.From our tests the XA driver too appear to make use of one connection only for the life of the transaction. There is a good document here explaining how it is ensured that only one connection is used - http://e-docs.bea.com/wls/docs81/oracle/trxjdbcx.html#1083132
    Quoting from the above URL :
    When a thread attempts to use a connection, the XA jDriver calls xa_open (and xa_start) to create the connection and associate it with the thread. After the database connection is created, the connection remains associated with the thread; the driver does not call xa_close. When the thread subsequently needs a database connection, it uses the same database connection associated with it, even though it appears to get and return a connection from the JDBC connection pool
    I am not sure why you say the connections will be
    blocked. One connection will be blocked only if you are > using non-XA driver to setup the pool, until the
    transaction commits. For XA there is no need to reserve
    the same connection for the transaction.Probably my understanding on this is incorrect and I need to read up. I was under the impression that - once a transaction begins, each connection used within that transaction, is enlisted as a part of that transaction and can not be used by in another transaction until the transaction commits or rollsback.
    Thanks
    Kingshuk

  • Urgent : Data Passing Problem in JSP dynpage using bean in SP11

    Hi all
    I am trying to pass data from my jspdynpage to jsp using bean , which is not at all passing any values
    i am pasting code below which works in 6.0 sp09
    I dont know what is happening in sp11
    please suggest me in this situation
    public static class LeaderStatusOverviewDynPage extends JSPDynPage{
        private LeaderStatusBean myBean = null;
        public void doInitialization(){
            this.ensureBeanisSetup();
        public void doProcessAfterInput() throws PageException {
        public void doProcessBeforeOutput() throws PageException {
          this.setJspName("leaderstatus.jsp");
        public void ensureBeanisSetup(){
                IPortalComponentRequest request       = (IPortalComponentRequest)this.getRequest();
                            IPortalComponentContext myContext     = request.getComponentContext();
                //IPortalComponentProfile profile = myContext.getProfile();
                      Object o = myContext.getValue("myBean");
                      if(o==null || !(o instanceof LeaderStatusBean)){
                        myBean = new LeaderStatusBean();
                        myBean.setMessage("This String From Bean");
                        myContext.putValue("myBean",myBean);
                      } else {
                          myBean = (LeaderStatusBean) o;
    My jsp page
    <jsp:useBean id="myBean" scope="application" class="bean.LeaderStatusBean" />
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId" >
       <% Date today = new Date(); %>
       <h1> This is Test page for NOVA Chemicals </h1>
       <br><br>
       <font color = "blue" size = "4"><center>
       <%=today%>
       </center>
       <br><br> This is the message of Connection  :
       <%=myBean.getMessage()%>
       </font>

    Hallo Prakash,
    I am developing with EP SPS12 and am facing the exact same situation. Values passed to the bean from the dynPage do not get through to the jsp. When removing the respective lines in the portalapps.xml I get a portal runtime exception.
    I am posting my portalapps and the jsp where importing the beans. What am I missing here? Any help would be greatly appreaciated! Thank you in advance.
    BR
    Helga
    <?xml version="1.0" encoding="utf-8"?>
    <application>
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
      </application-config>
      <components>
        <component name="AdminComponent">
          <component-config>
            <property name="ClassName" value="com.company.AdminComponent"/>
            <property name="SecurityZone" value="com.company.AdminComponent/low_safety"/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/AdminComponentView.jsp"/>
          </component-config>
        </component>
      </components>
      <services/>
    </application>
    <jsp:useBean id="dropDownListBean" scope="application" class="com.company.bean.DropDownListBean" />

  • Cinnecting to database using bean

    Hello
    I am gating crazy. Can you sent me example of conecting to database using beana and executing ine query. Nothing works at all.
    Thanks in advance

    here is the code sample:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class dbBean{
         private String dbURL = "jdbc:odbc:TheDataSourceName";
         private String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
         private Connection dbCon;
         String userID = null;
         String userPass = null;
         String email = null;
         String firstName = null;
         String lastName = null;
    public dbBean(){
         super();
    public String getUserID(){
         return this.userID;
    public void setUserID(String userID){
         this.userID = userID;
    public String getUserPass(){
         return this.userPass;
    public void setUserPass(String userPass){
         this.userPass = userPass;
    public String getEmail(){
         return this.email;
    public void setEmail(String email){
         this.email = email;
    public String getFirstName(){
         return this.firstName;
    public void setFirstName(String firstName){
         this.firstName = firstName;
    public String getLastName(){
         return this.lastName;
    public void setLastName(String lastName){
         this.lastName = lastName;
    public String connect(){
         try
              Class.forName(dbDriver);
              return "Driver Loaded";
         }catch(Exception E){
              return "Unable to load Driver";
    public String insertInfo(){
         try{
              dbCon = DriverManager.getConnection(dbURL);
              PreparedStatement ps = null;
              PreparedStatement ps1= null;
              String sql = ("Select * from Logins " +
                   " (where userName = ? and email = ?)");
              ps1 = dbCon.prepareStatement(sql);
              ps1.clearParameters();
              ps1.setString(1,this.getUserID());
              ps1.setString(2, this.getEmail());
              ResultSet rs = ps1.executeQuery();
         //     boolean rs_isEmpty = !rs.next();
              if(!rs.next()){
              ps = dbCon.prepareStatement("Insert INTO Logins " +
              " (userName, userPass, firstName, lastName, email) Values (?, ?, ?, ?, ?) ");
                   ps.clearParameters();
                   ps.setString(1, this.getUserID());
                   ps.setString(2, this.getUserPass());
                   ps.setString(3, this.getFirstName());
                   ps.setString(4, this.getLastName());
                   ps.setString(5, this.getEmail());
                   ps.executeUpdate();
              else{System.out.println("record already exist");}
                   ps.close();
                   ps1.close();
                   dbCon.close();
                   return "Inserted row";
              }catch(Exception e){
              return "Error" + e.toString();
              }//catch(SQLException e1){
              //return "SQLException: " + e1.getMessage();

  • Macbook pro wont connect to internet using cable, but connects using wifi fine

    My macbook pro wont connect to the internet using a cable, but connects using wifi fine.  I use wifi at home but sometimes need to use my laptop at work and connect using a cable but it says i'm not connected to the internet?

    Can you open a terminal and invoke the following commands:
    ping -c 10 localhost
    and
    ping -c 10 google.com
    You should normally get something like:
    PING google.com (74.125.224.103): 56 data bytes
    64 bytes from 74.125.224.103: icmp_seq=0 ttl=55 time=19.053 ms
    64 bytes from 74.125.224.103: icmp_seq=1 ttl=55 time=37.692 ms
    64 bytes from 74.125.224.103: icmp_seq=2 ttl=55 time=46.988 ms
    64 bytes from 74.125.224.103: icmp_seq=3 ttl=55 time=33.466 ms
    64 bytes from 74.125.224.103: icmp_seq=4 ttl=55 time=28.940 ms
    64 bytes from 74.125.224.103: icmp_seq=5 ttl=55 time=58.070 ms
    64 bytes from 74.125.224.103: icmp_seq=6 ttl=55 time=33.335 ms
    64 bytes from 74.125.224.103: icmp_seq=7 ttl=55 time=33.361 ms
    64 bytes from 74.125.224.103: icmp_seq=8 ttl=55 time=36.099 ms
    64 bytes from 74.125.224.103: icmp_seq=9 ttl=55 time=41.111 ms
    --- google.com ping statistics ---
    10 packets transmitted, 10 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 19.053/36.811/58.070/9.939 ms

  • In the ReportDocument.Load method it tries to connect using the using the connection information embedded in the Report File

    Post Author: bhaveshbusa
    CA Forum: Crystal Reports
    In the ReportDocument.Load method it tries to connect using the using the connection information embedded in the Report File. When the application calls ReportDocument.Load(reportFileName). This
    tries to connect to the database using the connection information embedded in
    the "reportFileName". This was only realised on checking the ODBC Trace
    Log. The connection itself is not a problem. The problem is that the embedded
    connection information is related to OLD production system. And failed
    connections had raised some concerns.
    Note: I am using
    SetDataSource to populate the data for the report. So I don't need the
    connection.
    Is there any way I
    can disable this auto-connect?
    Thanks and
    regards,
    Bhavesh

    960738 wrote:
    I need a help in answering one of the issue encountered last week.
    I have created a database link and tried to access the information from a table using the program written in another language. The password provided was incorrect for that user while creating database link. So we expected that,while retrieving the data, Database connection has to be errored out as password provided is incorrrect.
    But unfortunately, user account was locked out. When i checked with DBAs they mentioned that it tries to connect 16 ports with in a min of time.we were shocked as it STOPS another scheduled jobs with that user. and affects production badly.
    As per the program, it has to connect only one time and yesterday we tried to execute the program in DBAs observation and it errored out as expected. Didn't tried for multiple ports.
    Now the question is, WHY the database connection established 16 times last week and caused user account locked. DBAs are unable to answer it. Any EXPERTs opinion on this would greatly appreciated.
    I have verified managing ports in oracle documentation, it was mentioned that if one port is busy it will try to connect to another port in the range of ports mentioned during the installtion. DBAs verified ports related file and it was blank. and they are not agreeing with this reason. Please HELP me in finding the correct REASON for this.
    is it a NETWORK issue or issue with DATABASE SERVER only?
    Thanks
    SSP
    Edited by: 960738 on Sep 22, 2012 9:13 PMDBLINK is 100% oblivious to the fact any port exists.
    DBLINK only contains username, password & TNS Alias.
    can you post actual SQL & results?

  • What does this message mean:  this apple ID has not yet been used in the iTunes store"? I cant connect using my iphone. But it works in iTunes on my laptop.

    what does this message mean:  this apple ID has not yet been used in the iTunes store"? I cant connect using my iphone. But it works in iTunes on my laptop.

    FAQ apple id http://support.apple.com/kb/HT5622?viewlocale=en_US
    http://support.apple.com/kb/HT1311

  • Anyone else having an issue with TCP connections using iCloud for Windows?

    Hi,
    Before I asked this question, I did wait to see if any related questions came up, but none did, so I submit it now.
    On my admittedly older laptop running Windows 7 64b Home, I've run into difficulties with the iCloud for Windows app to the extent that I had to uninstall it.
    It would that, as my laptop was running, in the background, iCloudServices.exe would endlessly iterate TCP connections, which, while not actively sending or receiving any data, after some hours would number over 100 instances, taking up resources, and grinding my laptop's WiFi connection to a grindingly slow pace. I ended up, within the app, turning off everything, iCloud Drive and Photos, (I never used bookmarks), but still this would continue to occur.
    I contacted Apple Support, explaining what was going on, and they stated they only dealt with IOS and gave me a Microsoft Support number. When I called Microsoft support, I came more and more to the realization that the issue was specifically with the iCloud for Windows app, as that was the only software that was endlessly creating and not closing TCP connections as it was. How was Microsoft supposed to solve an issue with Apple code?
    So I called Apple back, whereupon they insisted it was a Microsoft issue. I explained other cloud services installed on the same computer were not having the same issue, it was unique to ICloudServices.exe. They stated they only dealt with IOS. I stated I purchased an iPad Air less than 7 months ago, and was trying to run iCloud in support of that.  They again stated they only dealt with IOS, and suggested I again try Microsoft. I asked them if it was reasonable to expect Microsoft to solve issues with Apple code? They said regardless, there was zero support offered for anything having to do with Windows, and all I could do was uninstall the app, which I did, though that did not feel very satisfactory to me. My thinking is, if Apple writes a Windows app in support of their hardware, they should offer support for it.
    Anyway, I was just wondering, is this an issue unique to me? or have others experienced a similar issue? I found this issue by opening the Windows Resource Monitor, looking under the Networking tab, and scrolling through the TCP Connections section to find 100+ concurrent iCloudServices.exe instances listed, whereas even Chrome, with multiple tabs and extensions, topped out at around 20.
    My one month old Desktop, DYI, sports a solid Asus 1150 MoBo, i7-4790k cpu, 16GB Ram, and an EVGA GTX 970 video card. I list some specs only to illustrate this computer has no hardware issues in comparison to my long in tooth laptop. On this desktop, running Win 8.1 Pro 64b,  at least as many, identifiably Apple, background service TCP connections are created even compared to Chrome, regardless of many tabs being open, many extensions, and even some related apps. Adobe does not even come close, though I run the full CC subscription. On this new computer, running Windows 8.1 Pro 64b, there are currently over 50 TCP connections and loopbacks that do not identify themselves, with just a - for the Image, and PID. With the experience on my laptop, I wonder how many of these are generated by Apple software, if not specifically iCloud software?
    The frustrating aspect of these connections is they seem in no way active, While the Chrome and Adobe connections can be seen to be transferring data, as long as I am not running iTunes, or so have my iPad actually plugged in, it seems 99% of the time these iCloudServices.exe connections are just taking up ports, neither sending nor receiving any data discernable to me under the Processes with Network Activity, or Network Activity lists, both displayed in the same window as the TCP Connections in the Windows Resource Monitor.
    Though I am fairly ignorant as regards coding, it seems as if there is no call to close a connection, very specifically, iCloudServices.exe, when it is no longer needed, and the next time a connection is needed, a new one is opened, rather than accessing the one previously opened. The only other reason I could imagine this might be occurring is if my Norton Internet Security software might mask and/or block the port after a certain time of inactivity.
    Anyone out there have any ideas or advice about this? Thanks in advance.

    Thanks jared,
    I'm still dealing with this issue through Apple. Some time after I posted this, I contacted Apple again. They did start a case up for me, as I was experiencing the same behavior on two different machines, with two different versions of Windows.
    So far it remains unsolved. I've logged iClouds for Windows on my desktop, which is brand new, then logged for awhile after completely uninstalling Norton Security Suite, depending on the Microsoft security for some time, and finally logged after I uninstalled iCloud for Windows, restarted, installed a clean download, and connected using a completely different test account, which Apple set up for me. None of this made any difference. Looking at the logs, it seems every 10 minutes, iCloudServices.exe creates a new TCP connection to confirm I'm using less than 5GB on iCloud, (which I am by a good margin, using less than 2GB), it seems this connection is not closed, and when the next iteration rolls around 10 minutes later, a new TCP connection is created. I come very close to having 6 TCP connections created per hour, until I restart my computer. This works out to... 6 x 24 = 144/day.
    Perhaps the article you posted will shed some further light on this. I'm thinking seeing the state of the connection through netstats, at the least, could help.
    For the last week, I've been putting a hold on further logging, as Apple wants me to create a new user account on one of my computers, install iCloud for Windows there, and log it running in the other account. This however basically means I cannot use my computer for a fair number of hours, and I've been busy enough with work the past week that I haven't the time or energy to afford to set this up and run it. I've had need of my computers too much for the past week.

  • TS3274 How can I connect tv to ipad?  Want it to use netflex but will not connect using USB cable.

    How can I connect tv to ipad?  Want it to use netflex but will not connect using USB cable.

    http://store.apple.com/us/browse/home/shop_ipad/ipad_accessories/cables_docks
    You should find a solution here

  • Can airport extreme connect using a mac mini.  the base station is not recognized so i cannot configure it manually

    can airport extreme connect using a mac mini.  this airport extreme wont connect to internet via my cable modem.  I cant set it to bridge mode because it doesnt appear as a base station in airport utitlity...help

    First, is your AirPort Extreme Base Station (AEBS) a 802.11n, 802.11g, or 802.11b model? Second, what is your primary goal for using this base station? Finally, is the AEBS the only router in your current network configuration?

  • IOS 5 used to allow Airplay between iPad (WiFi) and Apple TV (Ethernet) as long as they were on the same network. In iOS 6, now both the iPad and the Apple TV have to be on the same network and both have to be connected using WiFi ? Why did they change ?

    iOS 5 used to allow Airplay between iPad (WiFi) and Apple TV (Ethernet) as long as they were on the same network, i.e. connected to the same wired/wireless router. In iOS 6, now both the iPad and the Apple TV have to be on the same network and both have to be connected using WiFi ? Why did they change this ? Means that the iPad and the Apple TV box both have to be in range of the wireless router when this wasn't a restriction before. Apple TV could be anywhere as long as it was connected to the same wireless router via ethernet cable. Seems like an unnecessary thing to restrict.

    I have found with AppleTV that it is the IPV6 on the computer you want to access is the problem.  The issue is that Homegroup on Win 7 or Win 8 requires IPV6 to work, but AppleTV won't work with IPV6.  (So maybe double check you have IPV6 turned off)
    So you have to make a choice - Homegroup or AppleTV.... but you can't have both, until Apple brings ATV up to date. (crazy that it does not recognise IPV6 - c'mon Apple!)
    You can set up sharing individually in Win 7 or 8 and have the ATV access files that way.
    Having said that, there is always the exception.. I have an old HP home server running Win8 and it services ATV - but is part of the Homegroup... have no idea why it works on both, but no other machine on the home network will talk to both ATV and Homegroup at the same time!

Maybe you are looking for

  • Can't drag and drop files into Attachments while in Administrator mode

    I can drag and drop files into attachment easily when I'm not in Administrator mode. But I need to be in Administrator mode at work and therefore for some reason I cannot drag and drop files into attachments; I'm forced to manually search and select

  • Applying Patches to WebLogic Server 9.2

    Can anyone help me out here. I have an AIX platform (5.3) and have WebLogic 9.2 installed and want to apply the latest patches. However when I try to use the bsu command it obviously wants to run up the GUI, which we do not have access to due to an X

  • Exchange 2007 - The server don't send dsn message for external users

    Hello, Our exchange 2007doesn't send dsn message for external users but for internals it is ok, I check my configuration but all seems to be ok Have you any idea please? Thx

  • My MacBook Pro does not connect wirelessly to new BT homeHub 5

    I have been able to connect my iPad and iPhone to the new hub, but not my MacBook Pro. The wireless key password keeps being rejected as invalid, although it is correct. I have called both BT and Apple support and have tried options such as resetting

  • Summing time in ABAP

    Hi Everyone, My requirement is something like this... Consider an employee is entering his time schedule on an hourly basis, I am fetching these into an internal table but when iam fetching i need to sum all the time and display total time he has wor