Jump to content
Sign in to follow this  
slaughter

PostGres SQL ODBC connector

Recommended Posts

slaughter

Thanks all for help or ideas or just saying "make it by your self"

this is in case somebody neads it.

Func postgres_query($query)

$oConn = ObjCreate("ADODB.Connection")
$oRS = ObjCreate("ADODB.Recordset")

;~ set your database ip user & pass 

$line2 =    "DRIVER={PostgreSQL ANSI};DATABASE=Incoming_rates;" & _
            "SERVER=localhost;PORT=5432;Uid=odbc_usr;" & _
            "Pwd=odbc_password;" & _ 
            "A0=0;A1=6.4;A2=0;A3=0;A4=0;A5=0;A6=;A7=100;A8=4096;A9=0;" & _
            "B0=254;B1=8190;B2=0;B3=0;B4=1;B5=1;B6=0;B7=1;B8=0;B9=1;C0=0;C1=0;C2=dd_"

$oConn.Open ($line2)
$oConn.execute ($query)
$oConn.Close

EndFunc

Query shuld lok smth like this one

This is only explame queries

INSERT INTO Incoming_rates_1 (Destination, Area_Codes, Price, Valid_From) VALUES ('Andorra', '003760, 003761, 003762, 003767, 003768, 003769', '0,0235', '19.11.07');

I had problem when creating table from pgAdmin but when runig sql line work just fine

use sql line to create table as well to avoid errors.

CREATE TABLE Incoming_rates_1(
Destination text,
Area_Codes text,
Price text,
Valid_From text,
accessed timestamp
);

Share this post


Link to post
Share on other sites
GEOSoft

Looks fine slaughter.

When you were looking for help with this I'm sure your forum search turned up this UDF.

#300756


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
slaughter

Looks fine slaughter.

When you were looking for help with this I'm sure your forum search turned up this UDF.

#300756

I used Mysql UDF as primary sample to understand how oject method is working.

But later used documentation and VB examples provided with postgres.

Share this post


Link to post
Share on other sites
LupusX

slaughter

I "Copy & Past" yours script to scite, RUN and I get error code:

The requested action with this object has failed.
$oConn.open($line2) 
$oConn.open($line2)^ ERROR

What I doing wrong?

Do I need to install additional modules, drivers ?

Regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.