Link to home
Start Free TrialLog in
Avatar of Aurii
Aurii

asked on

Search Marathi (Indian) language from JavaDB MS Access

I have develop java application in Marathi I inserted some record in database but at the time of searching it’s not responding I used JtextField for search by name I used auto complete method in query  like “select * from employee where name =?%” but I am not getting any record  Please help
Avatar of for_yan
for_yan
Flag of United States of America image


Sorry, just to make sure, that you have correct syntax with the query; your example with % doesn'ty look
familiar to me; it should rather be

select * from employee where name like '...%'  

where ... - is the substring you are looking for
- so
when you use percent sign it should be "like" not "=" and single quotes are normal in SQL for strings.
Question mak will be used only in PreparedStatement.
Just making sure the issue is not something related just to appropriate syntax.

I'm more accustomed to Oracle rather than MS Access, but I think those syntax points
are the same for any SQL

 
Avatar of Aurii
Aurii

ASKER

Yes, you are right. Actually by mistakenly I wrote wrong statement. My query is,
“select * from employee where name  like '?%'  ”
Now suggest me solution
Avatar of Aurii

ASKER

I am using ISM V6 software for my Marathi font (It supports Unicode). When I Saved String in database by my java application it get saved in database as garbage value. At the time of retrieval It showing right value but at the time of searching like I mentioned above, Its' not responding.
But what do you mans by this question mark inside teh quote? Should not your provide
the value for it before querying, what substring you are looking for?
Does your query return at SQL prompt outside your code?
Avatar of Aurii

ASKER

For example my database contains lot of names and I want to show only those names whose starting character is "S". For the same I wrote query,
“select * from employee where name  like 'S%'  ”
Yes, this query does makes full sense.  So it does not return from your java code.
Does it return directly from SQL prompt?  
Avatar of Mick Barry
> “select * from employee where name  like '?%'  ”

(assuming you are using a PreparedStatement) that should be:


“select * from employee where name  like ?”

and include the % when you set the parameter
Avatar of Aurii

ASKER

I am using MS Access. This query successfully worked for English font but its' not working for ISM Marathi font. I am not directly writing 'S' in query. I used one JTextFeild named 'name'' for such operation.
I set keyReleased event on that TextField. In that I wrote above Statement as,
“select * from employee where name  like ' "+name.getText()+"%'  ”
And then I set results of this query in my JTable
Well, one thing you print
System.out.println(“select * from employee where name  like ' "+name.getText()+"%' ");
just before your queriyng in the program - so you'll know that
your textfiled provides you wit reasonable string.
Another thing when you see this query as it is printed, go to the database
sql prompt ot in your case to MS Access itself - and run your query
exactly as you see it printed directly on the database - you'd at least get some
knowledge wheteher the problem is in the database itself or
in the interaction with your java code.  This wil probably not solve your question, but
would at least allow to compartmentalize your problem.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aurii

ASKER

My query is right. I checked it. It worked properly fpr English font. Its' showing problem in application which I developed in Marathi. If my database contain name 'harry' and if I type some intial characters then it is not showing any result but if I type full name 'harry' then its' showing result. I am using ISM V6 for Marathi font which is Unicode and 64 bit. And my datatype is 'Text' which of size 255. Is this  mismatched combination? If yes then please suggest me any solution because I thought Its' problem of datatype in database. MS Access does not have Nvarchar datatype
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial