My application read log files in which each line = record of table. Field separator in log files is pipe sign, so data is something like this:
String Field 1 | Integer Field 1 | Date Field 1 | String Field 2......
When I transform this into "Insert into..." statement I have make my SQL like this:
Insert into abc values('String Field 1',Integer Field 1,'Date Field 1'...)
Question) I dont wish to enter '' for text or date fields, i.e, how can I enter data without knowing the type of respective coulmn in table, any way?
Originally posted by Paul Sturrock:
Read the API for PreparedStatements. OK you can't use them to "enter data without knowing the type of respective coulmn in table, any way", but then that's not something you can do with databases anyway. PreparedStatements will remove your need to use quotes.
Yes it's also a good solution ..
so, here i have something in my mind but i think not really a optimized solution. you can query that table with "*". and then use the getMetaData() to know the column types, then execute your insert.
how it sounds?