Derby Embedded get list of all tables
I am writing a small program that uses derby embedded to store schedules for teachers. Each teacher will have their own table and I want to use the teacher name for the table name and allow the teacher to be selected from the combo box. I have an SQL statement i'd to have return all the current tables, but i think i am doing something wrong:
public static String[] getTeacherNames() {
String[] tableNames = null;
String tableFind = "select APP.schemaname || '.' || Schedule.tablename"+
"from sys.systables Schedule, sys.sysschemas APP"+
"where Schedule.schemaid = APP.schemaid"+
"and Schedule.tabletype = 'T'"+
"order by APP.schemaname, Schedule.tablename";
String protocol = "jdbc:derby:";
String dB = "Schedule";
Connection con;
Statement stmt;
try {
con = DriverManager.getConnection(protocol + dB +
";create=true", "app", "app");
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(tableFind);
ResultSetMetaData rsmd = rs.getMetaData();
int rowCount = 0;
while (rs.next()) {
tableNames[rowCount] = rs.getNString(rowCount);
rowCount++;
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
return tableNames;
}can anyone help, or have any better ideas? I modified the statement from the one i found on the derby Wiki.
like this?
String[] getNamesArray = {"%"};
String[] tableNames[] = null;
String protocol = "jdbc:derby:";
String dB = "Schedule";
Connection con;
Statement stmt;
try {
con = DriverManager.getConnection(protocol + dB +
";create=true", "app", "app");
DatabaseMetaData dbmd = con.getMetaData();
tableNames = dbmd.getTables("%");
con.close();
} catch(SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
return tableNames;
}the DatabaseMetaData will only except the names of tables I already know? I've been messing with it for a while and can't seem to get it to be happy with what I am giving it.
Similar Messages
-
Newbie ques : How to get the list of all tables in the database
Hi,
I'm very new to Oracle (using Oracle8i currently). I wanted to know if there is a way to get the list of all tables in the database. Like in mySQL you can use the command " show tables" to get the list of all the tables.
Any help will e greatly appreciated. Please "cc" any reply to [email protected] also.
thanks
DevenHi
Select table_name, owner from all_tables;
will give u all the tables in the database.
all_tables, dba_tables, user_tables
all_objects, dba_objects, dba_objects
there are many, more tables. login as system and query the tab and try to describe the tables.
Thanks
Malar -
Table to get the list of all tables in the database
hi,
please let me knwo the table where i can get the list of all tables in the databasehi,
please let me knwo the table where i can get the list
of all tables in the databaseHi Michael,
Will you EVER start reading some documentation?
I guess it's not far that many regulars won't reply to those kind of questions.
Believe me, reading doesn't hurt (well, at least, most of the times).
Rgds,
Guido -
Query to find list of all tables relating to BP
Hi,
Is there any query which can generate list of all table names relating to BP?
For example tables like BUT000,020,051 etc which are related to BP. I know a list of 14-15 table names but do not know the name of each and every field that is existing in BP.
By writing a query can we get a list of all such table names for all the fields which appear in Field Grouping (which may be Role specfic)Hi Praveen,
Well I am not aware of such query but if you want the CRM data model give me your mail ID i will send it to you in which you will find all the required details.
Best regards,
Vikash. -
I want to get List of all active sessions in current system
Hi experts
How to get list of all active sessions in current system in any internal table along with details.
A sample code wud be helpful
Thanks in advance.try this code it might help u.
Below report execution gets the active Session list to ABAP memory
submit rsm04000_alv and return exporting list to memory.
refresh: gt_listobj.
Below FM get the List output from ABAP memory to gt_listobj in HEX
call function 'LIST_FROM_MEMORY'
tables
listobject = gt_listobj
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0. " Executed successfully ?
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
This FM converts ITAB gt_listobj from HEX to ASCII
call function 'LIST_TO_ASCI'
tables
listasci = it_list
listobject = gt_listobj
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
if sy-subrc <> 0. " Executed successfully ?
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
This Shows the output in List format on screen
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'line'
tables
t_outtab = it_list
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0. " Executed successfully ?
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. -
FM to get list of all directories and files on application server..
Hi All,
Can anyone tel me FM to get list of all directories and files on application server..i know 'F4_DXFILENAME_TOPRECURSION'
and '/SAPDMC/LSM_F4_SERVER_FILE' these are working too...but my requirement is when i click F4 i should get list of directories and whn i select one of these the only directory name should display.....and whn click again for 2nd text box field i want file name ...means directory name in one text box field and file name in another....plz help me out..
helpful answers wil b awarded.
Thanks,
JayshreeHi Jayashree
Please check this FM, SUBST_GET_FILE_LIST. Pass the file path and file name, if it returns an entry in table FILE_LIST, then the filename and path are valid.
Hope this helps !
~ Ranganath -
Need a way to retrieve list of all tables through a RFM
I wish to retrieve list of all tables through a RFM.
I know the table DD02L contains a list of all other tables. I can call the RFM RFC_READ_TABLE with table name DD02L or DD03L as an input parameter. I do not wish to do this way as the table name DD02L might get changed in a future release of SAP and break my external C program.
The question is - is there any other RFM that would return the list of tables and their properties. Does SWO_QUERY_OBJTYPES or some other SWO_QUERY_* RFMs can be used?
Any useful info is appreciated.
ThanksThanks Ramiro.
If I relay on TFDIR table to get a list of function modules, what are the chances that SAP will rename or get rid of TFDIR in a future release of SAP? I wish to avoid using undocumented interfaces as do not want to change my program in the future. -
Is there any FM or BAPI to get list of all sales orders
Hello all,
I have the requirement like below.
Is there any FM if i Pass Drawing document no, type,part,revision level which gives
the output list as.
1) all sales orders, where the above drawing document no is attached to the materials
and these materials are used as one of the lower level components in the Sales order BOM,
I need to show all those sales orders along with SO number,item,Material,Plant and BOM Item no,
2)all sales orders, where the above drawing document no is attached to the materials
and the same material is one of the item in sales order.
3)all sales orders, where the above drawing document no is used as one of the component in Sales order BOm's
Addition of 1,2,3 will be the o/p.
are there any FM or BAPI to get the above list.
Basically the above report is concatenation of report outputs of t-code CSD5 and CS15.
Awaiting reply.
Thanks.Hi venkatesh,
You can use the BAPI
BAPISDORDER_GETDETAILEDLIST
to get list of all sales orders.
Here is a lik which provides you BAPI'S regarding everything.
[http://www.saptechies.com/sap-bapi-list/]
Hope this will help you.
Regards,
Pavan. -
Getting list of all users present in SIM
Hi,
I would like to update all the users (attributes of users) in SIM .
Right now I am thinking to get list of all users present in SIM and get the view of each user and then update the particular attribute and chekin the view. and imp point to note here is I am having around 100,000 users present in SIM.
I am thinking there could be a better solution than this...
But I do not know which way can be used to accomplish the task.
Can any one reply immediately with any thought on this.
Thanks in advance.Run a bulk update actions you can easily get a list of all accountids by running select name from userobj;
and in your field or in your input area specify the values u wanna update -
Better way how to get list of all classpath URLs in runtime
Hello everyone,
How to get list of all classpath items (URLs) in runtime from Java code?
I am aware of solution based on System.getProperty("java.class.path"). Is there any alternative?
This solution has several drawbacks. You have to parse String output. And I not sure if it contains ALL resources (JARs, class directories) loaded by ClassLoader or just reflects -cp arguments.
Does system property "java.class.path" contain ALL loaded JARs?
Does it contain items (JARs, class directories) loaded by bootstrap classpath?
What about JARs loaded in runtime?
Is the separator ":" always same on all operation systems?
I was looking for some Java API based solution, method like List<URL> getAllClasspathItems()
But there is nothing like this in ClassLoader, Class, Runtime or System classes.
For curious, here is code I use.
String classpath = System.getProperty("java.class.path");
StringTokenizer st = new StringTokenizer(classpath, ":");
while (st.hasMoreElements()) {
System.out.println(st.nextElement());
}For curious, here are output prints for all 3 methods:
1) parsing system property
2) tschodt
3) overcast SystemClassLoader to URLClassLoader
/home/espinosa/workspace/jboss_embedded_test1/target/test-classes
/home/espinosa/workspace/jboss_embedded_test1/target/classes
/opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
/opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
/opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
package com.sun.org.apache.xerces.internal.impl.validation, Java Platform API Specification, version 1.6
package com.thoughtworks.qdox.directorywalker
package com.sun.org.apache.xerces.internal.parsers, Java Platform API Specification, version 1.6
package java.util.jar, Java Platform API Specification, version 1.6
package org.testng.internal.thread
package com.sun.org.apache.xerces.internal.util, Java Platform API Specification, version 1.6
package java.net, Java Platform API Specification, version 1.6
package sun.reflect.misc, Java Platform API Specification, version 1.6
package esp.ejb.samples1.test
package sun.security.provider, Java Platform API Specification, version 1.
file:/home/espinosa/workspace/jboss_embedded_test1/target/test-classes/
file:/home/espinosa/workspace/jboss_embedded_test1/target/classes/
file:/opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
file:/opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
file:/opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
...Interestingly, method 1 and 3 gives the same list, same order, same count, just format of item is a little bit different. The order is same as in Eclipse .classpath file.
Method 2 (tschodt) give significantly more items! rougly 3x! Different order (somewhat random it seems to me). Some items contain extra information, like version and string "Java Platform API Specification".
It prints not absolute paths but logical Java names. -
To get list of all the running applications
Hi all,
Hey can anyone tell me how i wil get list of all the running applications on windows using java?Cant it be done even using Runtime.exec()?Well, sure. Assuming there is a command-line program
that does what you want. But then your question is
"What can I run at the Windows command line to get a
list of all the running applications?" and (I am sure
you will agree) this is nothing at all to do with
Java programming.
I completely agree... I just find it amazing that this guy knows exactly what he wants to do but is unable to point a web browser to a search engine, type in what he wants to do the read the resulting pages. -
Purchase order list(list of all tables that efect when i entered a po)
is there any script ,to know what all tables will effect when i entered po deatils
and i approve that etc..
if any list is there can any one tell me please.
regards
satish.Hi,
when u go thru AP->Suppliers
create suppliers with all the details.
then query for the same supplier and go to its record history.
U will get vieews.
Go thru those views .so that u will get to know its altering tables.
or else
go thru po_vendors,
po_vendor_sites_all
po_vendor_contacts tales thru trms.
go to its primary tables.
u will get to know other tables which are altering.
--Basava.S -
Get list of accessible tables in schema
I need get list of table which i have select rights.
1. I try it throught select clausule from tables all_tab_privs and all_tables but it is possible that user has no access to this table. How can i get tables of accessible tables to actual logged user with using this system tables?
2. I try it with full access to oracle system, but i had a lot of problems.
E.g. : I created new table 'TEST'.
When:
SELECT * FROM all_tab_privs where table_name='TEST';
No results.
I don't understand. I thought that i should get row with owner etc. Maybe i make or think something wrong. Can somebody help me?
Thanks.1. I try it throught select clausule from tables
all_tab_privs and all_tables but it is possible that
user has no access to this table. How can i get
tables of accessible tables to actual logged user
with using this system tables?ALL_TABLES for all tables which current user can access
USER_TABLES for all tables which current user is owner
To access to table into all_tables, perhaps have you need to prefix by username if you haven't synonym
SQL> SELECT table_name, owner FROM all_tables ;
RCVER RMAN
1* select * from RCVER
SQL> /
select * from RCVER
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> ed
Wrote file afiedt.buf
1* select * from rman.RCVER
SQL> /
VERSION
09.02.00
1 row selected.
SQL>
SQL> >
2. I try it with full access to oracle system, but i
had a lot of problems.
E.g. : I created new table 'TEST'.
When:
SELECT * FROM all_tab_privs where table_name='TEST';
No results.
Because your table has no right for other user
S SQL> create table titi(n number);
Table created.
SQL> SELECT * FROM all_tab_privs where table_name = 'TITI';
no rows selected
SQL> grant select on titi to system;
Grant succeeded.
SQL> SELECT * FROM all_tab_privs where table_name = 'TITI';
GRANTOR GRANTEE TABLE_SCHEMA TABLE_NAME
SCOTT SYSTEM SCOTT TITI
1 row selected.
SQL> Nicolas. -
Data should get inserted in all tables if i enter the form field only once
Hi, I have a new question again.
There are 5 tables in a database, that is t1, t2, t3, t4 & t5. the first 4 table has one common column, known as lc_no. I have build the form using the form builder. In that form, there is a 1 text field for lc_no. I have not started to code anything as yet in the form because everything with respect to it is working fine and even the data is getting inserted. But the problem is that, when i enter the data in the form, the lc_no gets loaded in only one table. I want the data to get inserted in all the tables. What should i code? How should i start off? I'm very new to this & don't exactly know how do i start with it ?
Thank You. Can you help as i have not yet started to code in this form.
Oracle9i Enterprise Edition Release 9.2.0.1.0.
oracle forms 6i.Let us say table one have lc_no, other columen
Table 2 have LC-no , other columsn
Table 3 have lc-no , other column,
Now in form(which has table1 as base table)
In PRe-Insert write like below
Insert into table2 (lc_no) values (:table1.lc_no) here tabel1 should be block name in form.
Insert into table3 (lc_no) values (:table1.lc_no)
................and so on .. to other table.
So, now when user commits the form, the lc_no will be available in all the other tables.. -
How do I get list of 'ALL' Missing files?
How do I get a list of all missing files? I occasionally get a message that a certain file can't be found. I know where they all are - on another drive.
I don't want to just try to add all of the files onto the prime loactaion because It's likely that I will get a huge file of duplicate. From past experience the duplicate feature in this programs is very poor. I should mention that all files are from on own CD's & are without DRM.
If I get the complete list I can easily just copy missing files to main drive.
Thanks in advanceYou can right click a folder and choose Synchronise - it has a Show Missing Files buttom.
John
Maybe you are looking for
-
I reset my WRT54G and now I can't get online.
I did a factory reset of my WRT54G v.2 last night after I was unable to access the router's setting to set up a WEP password (couldn't remember login/pass and the default login wasn't working) and now I can not connect to the internet through my rout
-
How to find my ringtones in iphone4s?
Hi all, I have tried to make a ringtone and rename it under m4r file, I have even dragged it into my iphone music file and why is there ringtone tab in my itunes (pc)? Also, I can't find the custom ringtone in my iphone4s itself, please help!
-
Just got this phone today with Bell. OS is 5.0.0.604 I don't have a data plan so I connected to the internet via wifi and tried to get app world but it gave me an error "Sorry, your device does not meet the system requirements that are needed to supp
-
When trying to send email, I get error message, rejected by server
Our companies webhosting and email are through Bluehost. I have set up email on my iPhone and it receives email just fine, but when i try to send I get "recipient rejected by server" error. How can I fix this. i have tried everything i know to do.
-
Weekly response time of workproces
hi 1.how to check weekly response time of a particular work process? 2. does abap program which is usually developed by our abapers is client specific or cross client?