Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get a Table Schema from oracle database to Java Programs...?

 
Moguluri Ravi Kiran
Ranch Hand
Posts: 63
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My intention is to create a file

<table_name>.sql from that resembles a already stored file in database...

for example ...

say EMP is a Table with
Ename varchar2(10) not null,
Eid varchar2(5) not null
sal number(7,2) not null...

now i want that information back 2 my java program ........as it was....

im facing problems with ResultSetMetaData's functions getColumnType()
getColumnTypeName() etc....

is there any method 2 copy simply all the above schema as a String into my Java Program.





And Problems are ......

Mappings
********

SQL VALUE GETCOLUMNTYPE GETSCALE GETPRECISION

****************************************************************

NUMBER DOUBLE PRECISION 0 15

VARCHAR2(12) VARCHAR2 0 12

NUMBER(4) DECIMAL 0 4

VARCHAR2(10) VARCHAR2 0 10

VARCHAR2(9) VARCHAR2 0 9

NUMBER(4) DECIMAL 0 4

DATE DATE 0 19

NUMBER(7,2) DECIMAL 2 7

NUMBER(7,2) DECIMAL 2 7

NUMBER(2) DECIMAL 0 2

**************************************************************

Now i required to convert JAVA output to SQL.......Feeling more burden.....

is there any solution ?



Thanks in Advance..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic