• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

how to execute sqlplus and sql commands using java

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,



Example
1)col table_name heading "Table|Name"
col column_name heading "Column|Name" format a25
select table_name,column_name from all_tab_columns
where rownum<11;

Example
2)column count format 99999999 heading "No. of|Rows"
select count(*) "count" from user_tables;



above two statements are having sqlplus command and sql command , These sqlplus and sql command i will pass through the TextArea to the Next Page , Next Page Having JDBC program it has to give result of these command ,How to code using java .
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm. The SQL is no problem - you just let JDBC pass that to the database and handle the results. The SQLPlus commands however are a different matter. Its SQLPlus, not Oracle that interprets them so you'd have to ape that behaviour in your GUI application. So I'd imagine something like a lot of regular expressions to parse the incoming SQL/SQLPlus mix, extract out the SQLPlus stuff, query the database then format the results based on the SQLPlus commands. Not nice.
 
anilellendula kumar
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
col table_name heading "Table|Name"
col column_name heading "Column|Name" format a25
select table_name,column_name from all_tab_columns
where rownum<11;

this sql and sqlplus command kept in TextFile, i want to call this textfile using java and connect to the database using JDBC can u help me the code of the JDBC to get the result of sql and sqlplus commands textfile
--------------------------------------------------------------------------------
 
author & internet detective
Posts: 42163
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You wouldn't be able to access something that Oracle specific. Maybe you could keep the command somewhere else?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic