Retrieve Database Tables?

I am building a JTree from my database. The first node is the Database, the table names as subnodes, and the column names as subnodes for each table. The problem, is that I don't understand the architecture for retrieving the table names. This is what I would like to happen:
        try {
            Class.forName(className);
            Connection conn = DriverManager.getConnection(URL + options,username,password);
            String dbName = conn.getCatalog();
            DefaultMutableTreeNode top = new DefaultMutableTreeNode(dbName);
            tree = new JTree(top);
            DatabaseMetaData dmd = conn.getMetaData();
            ResultSet rs = dmd.  //return Tables
            ResultSetMetaData rsmd = rs.getMetaData();
            int tableCount = rsmd. //getTableCount();
            String[] tableNames = new String[tableCount];
            DefaultMutableTreeNode category = null;
            for(int i=0;i<tableCount;i++){
                tableNames=rsmd. //getTableName(i+1);
category = new DefaultMutableTreeNode(tableNames[i]);
top.add(category);
conn.close();
I know there is a ResultSet as follows: DatabaseMetaData dmd = conn.getMetaData();
ResultSet rs = dmd.getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) But I don't understand this and would appreciate some clarification.
Thanks

Different DBMS softwares provide different ways to retrive meta data.
I cant give you specific information unless you tell us what is the DBMS software that you want to access.
If you want to write a genaric tool to work with all the DBMSs you will have to write different logic for different softwares and some time for different versions of same software.
Ex:- MySQL changed its meta data providing method in version 5

Similar Messages

  • How to retrieve deleted entries of a database table

    Hi,
    I accedentally deleted database table from se14.
    how to retreive the table of entries.
    regards ,
    Rajesh

    you did not assigned any point to any one i guess... its not how we thanks to an answer on sdn community. (whether it had helped u solve ur problem or a concrete answer with not possible)
    But i am pretty much sure you can restore from ur latest backup and you could get your table along with data. in case u are not still gatting it. then probably you need to restore DB strcuture first (i know in AIX OS you can make a copy of DB structure using MKSYS command ) which will create structure of database and then you can restore the same backup which we are talking about using restore procedure.
    Mandeep

  • How to input data in a database table without knowing in advance table and column configurations

    Hi,
    I have a problem using LabVIEW for input data (manually) in a SQL database. I have about 40 tables in the database, each of them is related to a specific engine component. I need to create a user interface (maybe visualizing the table with a table control) where the users can insert data in the database table fields. Could someone give me some suggestion on how to do it?
    Using the  DB tools insert data.vi I need to know in advance the column configuration of the table, but in my database each table has its own structure! So do I have to create 40 different masks, one for every different table?
    Thanks in advance.
    Michela

    I have not actually used the LV SQL Toolkit, but I will try and offer high level ideas :-)
    when you have retrieved the construction data for a table, you should be able to use array and cluster indexing to aquire the names of the fieds, enough to create a labelled table on the LV Front panel.
    After completing a new entry you can INSERT the entry into the database using the same data.
    Is the SQL toolkit an additional purchase, or included in newer versions as standard? If you post a sample of the cluster/array that you retrieve, I could give you a sample VI to give you some pointers in creating the User Interface table 
    - Cheers, Ed

  • Issue with fields of a database table

    Hi All,
    While browsing through database table T2515, i have observed that in 'fields' tab, there are only 2 fields visible ie MANDT and WWSSN.
    When we see the contents of table, there will be one more additional field called BEZTEK.
    Now my requirement is to retrieve data from both WWSSN and BEZTEK fields.
    How to define internal table and how to write select statement in such cases?
    Moreover, from where this BEZTEK will get populate, when we see the contents of table in se11?
    Regards
    Pavan

    Hi,
    BEZTEK may be coming from the Text table related to T2515.  See the text table of T2515 (SE11 -> Menu option Goto -> Text Table).
    Regards
    Vinod

  • Parsing code from a database table

    Hi,
    How do I output / parse / evaluate HTML and CF code stored in
    a database table? For example, I have the following query which
    retrieves some HTML and CF code:
    <cfquery datasource="MyDatasource" name="GetEmailCode">
    select Mail_Content
    from Message_Table
    </cfquery>
    <cfset Subject = "Test email subject...">
    <cfset Message="Test email body message....">
    Then I have:
    <cfoutput query="GetEmailCode">
    E-mail message:<br>
    #Trim(Mail_Content)#
    </cfoutput>
    The actual content of #Trim(Mail_Content)# is:
    <TABLE WIDTH="750" BORDER="0" CELLPADDING="0"
    CELLSPACING="0" ALIGN="center">
    <TR>
    <TD ALIGN="center">
    <TABLE WIDTH="100%" BORDER="0" CELLPADDING="5"
    CELLSPACING="0">
    <TR>
    <TD ALIGN="left" BGCOLOR="tan">
    <B>#Trim(Subject)#</B>
    </TD>
    </TR>
    <TR>
    <TD ALIGN="left" BGCOLOR="aliceblue">
    #Trim(Message)#
    </TD>
    </TR>
    </TABLE>
    </TD>
    </TR>
    </TABLE>
    But the output of GetEmailCode displays #Trim(Subject)# and
    #Trim(Message)# as is. In other words, it's not outputing the
    actual value of Subject and Message which are "Test email
    subject..." and "Test email body message...."
    How do I output and parse the code correctly? I've tried the
    following, but it gives me an error:
    <cfoutput query="GetEmailCode">
    E-mail message:<br>
    #Trim(Evaluate(Mail_Content))#
    </cfoutput>
    Any help/suggestiong is greatly appreciated.
    Thanks in advance!!!

    I was looking for something like this last week, thanks for
    posting your own answer instead of just saying "nevermind, I
    figured it out" and leaving all to wonder what the solution
    was...

  • Saving session state in database table rather in websever for Ordering App

    Hi all,
    Ours is a ordering application (telecomm) domain.
    Currently, we are storing user sessions data (Order shopping cart session data) in middle tier (iPlanet web server) which inturn consumes lot of memory resources.
    Shopping cart could be in MBs if order is a huge business order.
    So in order to not to overtax web server (middle tier), we are thinking of storing session data directly in a database table to relieve the overhead on web server and make use of database for storage.
    I read that APEX (html db) is already using this "single metadata table" approach for session data management. But we are not using HTML DB to really look into.
    Can some one advise how to go about storing "user session data" directly in a "database table" for both storage and retrieval purposes instead of storing it in "webserver".
    How does this "metadata table" structure looks like. Is it more generic ?
    Really appreciate your time and help/suggestions.

    Joel,
    Thanks for your response. sorry, i meant to say that "the current application does not use APEX but will look into it".
    To build this is an utterly non-trivial exercise. Oh - it may not be so hard to save session state to a table when you POST a page. But you may want to reference this in many places, and it's a question of can you change all of these references to indirect references from session state in your application.In order to free up the load on webserver, we want to maintain session management in database. Could you please explain the above little more :
    How do we maintain the "user session" with "database table" ?
    Do we need to store "session data" at java object level or by page in database table ? How does the structure of this "metadata table" looks like.
    Thanks for your time.

  • Forms 6i Database Tables

    Hi there: I have installed Forms 6i Database Tables and I am able to save and retrieve forms to and from the database. Any of you have the catalog of these Forms Tables? Do you the names of the tables storing blocks, canvas, items, etc?
    In Forms4.5 it is very easy because I have a table for blocks and for many other items of the form, but it seems to be hidden in forms 6i.
    Any help would be greatly appreciated.
    Regards

    I don't think there is any description of the tables other than what you can get from the CREATE TABLE scripts.
    PS. Are you sure you still want to go the route of storing the Forms in the database. Be advised that this feature was dropped from later versions. So if you're ever going to upgrade to a later version you will have to extract all of them from the database anyhow.
    PS2. If you want to "analyze" the Forms, I personally use the Forms to XML conversion available in Forms 10gR1, 10gR2 (and perhaps 9i). This converts your FMB to a very readable XML file which you can use for analysis. It could be an option to convert the 6i FMB file to XML with a newer version of Oracle Forms. Be sure that the batch file does not save the existing FMB as it would upgrade it to a new file format and you could not open it with Forms 6i any more. Take a backup first.

  • JSF and Database tables in the pages...

    Hi guys,
    I am following this excellent tutorial http://www.oracle.com/technology/oramag/oracle/06-jan/o16jsf.html as I am learning JSF using JDeveloper. Unfortunately since my knowledge of JDeveloper and JSF being rather limited, there is one section in the tutorial that I am unable to understand. If you do a search on that web page and type in 'column1' without the quotes, I am unable to understand where the author got that object from.
    Barring that I also had another question. I just saw a demo video of Netbeans taking the Entity beans generated from the database tables and creating JSF pages based on the tables with one click that showed the data very nicely in a table format in the jsp page. Is there some sort of functionality like that? Or is that JEE 5 specific? Also is JDeveloper JEE 5 compliant as of yet?
    Sorry for the laundry list of questions.
    Surya

    Before I make an even bigger fool of myself in this forum, the tutorial has 2 parts. Does part 2 depend on part 1 to get it working right because I feel as if I am missing something.
    Also it seems that for however many columns we are able to retrieve from our ResultSet we should know beforehand so we can code up the DataTable. This might not be the case all the time I guess, so is that where the JSF support in the ADF framework comes in and makes life a lot easier for the developer?
    Thanks for answering all my questions.
    Surya

  • Import  data in excel to database table

    How to insert data from excel to database table ? any suggestion ?

    Hi,
    1. Save your file as csv (say having empno, ename, sal and deptno columns).
    2. Create a HTML page with file browse item.
    3. Create a button.
    3. Create the following process to be executed on pressing button on your region.
    BEGIN
    DECLARE
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_raw_chunk RAW(10000);
    v_char CHAR(1);
    c_chunk_len number := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array wwv_flow_global.vc_arr2;
    v_rows number;
    v_sr_no number := 1;
    v_rows_loaded NUMBER;
    BEGIN
    -- Read data from wwv_flow_files</span>
    select blob_content into v_blob_data
    from wwv_flow_files
    where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER)
    and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
    v_blob_len := dbms_lob.getlength(v_blob_data);
    v_position := 1;
    -- Read and convert binary to char</span>
    WHILE ( v_position <= v_blob_len ) LOOP
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
    v_line := v_line || v_char;
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved </span>
    IF v_char = CHR(10) THEN
    -- Convert comma to : to use wwv_flow_utilities </span>
    v_line := REPLACE (v_line, ',', ':');
    -- Convert each column separated by : into array of data </span>
    v_data_array := wwv_flow_utilities.string_to_table (v_line);
    --DELETE OLD DATA
    -- Insert data into target table </span>
    IF v_sr_no >1 THEN
    EXECUTE IMMEDIATE 'INSERT INTO EMP(EMPNO, ENAME, SAL, DEPTNO)
    VALUES (:1, :2, :3, :4)'
    USING
    -- v_sr_no,
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4);
    END IF;
    -- Clear out
    v_line := NULL;
    v_sr_no := v_sr_no + 1;
    END IF;
    END LOOP;
    END;
    COMMIT;
    END;
    Hope this helps.
    Regards,
    Zahid

  • Save More than 1000 chars in a field of (Z) Database Table?

    Hi Friends,
    I created a database table with few fields. In the table, one field is REMARKS which should save more than 1000 characters for every record. For that field,  I created domain & data element of char with 2000 length. But system gives an error representing that "Should not be more than 255 chars ".
    Even, select statement is also retrieving 132 chars only, if remarks are less than 255 and greater than 150 chars.
    Could you please provide me solution?
    Thanks
    Sarayu

    Hi,
    The Most simple solution for it can be that Divide the field REMARKS of size 1000 in multiples of 200 characters like REMARK1, REMARK2....REMARKn.
    Now you can create two FMs :
    zset_data:  To Store 1000 char long data in Table
    Here you will divide the data of Variable (type char1024) in multiples of 200 and will store in REMARK1, REMARK2.....
    zget_data: To Get 1000 char long data back from Table
    Here you will concatenate REMARK1, REMARK2..... and will store in Variable of Type char1024.
    This is the best solution if Table is not going to be maintained by Table Maintenance Generator.
    Thanks
    Ajay

  • How to query a sql database table from webdynpro?

    Hi All,
    Can someone tell me the steps involved in accessing a sql server database table and retrieving the record set from a webdynpro application.
    Thanks in advance.
    Best regards,
    Divya

    Hello Divya,
    I would recommend you to read "Java Persistence" section in Development manual describing various options for database integration http://help.sap.com/saphelp_nw04/helpdata/en/61/fdbc3d16f39e33e10000000a11405a/frameset.htm
    Tutorials
    http://help.sap.com/saphelp_nw04/helpdata/en/46/ddc4705e911f43a611840d8decb5f6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/91/9c2226df76f64fa7783dcaa4534395/frameset.htm
    Web serices
    http://help.sap.com/saphelp_nw04/helpdata/en/d6/f9bc3d52f39d33e10000000a11405a/frameset.htm
    EJB
    http://help.sap.com/saphelp_nw04/helpdata/en/19/f9bc3d8af79633e10000000a11405a/frameset.htm
    Best regards, Maksim Rashchynski.

  • Which database table store page names?

    Hi, I'm trying to retrieve the corresponding page name based on the NAME column from the OWA_PERF.TOP_PAGE_BYDAY table. I've tried to get the value from RTAL.WWPOB_PAGE$ using SITE_ID and ID, but it returns duplicates records with the same name. May I know which database table actually stores the specific page names without repeats?

    Sorry. there was a small mistake in my previous post. Here is the updated one:
    Hi, I'm trying to retrieve the corresponding page name based on the NAME column from the OWA_PERF.TOP_PAGE_BYDAY table. I've tried to get the value from PORTAL.WWPOB_PAGE$ using SITE_ID and ID (which is the first two parts of the NAME value), but it returns duplicates records with the same name. May I know which database table actually stores the specific page names without repeats?

  • Reading infotype 2050 ( No database table )

    Hi to all experts,
    I have a requirement to display the details exactly as in infotype 2050. When you check 2050 how it is displayed the annual calender i need to display exactly as it is .I tried using LDB, Macro, FM but the database table for 2050 doesnt exist.The p2050 is there but there is no pa2050. There is no underlying database table for that infotype 2050 (annual calender display). 
    I check some related fm
    like  module      HR_PERSONAL_WORK_SCHEDULE
    any information regarding this will be greatly appreciated.
    THanks

    Actually this information is retrieved based on the data of Planned Working Time, Infotype (0007) and Absences, Attendances and Substitutions (2001, 2002, 2003), there's no specific Infotype DB Table.
    You were using the Correct FM to read the Employee's work schedule (Relevant data is retrieved in PERWS parameter)
        CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'               "XOQK064687
             EXPORTING                                          "XOQK064687
                  PERNR             = PSPAR-PERNR               "XOQK064687
                  BEGDA             = FIA_BEGDA                 "XOQK064687
                  ENDDA             = FIA_ENDDA                 "XOQK064687
                  SWITCH_ACTIV      = 1                         "XOQK064687
                  READ_CLUSTER      = READ_CLUSTER            "YMMAHRK037395
             TABLES                                             "XOQK064687
                  I0000             = M0000                     "XOQK064687
                  I0001             = M0001                     "XOQK064687
                  I0002             = M0002                     "XOQK064687
                  I0007             = M0007                     "XOQK064687
                  I2001             = M2001                     "XOQK064687
                  I2002             = M2002                     "XOQK064687
                  I2003             = M2003                     "XOQK064687
                  PERWS             = PSP2050                   "XOQK064687
             EXCEPTIONS                                         "XOQK064687
                  ERROR_OCCURED     = 1                         "XOQK064687
                  ABORT_OCCURED     = 2                         "XOQK064687
                  OTHERS            = 3.                        "XOQK064687
    If you need to do something similar you'll have to check the IT2050 code

  • Adobe Forms - Table control data Saved in Database table through Web Dynpro

    Hello Friends,
    I Am facing a Problem in Adobe Forms through Web Dynpro.
    i Want to Make Interactive online Adobe Forms - In Table Control user enter the multiple entry in the table control and after that Click on SAVE button , entry will saved in Database table.
    Please guide me.
    Thanks in advance.
    Gaurav.

    Hi Gaurabh,
    For interactive form you have to check the property DisplayType = native and PdfSource should be a Context Attribute of type 'Xstring'.
    For data retrieval, create a NODE and have all the required attributes within that node of AOBE form.
    Fetch the data in WDDOINIT.
    Also check, that the offline senario for this form is working.
    Hope it helps you.

  • Reg: How to see Database tables in any Datasource?

    Hi Friends,
    Please give me answer to see Database tables in any Datasource.
    Thanks,
    Rama

    Hi,
    I dont think there is any Tcode for this.
    Try either of this.
    Go to RSA2 (DS Repository) in your source system and display your source system.
    If Extraction Method is 'V' - you are lucky and you see table name where data is taken from.
    If it is F* - function module is used, and you have to go thru its code to see all the tables it uses and logic how data is
    processed.
    Ext. Meth   Short text                                                                               
    V                 Transparent Table or DB View                
    D                  Fixed Domain Value                          
    F1                Function Module (Complete Interface)        
    F2                Function Module (Simple Interface)          
    Q                 Extraction Using ABAP Query                 
    A                 DataSource Append                           
    OR
    Since you have the extract structure and the extractor, you can try Extractor Checker RSA3.Execute ST05 (activating SQL Trace), switch on the trace and execute the extractor checker. Once the extractor checker presents the results
    switch off trace. The clcik on Display trace and you will see all the tables that were hit by the extractor checker to retrieve data and present it to you.
    Note: Set the break point in the Extractor Function module.
    View the ST05 Extended Trace list. The Object name shows the Tables accessed.
    Hope this helps.
    Thanks,
    JituK

Maybe you are looking for

  • Can iPhoto access its Photo Library if it is located on an external hard drive?

    I have a MacBook (white, about 4 years old) and the hard drive is full, mostly of photos my iPhoto Library file is huge and I have two young children so I am taking lots of photos and will be taking more of course but I can't fit them on my computer

  • How to transfer photo from iphone to imac

    How can i transfer photo from my iphone to my imac? thanks

  • Ipod freeze unexpectingly and video problems

    I have the older version of a 60 gb video ipod. Everytime my battery reaches halfway, my ipod freezes. Then after like 15 minutes, it shuts off. After it shuts off, it won't turn back on. After an hour later, I would try to turn it back on and it wou

  • Files keep locking themselves in CS4?

    Hi Just installed Snow Lepeard with CS4 and whenever im saving over or saving as, i keep getting the message that the file is locked and i need to unlock it to save over it"? This is sending me nuts, does anyone know how to stop it? All files are on

  • ITunes plays in Background

    Since upgrading to iOS 7.0.2 my phone will start playing itunes in the background if I answer the phone while connected to my car hands free.  Is this happening to anyone else, and what has been your solution?