I am trying to connect to SQL server Express DB installed on localbox from my java program. I am using jtds driver and the sample code is below.
When I try to run the program, I get an error saying "java.sql.SQLException: Network error IOException: Connection refused: connect"
If I use
I get an error "java.sql.SQLException: Server localhost has no instance named SQLEXPRESS."
I have the driver jar in class path and my VM args are "-Djava.library.path=C:\jtds-1.2.5-dist\x64\SSO" pointing to the NTLM dll.
I am able to connect to the DB from the MS SQL Server Management Studio.
I have a multithreaded spring stand alone app running on 2 boxes. I have a service method which checks for a record in DB and if its not there, it tries to insert in the DB. I want to handle a situation where if one thread on box A is querying to find a record, another thread on Box B should not have queried and tried to inserted the record if it didn't existed. I have constraints in DB which would throw an exception, but is there a way in Spring to prevent this race condition
I want to validate a company name field and it can accept only alpha numeric values at the beginning and at the end and can have space or comma or a single quote anywhere else. So I need a regex expression to validate it.Any help is appreciated
Thanks in advance