mattn / go-adodb

Microsoft ActiveX Object DataBase driver for go that using exp/sql
http://mattn.kaoriya.net/
MIT License
142 stars 36 forks source link

multithread error and suggest (SQL Server 2k) #12

Closed haonan3344 closed 11 years ago

haonan3344 commented 11 years ago

Hello,Mattn. When I using go-adodb connecting the SQL Server 2000 with several connections,errors occured as"CoInitialize has not been called".

So I have to modify the code adodb.go:

  1. remove ole.CoInitialize(0) from init()
  2. add ole.CoInitialize(0) to func (d *AdodbDriver) Open(dsn string) (driver.Conn, error)
  3. add ole.CoUninitialize() to func (c *AdodbConn) Close() error

At last,sorry for my poor English ,and hope to be helpful!!

mattn commented 11 years ago

Could you please test this changes?

haonan3344 commented 11 years ago

My pleasure!

And the result is pass.

Thank you very much!!

haonan3344 commented 11 years ago

The issue can be closed now :)