Need example of usage DerelictPQ
Suliman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Dec 24 05:25:09 PST 2014
I have done next:
string connString = "psql -h localhost -p 5432 -U postgres -d
testdb";
package PGconn* conn;
@property bool nonBlocking(){ return PQisnonblocking(conn) == 1;
}
this(parseConfig parseconfig)
{
void connect()
{
try
{
DerelictPQ.load(getcwd ~ buildPath("\\libs\\libpq.dll"));
conn = PQconnectdb(toStringz(connString));
if( !nonBlocking && PQstatus(conn) !=
ConnStatusType.CONNECTION_OK )
throw new Exception("Can't connect to DB");
}
catch ( DerelictException de )
{
writefln("Failed to load libpq.dll: %s", de.msg);
}
}
connect();
But it runtime I am getting next error:
object.Exception at source\app.d(203): Can't connect to DB
----------------
0x00402D31 in
D3app10PostgreSQL6__ctorMFC3app11parseConfigZ7connectMFZv at D:\Pr
oject\2014\seismoDownloader\source\app.d(203)
0x00402C3F in app.PostgreSQL
app.PostgreSQL.__ctor(app.parseConfig) at D:\Projec
t\2014\seismoDownloader\source\app.d(216)
0x0040208B in _Dmain at
D:\Project\2014\seismoDownloader\source\app.d(30)
What I am missing? Where I can to look right format of connection
string for this driver?
More information about the Digitalmars-d-learn
mailing list