• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to Match ColumnNames of Database and User entered TextFields

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

My Task is to insert the User Entered Textfield values into DataBase .
To do this actually i should know whether this Textfield belong to a Number or a Varchar2 type (Only These types are there at present) to put a quotion mark for a varchar

I am retreiving all these values into Second JSP Page.

So in MY Second JSP Page i am using this code

I am getting TextField values from another JSP into current Page using


// I am able to get all the values here of the entered Textfields.

ArrayList list = new ArrayList();

String DbQuery = "select DATA_TYPE from user_tab_columns whereTABLE_NAME='POLE_COMMERCIAL'";




(This List of values will bestored in ArrayList as )

NUMBER
VARCHAR2
VARCHAR2
VARCHAR2
DATE
DATE
VARCHAR2


Now please tell me how can i append a ' ' to a character .
I tried this way but its not working



My Ultimate goal would be

INSERT INTO POLE_COMMERCIAL VALUES(233,'Comercial',33,'R');

Anybody please help .
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anybody please .
 
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
Well, String concatenation works pretty much just as you have it:


However, what you are trying to do is concatenation with an ArrayList, which wont work.

One question, why are you trying to surround the values in your statement with quotes rather than just using a PreparedStatement?

Lastly, you are aware that Java code in a JSP is not considered good practice? Have you though of abstracting this logic into a bean?
reply
    Bookmark Topic Watch Topic
  • New Topic