The moose likes Java in General and the fly likes Parse data from a db column. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Parse data from a db column." Watch "Parse data from a db column." New topic
Author

Parse data from a db column.

John Tyll
Greenhorn

Joined: Feb 06, 2003
Posts: 10
I have created a java notification app. It works just fine but, requirements changed. Currently, I am selecting the data from an Oracle table that is necessary to send an e-mail, the subject, body, and column E_ADDRESS, which contains 1 e-mail address. The new requirement is to allow this E_ADDRESS column to contain 1 - 5 e-mail addresses. I am not sure how I parse out this data, and I don't seem to find an example on-line. Please help.
Greg Charles
Bartender

Joined: Oct 01, 2001
Posts: 1855

You will need some way to delimit e-mail addresses, e.g. a comma. Whoever creates the data record, must place a comma between e-mail addresses stored in a single field. You then read the whole string in the e-mail address column and use a StringTokenizer to chop it up into individual addresses.
Another solution: don't store multiple e-mail addresses in one column. Have an e-mail address table indexed to your main table. I know though, you don't always have influence over your data model. We've all been there! :roll:
[ February 06, 2003: Message edited by: Greg Charles ]
John Tyll
Greenhorn

Joined: Feb 06, 2003
Posts: 10
Thnaks Greg,
It helps to know what to look for.
 
IntelliJ Java IDE
 
subject: Parse data from a db column.
 
Threads others viewed
using multiple table from a database in a JSP
Update XML to CLOB
retriving bit from Database
retriving bit from Database
How to parse the content(mail body) of email using java mail API
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com