java - performance is slow with hibernate and MS sql server -


i'm using hibernate , db sqlserver. sql server differentiates it's data types support unicode ones support ascii. example, character data types support unicode nchar, nvarchar, longnvarchar ascii counter parts char, varchar , longvarchar respectively. default, microsoft’s jdbc drivers send strings in unicode format sql server, irrespective of whether datatype of corresponding column defined in sql server supports unicode or not. in case data types of columns support unicode, smooth. but, in cases data types of columns not support unicode, serious performance issues arise during data fetches. sql server tries convert non-unicode datatypes in table unicode datatypes before doing comparison. moreover, if index exists on non-unicode column, ignored. lead whole table scan during data fetch, thereby slowing down search queries drastically.

the solution used ,we figured there property called sendstringparametersasunicode helps in getting rid of unicode conversion. property defaults ‘true’ makes jdbc driver send every string in unicode format database default. switched off property.

my question cannot send data in unicode conversion. in future if db column of varchar changed nvarchar (only 1 column not varchar columns), should sent string in unicode format.

please suggest me how handle scenario.

thanks.

you need specify property: sendstringparametersasunicode=false in connection string url.

jdbc:sqlserver://localhost:1433;databasename=mydb;sendstringparametersasunicode=false 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -