How can I interact with a Database?

I've got a project I'm working on in my Java class, and I can't find out how to make the program interact with a database. I was wondering if anybody here could help me out at all? My partners and I have already gotten most of the program figured out (but not programmed), and this is giving us a little bit of trouble. Our books don't have this information, and our teacher told us to check here, so here I am. Any help would be appreciated. Thanks.

You need to get a jdbc driver for your database. Your vendor should provide you with one. If not then you can try looking for free implementations of that particular database.
This jdbc driver is used by your program to execute sql statements in the database itself, removing the need for you to handle all the nitty gritty stuff. Kind of like ODBC.
Like the earlier post pointed out, the tutorials is a good place to look at code samples
I've got a project I'm working on in my Java class,
and I can't find out how to make the program interact
with a database. I was wondering if anybody here
could help me out at all? My partners and I have
already gotten most of the program figured out (but
not programmed), and this is giving us a little bit of
trouble. Our books don't have this information, and
our teacher told us to check here, so here I am. Any
help would be appreciated. Thanks.

Similar Messages

  • How can i interact with the ALV if i am using the lvc_ and call method?

    i want to hide the last entry of a line when i click on the checbox of my ALV

    u want to hide or delete?
    instead of using check box, u can use a button to display there.
    it can be achived like below.
    data: ls_lvclayout type lvc_s_layo.
    LS_LVCLAYOUT-SEL_MODE = 'D'.
    now in set_table for_first_diaplay
    CALL METHOD GO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
          <b>  IS_LAYOUT            = LS_LVCLAYOUT</b>
    do like above.
    then u click on the row, and the row will be selected.
    now using the method GET_SELECTED_ROWS, u can get the data of the selected row and u can now manipulate what ever u needed.
    data:
    SEL_ROW TYPE LVC_S_ROID,
    SEL_T_ROW TYPE LVC_T_ROID.
    CALL METHOD GO_GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_ROW_NO = SEL_T_ROW.
    LOOP AT SEL_T_ROW INTO SEL_ROW.
              read table <itab> index SEL_ROW-ROW_ID.
              check sy-subrc = 0.
    < now write the logic  like making the field blank and modify the itab>.       
            ENDLOOP.

  • How to interact with external database in CQ5

    Hi,
    I need to interact with external database like SQL or Oracle to store some/fetch some data in CQ5. Can someone pls provide some help regarding the same. I guess I need to do it through JDBC. Please guide me step by step how to do this.
    Thanks

    Hi,
    Bellow you find some references to the documentation related to CQ and DB configuration and developments:
    http://dev.day.com/docs/en/cq/current/developing/jdbc.html
    https://helpx.adobe.com/cq/kb/HowToConfigureSlingDatasource.html
    Regards,
    kasq

  • Can oracle database interact with sysbase database in real-time?

    There are two database,one is oracle,one is sysbase,sysbase is produce database.My program only can visit oracle database,and can't directly visit sysbase database.My question is whether there is a directly link from oracle database to sysbase database,when I visit oracle,oracle database can interact with sysbase database through this link real time? How to realize above function? Please give plan for it.
    Thanks in advance!
    Best regards,
    Edward

    Yes there is. You have to create heterogeneous connection between these two databases
    Take a look at below links:
    http://www.dba-oracle.com/t_heterogeneous_database_connections_sql_server.htm
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:13401716754850
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96571/repmultdemo.htm

  • How can I connect to a database from ipaq with cldc??

    how can I connect to a database from ipaq with cldc??

    Hi Again
    There is a library by Mimer which allows you do connect to a Mimer SQL Server, don't know must about it, but here is a link.
    http://developer.mimer.com/
    If that doesn't suit you, I suspect that you will have to use some sort of proxy solution. Either by creating a servlet to accept the sql string you want to send, or by creating your own custom proxy server running J2EE. The servlet or the proxy server must be able to receive an SQL String, do the query to the actual database and return the results in some sort of format to the mobile device. Maybe just a space delimited string.
    Hope this helps
    -Daur

  • How can I compact a MSAccess database with java?

    Hi.
    I have a question (Please Help!!!):
    How can I compact a MSAccess database with java-jdbc? Is it posible?
    Thanks

    MS Access database has a max length limitation of 2.14GB for Access 2000( 1.07G for Access 97), and won't recycle basically space for update/delete sql so tha it's a good idea to use MS Access database for program, which need update/delete frequent ly data. The programmers of HXTT Access(www.hxtt.net) are writing code for CREATE TABLE/DATABASE sql now. If you need a pure Java solution for PACK TABLE/DATABSE urgently in your project, you should send such a requirement to the Support page of www.hxtt.net so that they can schedule complementing such a fucntion. Otherwise, you should pack your databae manually or visit C++ code for Compact an Access Database Programmatically at
    http://www.codeguru.com/Cpp/data/mfc_database/microsoftaccess/article.php/c4327/ , or use Easy Microsoft Access MDB MDE Compactor at http://www.easyhr.com.au/software/easy_mdb_mde_compactor.htm.

  • I have taken pictures of items that are linked to a database that I am building.  How can I bypass importing into iPhoto and simply downloading the images as "files" not "photos" so I can access them with my database?  thanx.

    I have taken pictures with both my Sony camera and my iPhone of items that are linked to a database that I am building, as well as my website.  How can I bypass importing the images into iPhoto and simply downloading the images as "files" not "photos" so I can access them with my database?  thanx.

    If your Sony has a removable memory card you can use a card reader to copy the image files from to a folder on your Desktop and then move them anywhere you'd like.
    Since the iPhone doesn't have a removable memory card you can try using Image Capture to see if you can manually upload the files to a folder on the Desktop. 
    If you have to import the photos, which are image files, into iPhoto you can then export them out of iPhoto to the Desktop and go from there to your database.  Just because they are in iPhoto doesn't prevent you from using them elsewhere.
    OT

  • How should devs interact with the db?

    Good day. For some time my organization has worked as most small shops do: web and software developers log into the database and create their own views, procs, etc. However we have grown to a much larger staff and have begun the process of transitioning into a more "professional" shop.
    In your experience, how should web/software developers (and their products) interact with the production database? In other words, should they send their views to the DBA who will create said views? Or should they not be connecting to views at all? Should they have their own schema on the production database (and this will be the one which holds their views)?
    If you say that the developers should have absolutely no access to the production db at all, then how should their products interact with the database?
    I appreciate any links, advice, etc.
    Thank you.
    EDIT: the developers products are about 75% read-only search/reporting apps and 25% data entry.
    Edited by: 893968 on Oct 12, 2012 8:39 AM

    893968 wrote:
    Good day. For some time my organization has worked as most small shops do: web and software developers log into the database and create their own views, procs, etc. However we have grown to a much larger staff and have begun the process of transitioning into a more "professional" shop.
    In your experience, how should web/software developers (and their products) interact with the production database? In other words, should they send their views to the DBA who will create said views? Or should they not be connecting to views at all? Should they have their own schema on the production database (and this will be the one which holds their views)?
    If you say that the developers should have absolutely no access to the production db at all, then how should their products interact with the database?
    I appreciate any links, advice, etc.
    Thank you.
    EDIT: the developers products are about 75% read-only search/reporting apps and 25% data entry.
    Edited by: 893968 on Oct 12, 2012 8:39 AMThink about this. The earlier in the process that the DBA becomes a reviewer/gatekeeper, the earlier in the process you can eliminate bad design decisions. Bad design decisions can be any of the following and more:
    wrong data types
    badly normalized tables
    use of reserved or key words for object/table/column names
    reinventing wheel (especially common when needing a sequence number)
    object names that make no sense and fit no pattern.
    I'm sure others will chime in with more.
    The point being, if you allow developers the 'create' privilege at any level, they will create things that will become a headache for you further down the road. Let them write queries and procedures ... that's their job. But not tables, indexes, sequences, etc.
    And don't fall for "it's just dev, we can clean it up when we move to QA". No, they won't. At the time it moves to QA it will be "we've got too much invested in this, we can't afford to make those changes now." And regardless of what was agreed to six months earlier, management will side with the developers because they really can't afford to pay for the re-work that would have been avoided in the first place with proper division of responsibility.
    It will be a painful process to bring about. Someone will have to stand firm. And there will always be low-level complaints, but it still comes back to 'if you don't have time to do it right the first time, when will you find time to fix it later?" It's part of the DBA's job to make sure it gets done right the first time, and he will need management support to maintain it.

  • How can I deal with long sql by the oo4o?

    I am using VB and oo4o to develop a sql executor which is a extention of an old system.
    For some reason, I have to use oo4o v8.1.7 to deal with Oracle Database 8i to 11g.
    But when I send a very long sql(11KB) to it I got a error in the VB enviroment.
    The Err.Description is "automention error. Started object is disconnected by the client.".
    The Err.Number is "-2147417848 ".
    The sql that I send it to the program is a simple select sql that like select a, b, c, substrb(d, 1, 2), substrb(e, 2, 3) .... from A_TBL where A=aa;
    This sql is normally executed by the sqlplus but I got an error by the oo4o.
    When I insert a '' between the 30Xth items, it got exectuted normally.
    ex. select a, b, c, substrb(d, 1, 2), substrb(e, 1, 2) ..... substrb(303th, 3, 4), '', substrb(304th, 1, 2) ... from A_TBL where A = aa;
    How can I deal with this problem? Thanks.

    So how can use this function correctly?By learning what exceptions are, how they're used, and what you can do to deal with them. There's a tutorial here: http://java.sun.com/docs/books/tutorial/essential/exceptions/index.htmlAnd here's a quick overview:
    The base class for all exceptions is Throwable. Java provides Exception and Error that extend Throwable. RuntimeException (and many others) extend Exception.
    RuntimeException and its descendants, and Error and its descendants, are called unchecked exceptions. Everything else is a checked exception.
    If your method, or any method it calls, can throw a checked exception, then your method must either catch that exception, or declare that your method throws that exception. This way, when I call your method, I know at compile time what can possibly go wrong and I can decide whether to handle it or just bubble it up to my caller. Catching a given exception also catches all that exception's descendants. Declaring that you throw a given exception means that you might throw that exception or any of its descendants.
    Unchecked exceptions (RuntimeException, Error, and their descendants) are not subject to those restrictions. Any method can throw any unchecked exception at any time without declaring it. This is because unchecked exceptions are either the sign of a coding error (RuntimeException), which is totally preventable and should be fixed rather than handled by the code that encounters it, or a problem in the VM, which in general can not be predicted or handled.

  • How can I reuse the BC4J database connection?

    How can I reuse the BC4J database connection?
    I want to use the application module connection without opening another in a custom code. At this level I can’t access de ADF code, that’s why I can’t get the DBConnection from the application module.
    Now, I have a “data-sources.xml” in my project and the application module is configured to access the database from this xml file.

    I found the solution in other Forum. I worked ok.
    Here the code:
    If the Connections-Navigator connection is DBConnection1, the corresponding datasource is jdbc/DBConnection1DS.
    1. Create a JSP page.
    2. In the web.xml of the JSP add
    <resource-ref>
    <res-ref-name>jdbc/DBConnection1DS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    3. In the JSP page obtain a connection with the datasource.
    InitialContext initialContext = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup("java:comp/env/jdbc/DBConnection1DS");
    java.sql.Connection conn = ds.getConnection();

  • How can scan directly with webcenter content

    how can directly scan with webcenter content without other software for scanner
    tnx

    Hi,
    If you are referring to not using ODC/ODDC kind of software which has drivers to connect to Webcenter Content then following is what I can think of:
    1. Have your scanner drop the scanned images to a shared folder
    2. Have a standalone Java program to checkin the scanned images to Webcenter Content using RIDC API calls
    3. Access what set of metadata you want to set on the content, advice you set most of the general metadata on the folder so the content inherits them
    4. If the metadata is available in a database then you could use the Java program to look up to this DB for metadata which performing the checkin
    Regards,
    - Anand

  • Can VC interact with Portal session

    Hi Experts,
         Currently, I need to get portal user id from the http session, so how does VC interact with session object? 
        Thanks!

    HI,
    it could be better , if you explain the kind of application you want to do.
    even if you developing the simple application, you can access the user id .
    by the following steps
    1) Place the user data on the view
    2) Place the Text View UI control on the form
    3) set the text view UI control default value = USER@UNIQUEID
    and run the application
    Regards
    Srinivas

  • How does Openscript Interact with web components ?

    I was wondering how does openscript interact with web objects (eg Edit boxes, buttons), is it through some JNI api ? If yes in which package I can find this ?

    I am going to make the assumption from your comments that you are asking about using OpenScript to test applications based on Apple's WebObjects server. If that is a bad assumption let me know ...
    The scripts you build against the application will work in a similar manner to those that are built against other java based application servers in that the tool will be using the various key attributes of the html objects to locate them and replicate actions against them. Typical UI driven scripting ... That said, if your testing brings you down a level from the UI and you are trying to test some of the components of the application server tier specifically, well, then you might have to write your own java code to do it.

  • How can I print with the black and white cartridge only?

    I am trying to print using the black and white cartridge only because magenta is out of ink but I'm getting the following error message in HP Photosmart C7200 series print dialog:
    The printer is out of ink.
    The following ink cartridges are empty: Magenta. Replace these ink cartridges to resume printing.
    How can I print with the black and white cartridge only?
    Mac OSX 10.7.3
    HP Photosmart C7280 (7200 series)
    This question was solved.
    View Solution.

    I am absolutely disgusted by this; clearly a scam from HP to make more money by selling extra ink cartridges!!  I will make sure to never buy any products from the shoddy rip off merchants at HP ever again!!
    You should be ashamed!!

  • I can't download from app store apps. if i try then open account and ask me shange payment type because there is a billing problem with a previous purchase. I download one game 0.99 and nothing more! help me. How can i contact with apple?

    I can't download from app store apps. if i try then open account and ask me shange payment type because there is a billing problem with a previous purchase. I download one game 0.99 and nothing more! help me. How can i contact with apple?

    Click here and ask the iTunes Store staff for assistance.
    (102938)

Maybe you are looking for