Testing Oracle DB table structure with Spring-Java

Im connecting to an external database wich im not able to populate with testdata to do a proper integration test suite for my DAO on. As an alternative I would like to test the structure of the tables. For example that the tables im using has columns with certain names and types. How is this possible with Java/Spring?

In Oracle SQL Developer I can use desc <tableName>; to get what I want, is there someting smilar i can do from Spring?

-------------Problems Reply------------

You can use the DatabaseMetaData, see here for some inspiration (and test case here)

You can also use dbms_metadata package(unless you're on XE release). This will either return DDL for a database object either as SQL script or as XML formatted string.

It's a way how SQLDeveloper reverse engineers object definitions. AFAIK you have to use database dependent approach for this.

Category:java Views:4 Time:2018-12-31

Related post

  • php: parsing table structure with SimpleXML 2009-11-13

    I'm trying to read in an xml file that for some reason has been modeled in a table structure like so: <tr id="1"> <td name="Date">10/01/2009</td> <td name="PromoName">Sample Promo Name</td> <td name="PromoCode">Sam

  • How to load DBUnit test data once per case with Spring Test 2010-06-09

    Spring Test helpfully rolls back any changes made to the database within a test method. This means that it is not necessary to take the time to delete/reload the test data before each test method. But if you use the @BeforeClass Junit annotation, the

  • Suggest a good Ajax framework to be used with Spring/java? 2010-12-09

    Greetings all i want to use ajax with spring framework and i was wondering what framework is easy to use and has good support & samples with spring framework, like the DWR, any suggestions ? --------------Solutions------------- The Spring team pr

  • get mysql table structure with php 2011-12-29

    I have a script which takes a database and generate export like query for the database as a backup. I need this script for a purpose. My php code is: mysql_query("SHOW CREATE TABLE `myTable`"); there are 17 tables in the database. I am running a for

  • How to test a mocked JNDI datasource with Spring? 2011-05-09

    I am fairly new to Spring and wondering how to create JUnit tests that use a mocked datasource and how to use a JNDI context with that? Currently my application uses a JNDI context from tomcat to retrieve a connection and via that connection retrieve

  • Failed JUnit test when calling Stored Procedure with Spring 2012-04-27

    Hope someone can possibly help me with this: I am really new to Spring JDBC. I have 3 JUnit Tests which have no shared data (no before/after methods required as they have their own data in their own data files) Each of these tests call a stored proce

  • how to query (oracle) database table structure in C# / (ADO?).NET 2.0 2010-03-05

    I want to get table metadata for all table columns. Like type string(varchar2)/int/float/datetime and length for strings etc. Cheers! -Matti --------------Solutions------------- For all tables that you can access : select * from all_tab_columns For a

  • Using Oracle's DBMS_APPLICATION_INFO package with Spring JDBC 2011-01-06

    Our webapps currently make JDBC calls to our Oracle database directly. We tag each connection with calls to the DBMS_APPLICATION_INFO package in a static getConnection(String client) method, e.g. CallableStatement pstmt = conx.prepareCall("{call DMBS

  • Proper sql table structure with multiple values of a field 2011-12-05

    I have been working with some basic sql databases and am designing an application and am wondering about having multiple values in 1 field. I am used to a relational DB model and am wondering if sql supports this. Here is an example delimited record:

  • How do I unit test Windows Azure Table query with a stub using Moq? 2012-02-05

    I can't get my unit test to work properly. It works in a integration test I have where it will actually hit the Azure Table Storage. The problem I guess is the mocking of the property QueryableEntities wich retruns a Queryable from the mock but it re

  • MySQL table creation with Spring + Hibernate 2010-12-09

    We came across the following situation. Please note that I know reserved words should not be used for table names, but I'm asking the question anyway out of curiosity more than anything. We are using Spring + Hibernate to manage our database. I am ad

  • SQL Server 2008 Table Structure with Guid Performance Considerations 2011-11-17

    I'm actually in a dilemma right now with regards to whether or not to use Guid. I have a non-transactional table called Posts with a bigint as PK. As far as I understand, using Guid as PK would hamper query performance. However, in order to make quer

  • How to jar/zip a whole directory Structure with the java.util.jar api? 2012-01-11

    Im using the following Code to try an package a directory with all its subdirectories and files into one jar-file. private void writeFile(JarOutputStream jos, File f) throws IOException { byte buffer[] = new byte[BUFFER_SIZE]; if (f == null || !f.exi

  • Recreating table structure with JPA 2012-02-22

    This is a simply one - how can I make my DB (I am using Derby) to commit the changes in entity(I mean changing the column name, constraints, etc)? Because I've discovered when I change something in entity atributes, my DB still remains the same. I am

  • Smarty create grid/table structure with CSS, without extra HTML 2012-02-12

    I have a basic <ul> list in HTML that I would like to convert into a 3 column grid. each list item has a fixed width floated left, so ideally I would like: <ul> <li>List 1</li> <li>List 2</li> <li>List 3</

  • Can't update Oracle IOT table with jbdc updateRow method 2010-03-02

    I have Oracle 10gR2 database with IOT table within: create table countries ( id number primary key, name varchar2(30) not null enable ) organization index; I try to update table values with this Java (version 1.6) code: Statement stmt = conn.createSt

  • Testing with Spring and Maven: applicationContext 2012-04-11

    Seems that question old as world, but I still can't find out the solution.. I'm trying to run simple test: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"/applicationContext.xml", "/PersonsPopulateTest-context.xml"}) @Tra

  • Populating an html table (or similar structure) with either php or jquery 2011-11-29

    I'm trying to populate a table structure with around 5 fields of data from mySQL. I'm completely new to web development, so I'm finding this to be rather difficult. This is the javascript line that I'm currently using to populate my html elements: $.

  • Oracle Stored procedure Structured Parameters 2012-02-13

    I wish to pass a bunch of 'unknown' values to an Oracle stored procedure from a spring java application. The data is somewhat structured, so currently we have a stored proc that has accepts 2 clobs what are key/value pairs of the data. The first clob

  • Table structure of a student 2010-07-26

    I want a table structure which can store the details of the student like the below format. If the student is in 10 th standard -> I need his aggregate % from 1st standard to 9th standard. 5 th standard -> I need his aggregate % from 1st standar

  • describe table structure 2010-07-29

    Which query will give the table structure with column definitions in SQL? --------------Solutions------------- sp_help tablename in sql server desc tablename in oracle In MySQL you can use DESCRIBE <table_name> DESCRIBE tableName Check MySQL de

  • How to Jquery show only a particular td from this table structure? 2009-11-23

    i'm a total noob when it comes to Jquery and i've been trying to learn it but as of now i still don't know how to query this one out. I have a table structure that looks like this: <table class="wba_main_table" align="center" border="0" cellpaddin

  • Table Structure in Html 2010-03-09

    I want to create a table structure with checkbox for each row and each row is identified with different colors, how can I achieve this --------------Solutions------------- CSS: .odd { color:#CCC; background-color:#333; } .even { color:#333; backgroun

  • Java WebServices with Spring and OAS/OC4J 2009-01-23

    I'm having problems deploying a simple WebServices app (like "Hello World" simple) to OC4J. The same code works fine under Jetty, but breaks in OC4J, and I'm wondering if anyone else has faced the same issue. I'm using Enterprise Manager to deploy th

  • Is there a usable standards-compliant (168/286) portlet testing framework? (especially one that works with Spring PortletMVC) 2009-06-08

    I've not seen anything in this area I would recommend to a client. If you've used Spring PortletMVC, how did you test it? It's easy to test under the level of portlet code, and relatively easy to test on the client side through HtmlUnit, Selenium and

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.143 (s). 11 q(s)