Getting problem when retriving Table name

Hi,
I'm having problem when i trying to get the table name from database. I'm using NetBeans 6.0, And It does n't show any error during compile and run time. I could n't find where the problem is?
Code:_
DatabaseMetaData dbm=conn.getMetaData();
String[] types={"TABLES"};
ResultSet rs=dbm.getTables("%","%","%",types);
System.out.println("TableName:");
while(rs.next())
String tableName=rs.getString("TABLE_NAME");
String tableSchema=rs.getString("TABLE_SCHEM");
String tableCatalog=rs.getString("TABLE_CAT");
System.out.println(tableName);
conn.close();
System.out.println("Disconnected from database");
Output is:_
MySQL Connect Example.
TableName:
BUILD SUCCESSFUL
Regds,
Prabu
Edited by: [email protected] on Apr 16, 2008 12:32 PM

Why did you repost? Don't do this, it is extremely rude!
Stick with your other thread. I just gave you what I believe to be the correct answer.
[Original Post|http://forum.java.sun.com/thread.jspa?threadID=5286520&tstart=0]

Similar Messages

  • How to retrive table names with Java?

    Hello!
    If I connect to my Oracle Database 10g Express Edition Instance with some Java code and I run the following code:
                   ResultSet resultSet = databaseMetaData.getTables(null, null, "%", types);
                   while( resultSet.next() )
                        String tableName = resultSet.getString(3);
                        System.out.println(tableName);
    I get loads of different names of tables beside those that belongs to my user like:
    DR$NUMBER_SEQUENCE
    DR$OBJECT_ATTRIBUTE
    DR$POLICY_TAB
    ARTICLES
    BIN$tQZXQ0iGufbgQAB/AQELFg==$0
    BIN$tQZXQ0iLufbgQAB/AQELFg==$0
    But when I log in to http://127.0.0.1:9090/apex I get a perfect list of the tables belonging to the user:
    ARTICLES
    CUSTOMERS
    DATATYPES
    ORDERROWS
    ORDERS
    REQUESTROWS
    REQUESTS
    SUPPLIERROWS
    SUPPLIERS
    Does any one understand how to access just these table names that is created with my user?
    Best regards
    Fredrik

    Hello Adrian!
    Yes you are right I now understand that this is the wrong forum.
    So I posted the "same question" at:
    How to retrive table names belonging only to a user?
    How ever I seems to have problem with the schema name parameter any way.
    Best regards
    Fredrik

  • internal error problem when writing table:

    Hi,
    When my user try to access BEx queries, he is getting the following pop up messages
    <internal error> problem when writing table: C_T_VARIABLES
    <internal error> problem when writing table: E_T_DIM
    <internal error> problem when writing table: E_T_MEM
    <internal error> problem when writing table: E_T_ATR
    <internal error> problem when writing table: E_T_PRPTYS
    <internal error> problem when writing table: C_T_HRY_TYPES
    <internal error> problem when writing table: E_T_CEL
    <internal error> problem when writing table: E_T_FAC
    <internal error> problem when writing table: E_T_CON
    <internal error> problem when writing table: E_T_DRILL
    and then report is getting diplayed. and when user try to edit properties again same pop up messages are coming.
    when I access queries from my machine those are working fine..
    Can some one help me to solve this ?
    Regards,
    Harish

    Hi Harish,
    Please go through following relevant threads ::
    http://forums.sdn.sap.com/thread.jspa?threadID=137355
    http://forums.sdn.sap.com/thread.jspa?threadID=644834
    http://forums.sdn.sap.com/thread.jspa?threadID=1199718
    http://forums.sdn.sap.com/thread.jspa?threadID=36530
    Regards,
    Arpit

  • Firefox gets problems when 2,7 GB of memory is used by Firefox

    Firefox gets problems when 2,7 GB of memory is used by Firefox. Or more. Like 2,8 GB.
    It started when I read jpost.com with tens of tabs open. I don't remember how many. But I know there was more than 40.
    On the tab I that I was reading, the page turned completely black. Pitch black with nothing else, not even the Firefox interface. It was actually a pitch black shape that looked like a web page in shape. The blackness quickly disappeared and the page was normally readable again. But then it happened again - the page turned black again.
    The same page turns black happened again later.
    One of my browsing sessions had Firefox slow down so much that you could see scrolling happening when I used scrolling.
    Still another time I had 60 tabs open and Firefox worked completely fine without freezes, slowdowns, or black shapes. I could close Firefox by just pressing the red X in the title bar.
    Yesterday, I had 50 tabs open and I experienced a slowdown when I looked at the Breaking News headlines. The headlines would show slower than usual. The Breaking News headlines at jpost.com show the headlines a few words at a time until the headline is completely shown. Then the headline disappears and the next starts showing a few words at a time. And speed in general was not what you normally have with a computer that has 8 GB of memory. And a Core i5 processor. I opened two more tabs from the Breaking News section I had opened. After I opened a new window, Firefox froze. I had to close Firefox from the Task Manager by pressing End process. I had used Firefox for 6 hours without ever closing any of the tabs I had opened.
    In all of these cases, more than 40 tabs were open. In all of these cases, the slow down or freeze meant I had to use Task Manager and then press End process on the Processes tab. In all cases except the two I describe in the next paragraph, I never close any tabs after opening them. No problems have ever happened until Firefox started using 2,7 GB of memory. Until that point, everything is normal with no freezes or slowdowns.
    At two times, I tried to reduce memory usage by closing tabs. However, in both cases this would make Firefox freeze. In one of these cases, Firefox would show something bizarre: there would be about 7 tabs, and one of the tabs would be partly shown. Also, Firefox would show the busy cursor. Firefox did not show how many tabs I actually had. The second time, I tried to close the tabs by clicking Close other tabs in the menu that you get when right-click a tab. The tabs would close fine, but I remember that I opened Gmail and then I did this: I clicked on the Promotions tab. Instead of seeing the tab with the Emails, Firefox showed a busy cursor and the title bar said not responding. Firefox froze.
    The reason might be Adblock Plus memory usage. In Adblock Plus home page, developer Wladimir Palant writes in his blog about how Adblock Plus uses a lot of memory: https://adblockplus.org/blog/on-the-adblock-plus-memory-consumption .

    One more bit of information: I have a Geforce 640 GT graphics card. My graphics card drivers are old- version 311.41. The newest version of the drivers is 340.52. Would a new graphics card driver solve the problem?

  • I am getting problem with internal table & work area declaration.

    I am working with 'makt' table ..with the table makt i need to work with styles attributes ..so i declared like this
    TYPES : BEGIN OF ty_makt,
             matnr TYPE makt-matnr,
             spras TYPE makt-spras,
             maktx TYPE makt-maktx,
             maktg TYPE makt-maktg,
             celltab TYPE lvc_t_styl,
           END OF ty_makt.
    DATA : i_makt TYPE TABLE OF ty_makt.
    DATA : wa_makt TYPE ty_makt .
        But end of program i need to update dbtable "makt"...i am getting problem with internal table & work area declaration.
    i think makt table fields mapping and internal table/work area mapping is not correct. so please help me to get out from this.

    Hi Nagasankar,
    TYPES : BEGIN OF TY_MATNR,
                  MATNR TYPE MAKT-MATNR,
                  SPRAS TYPE MAKT-SPRAS,
                  MAKTX TYPE MAKT-MAKTX,
                  MAKTX TYPE MAKT-MAKTG,
                  CELLTAB TYPE LVC_T_STYL,  " Its Working perfectly fine..
                 END OF TY_MAKT.
    DATA: IT_MAKT TYPE STANDARD TABLE OF TY_MAKT,
              WA_MAKT TYPE TY_MAKT.
    Its working perfectly fine. if still you are facing any issue post your complete code.
    Thanks,
    Sandeep

  • Problem when writing table:c_t_variables

    Hi Everyone,
    I have a typical workbook issue and the following were the issue points:
    1. A user have saved his workbook in the shared drive and trying to give access to all the users who have access to this drive. For this there is a option in Excel->tools(Menu)>Share workbook and check the Check box.
    2.Now when he accessing the workbook via Business Explorer. The moment he refreshing one the query in the workbook it giving a pop Error message.
    Business Explorer<internal Error> Problem when writing table: C_T_VARIABLES.
    It's wierd issue for me and haven't come across this error before.
    Please look into this issue and let me asap if there is any solution for this.
    Thanks,
    It's very Urgent

    Hello,
    where I can find
    Excel Options >> Complements >> Manage Excel Complements >> Go >> Deactivate Euro Tools.
    thanks

  • Getting problem when connecting to SMTP server through java code

    Hi all,
    I am getting problem when i am going to connect with "Kerio SMTP server" through java code. The error what i am getting is :
    "[16/Sep/2008 15:59:09] Sent: Queue-ID: 48cf8a73-000000f9, Recipient: <[email protected]>, Result: failed, Status: 5.3.2 554 5.0.0 Too many hops (101, max 100), message looping" when sending an email from [email protected]

    Looks like something is set up wrong on your server that's causing messages
    to be forwarded around a loop too many times without ever reaching the destination.
    For instance, if server A forwards to server B, and server B forwards to server A,
    this would happen.

  • Problem in the output when the table name is explicitly assigned.

    hi
    Am using a procedure to copy the information's in a table to a flat file. my aim is to achieve this copy function by assigning the table name from user explicitly.
    this is the program:
    create or replace procedure jk(table_name in varchar2) is
    sel_table varchar2(30);
    l_bool BOOLEAN;
    irows INTEGER := 1;
    buffer LONG;
    f utl_file.file_type;
    BEGIN
    sel_table:='select * from '||table_name;
    f := utl_file.fopen('SAMPLE','tablename.txt','W');
    OWA.cgi_var_name (1) := 1;
    OWA.cgi_var_val (1) := 1;
    OWA.init_cgi_env (1, OWA.cgi_var_name, OWA.cgi_var_val);
    HTP.adddefaulthtmlhdr (FALSE);
    l_bool :=
    OWA_UTIL.tableprint (ctable => sel_table,
    cattributes => '',
    ntable_type => OWA_UTIL.pre_table,
    ccolumns => '*',
    cclauses => '',
    ccol_aliases => '',
    nrow_min => 0,
    nrow_max => 500
    WHILE (irows != 0)
    LOOP
    buffer := HTP.get_line (irows);
    utl_file.put_line(f,buffer);
    /* do whatever you like with the contents of the buffer */
    /* You may write to a file or simply print it out */
    DBMS_OUTPUT.put_line (buffer);
    END LOOP;
    END;
    the error during execution:
    SQL> @for.sql
    Procedure created.
    SQL> exec jk('CUST');
    BEGIN jk('CUST'); END;
    ERROR at line 1:
    ORA-00931: missing identifier
    ORA-06512: at "SYS.DBMS_UTILITY", line 125
    ORA-06512: at line 2
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 1120
    ORA-06512: at "SYS.DBMS_SQL", line 323
    ORA-06512: at "SYS.OWA_UTIL", line 595
    ORA-06512: at "SYS.OWA_UTIL", line 689
    ORA-06512: at "SYS.OWA_UTIL", line 1222
    ORA-06512: at "XMLUSER.JK", line 14
    ORA-06512: at line 1
    thanks in advance
    karthik.J

    You better don't supply the whole select statement to OWA_UTIL.tableprint but only the table name!

  • Problem with Dynamic Table Name

    Hello all,
    I am having trouble using a dynamic table name. I have the following code.....
    declare l_cur sys_refcursor;
    l_ID int;
    l_tableName varchar(30);
    BEGIN
    open l_cur for
    select hkc.ColumnID, mapping from &HKAPPDB_Schema_Name..doctablemapping ddm
    inner join &HKDB_Schema_Name..HKColumns hkc on hkc.doctablemappingid = ddm.id
    where ddm.id > 0;
    LOOP
         FETCH l_cur into l_ID, l_tableName;
         EXIT WHEN l_cur%notfound;
         -- update missing VerbID in DocumentDocMapping table
         UPDATE &HKAPPDB_Schema_Name..IndexedDocument
         SET VerbID = (SELECT t.VerbID
                             FROM (SELECT DocRef, VerbID, DateUpdated
                                  FROM &HKAPPDB_Schema_Name..l_tableName dd        - this is where the dynamic table name is used
                                  WHERE dd.VerbID is not NULL))
         WHERE HKColumnID = l_ID AND VerbID is NULL;
    END loop;
    end;
    /When I try to execute this i get an error
    ORA-00942: table or view does not exist
    What am I doing wrong?
    Regards,
    Toby

    redeye wrote:
    I only started about 6 weeks ago, with no tutorials and learning it on the fly; Same here.. only my introduction was to a 12 node Oracle OPS cluster all those years ago.. and required a whole new mind set after using SQL-Server extensively. But it was fun. Still is. :-)
    but thats what you get when a company throws you in at the deep end with a ridiculous time constraint to migrate a whole MSSQL DB.Migrating SQL-Server to Oracle is not a simple thing. A lot of best practices in SQL-Server are absolutely worse practices in Oracle - they are that different. Simple example is lock escalation - an issue in SQL-Server. In Oracle, the concept of a lock being escalated into a page lock simply does not exist.
    In terms of getting the migration done as quickly and painlessly as possible I try to reuse all the logic as it appears in the MSSQL code - in this case it was using dynamic table names. I do not doubt that i am probably shooting myself in the foot in the long run.....As long as you do not splatter too much blood on us here.. not a problem :D
    Seriously though - just keep in mind that what works in SQL-Server may not work as well (or even at all) in Oracle. So do not hesitate to refactor (from design to code to SQL) mercilessly when you think it is warranted.

  • How can i get value when the field name is user's defined

    Hi,
    I have a one java method:
    public ResultSet countUserDb(String id) {
    ResultSet rs = null;
    con = dbcon.connect();
    String queryString = ("select count as count from
    db_allocation where user_id='"+id+"'");
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    When i call it in a jsp file.
    ResultSet counter =db.countUserDb(request.getParameter("id"));
    if(counter.next())
    int x=rs.getInt("count");
    Tomcat said incorrect column name.How can i get the result set when the field name is user's defined.
    Best regards
    Ricky

    You should give the user defined name in the ResultSet.getXXX method to retrieve the column value.
    Example
    SQL:
    Select ename as employeename from emp;
    You should say :
    ResultSet.getString("employeename"); to get the value.
    Alternatively you can retrieve it using column number:
    ResultSet.getString(1);
    Chandar

  • How to get the Change Log Table name of the ODS from the system table

    Hi,
    I have a list of ODSs in the system and I am interested in finding the corresponding Change Log Table and the number of records in that table.
    Can any one please tell me the name of the system table where this information is stored.
    I dont want to get in this information manully (from the Contents tab of the ODS maintenane).
    Regards,
    Harikiran Gunnala

    Hi
    Go to SE16
    Give the table name as "RSTSODS".
    For User application field give CHANGELOG as input
    and execute. You will get all the list of Changelog tables Along with below mentioned data
    PSA
    Version
    To
    Valid from
    Object Status
    Technical ODS name
    Program Name
    Maint  Program
    Object Name
    Last changed by
    UTC Time Stamp in Short Form
    Partition number
    Regards
    Raj

  • Performance problem when printing - table TSPEVJOB big size

    Hi,
    in a SAP ERP system there is performance problem when printing because table TSPEVJOB has many millions of entries.
    This table has reached a considerable size (about 90 Gb); db size is 200 Gb.
    Standard reports have been scheduled correctly and kernel of SAP ERP system is updated.
    I've tried to scheduled report RSPO1041 (instead of RSPO0041) to reduce entries but it is not possible run it during normal operations because it locks the printing system.
    Do you know why this table has increased ?
    Are there any reports to clean this table or other methods ?
    Thanks.
    Maurizio Manera

    Dear,
    Please see the Note 706478 - Preventing Basis tables from increasing considerably and
    Note 195157 - Application log: Deletion of logs.
    Note 1566659 - Table TSPEVJOB is filled excessively
    Note 1293472 - Spool work process hangs on semaphore 43
    Note 1362343 - Deadlocks in table TSP02 and TSPEVJOB
    Note 996455 - Deadlocks on TSP02 or TSPEVJOB when you delete
    For more information see the below link as,
    http://www.sqlservercurry.com/2008/04/how-to-delete-records-from-large-table.html
    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=91179
    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=83525
    If any doubts Let me know.
    Thomas
    Edited by: thomas_raja on Aug 7, 2011 12:29 PM

  • Problem in using table name dynamically in PL/SQL

    I tried to create a procedure to use table name dynamically and got the following error. Anything wrong with my procedure?
    NFADV>declare
      2   cnt number;
      3   cursor cur is select table_name from user_tables where table_name in ('EMP','DEPT');
      4  begin
      5   for c1 in cur
      6   loop
      7    execute immediate select count(*) into cnt from c1.table_name;
      8      dbms_output.put_line('Count is : '||cnt);
      9   end loop;
    10  end;
    11  /
    declare
    ERROR at line 1:
    ORA-06550: line 7, column 21:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternatively-quo
    ORA-06550: line 8, column 5:
    PLS-00103: Encountered the symbol "DBMS_OUTPUT"
    ORA-06550: line 8, column 45:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    . ( , * % & - + / at mod remainder rem <an identifier>
    <a double-quoted delimited-identifier> <an exponent (**)> as
    from into || multiset bulkThanks and Regards
    Kaustubh

    Hi,
    The wrong part is in execute immediate, it should be as follows:
    execute immediate ('select count(*) from '|| c1.table_name)
    into cnt
    (not tested)
    Regards
    AK

  • How to get C$_ work table name

    Guys,
    Is there is anyway we can get C$_ table name and drop it, in case if there is any error?I need to drop it as part of error log mechanisam?
    I want to do it through ERROR LOG ODI procedure..
    Cheers
    Sri

    In your IKM, you can create an extra step that loads some technical information (like the C$ table) in a special table.
    To retrieve the C$ table, you must use some ODI API method.
    Example :
    select <%=odiRef.getTable("L", "COLL_NAME","W")%> from dual
    or
    select '<%=odiRef.getFrom()%>' from dual
    In your special table, you will store name of Interface name, target table, C$, I$ table and whatever you want.
    Then, with ODI variable, you will be able to retrieve what you want.
    Then, in your package, create an error flow (with red arrow) that will execute and ODI procedure that deletes the tables.

  • What to do when a table name is a reserved word?

    I know the best answer is not to use a reserved word to name a table. But I have no control over that in this situation. I have read that using all Caps and quotations will allow you to use the table name in queries, i.e. "CATEGORY" is suppose to free the table to be used. But that is certainly not working, nor any variation of that formatting.
    Does anyone know how to format a reserved word to allow queries?
    Thank You

    Use double quotes:
    SQL> create table ALTER (a number);
    create table ALTER (a number)
    ERROR at line 1:
    ORA-00903: invalid table name
    SQL> create table "ALTER" (a number);
    Table created.
    SQL> desc alter
    ERROR:
    ORA-00931: missing identifier
    SQL> desc "ALTER"
    Name                                      Null?    Type
    A                                                  NUMBER
    SQL> insert into "ALTER"
      2  select level from dual connect by level<=10;
    10 rows created.
    SQL> select * from "ALTER";
             A
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    10 rows selected.BTW CATEGORY is not a reserved word:
    SQL> create table category (a number);
    Table created.Max
    http://oracleitalia.wordpress.com
    Edited by: Massimo Ruocchio on Feb 25, 2010 12:32 AM

Maybe you are looking for

  • Replace sentances and words directly in the FramMaker

    Hi! I want to replace complete sentances and words directly in the FramMaker where I keep the layout of my entire book. The program/the code I am looking for need to be able to replace many words and sentences at the same time. For example: <in such

  • How to add non printable character in label

    hi , I want to add white space or tab in label of output label thanks

  • I can't isntall the weblogic for solarsi x86

    when I input the command :sh weblogic600sp2.bin; the system display some error messages: error:can't find libjava.so. pls tell me how to setup the environment for isntallation weblogic. thanks

  • In list problem

    Dear All, I have several id values with a comma separator in a column named matched_id like this 33577,33588,36987,62731 in a table named tab2. Then I am writing a query as follows: select emp_id,name from tab1 where to_char(emp_id) in(select matched

  • Reg. shell script.

    Hi, I need a small favour. Its a simple shell script. I want to search a string in a file and after that i want to print next two or three lines after that string. How this can be achived. Please help me regarding this. ex: I have file abc.txt as sho