Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to connect PostGreSql without ODBC definitions

Status
Not open for further replies.

Rajesh Karunakaran

Programmer
Sep 29, 2016
549
MU
Hi,

Is there a way to connect to PostgresSql directly using a connection string?

Sql servers, we connect something similar to
Code:
lCnStr  = "Driver={SQL Server};Server=localhost\mssqlexp;Database=TestDb;Uid=sa;Pwd=sa11111;'
lStatus = SQLSTRINGCONNECT(lCnStr)

Is there a similar way for PostgresSql ?
This is a local connection, ie the application and PostgresSql database are in same pc.

Thanks
Rajesh
 
Hi,

I got it using

Code:
lCnStr = 'Driver={PostgreSQL ANSI};Server=localhost;Port=5432;Database=TestDb;Uid=uuuuuuu;Pwd=ppppp;'
? SQLSTRINGCONNECT(lCnStr)

I had installed the ODBC driver also.

Thanks
Rajesh
 
Thank you very much Mike.

In fact, I know about that. I took the connection string from there only. But, somehow it failed to function at my first trials but then I got it working.

Rajesh
 
Hi Rajesh,

With “localhost” it will only work on your own pc. Don’t forget to change this if you’re using a server with a central database.

Regards, Gerrit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top