Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Sam Whited
On Thu, Feb 8, 2018, at 07:28, Mandolyte wrote: > I'd like to use the same program against multiple databases and set the > driver by configuration. But since the driver is in the source code, I > don't see a way to do that. > > In other words, I don't want to include this in my code: > > >

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Tamás Gulácsi
Though database/sql supports several drivers, the databases and their SQL dialects are quite different! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Mandolyte
Yeah, makes sense... I was just trying to do something I could do in Java... but it's interpreted and isn't creating an executable. No biggie... just wanted to be sure I wasn't overlooking any tricks. Thanks for the quick answer! On Thursday, February 8, 2018 at 8:39:02 AM UTC-5, Jan Mercl

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Shawn Milochik
You'd just have to compile in all the drivers you want to support. Then use environment variables to get settings per database. That's why sql.Open() takes a string as its first argument; so you can tell it which one (potentially of many) to use. -- You received this message because you are

Re: [go-nuts] [Question] database/sql

2018-02-08 Thread Jan Mercl
On Thu, Feb 8, 2018 at 2:29 PM Mandolyte wrote: > I want to load it at run time. Is this possible? Why? The driver code is already linked into your program, otherwise you would not be able to load it later. -- -j -- You received this message because you are subscribed

[go-nuts] [Question] database/sql

2018-02-08 Thread Mandolyte
I'd like to use the same program against multiple databases and set the driver by configuration. But since the driver is in the source code, I don't see a way to do that. In other words, I don't want to include this in my code: > import ( > _ "github.com/lib/pq" > ) I want to load it at