Friday, June 30, 2006

ASP and PostgreSQL quick snippet

Hi, here is a small snippet to connect to PostgreSQL from an ASP page and run a select query.

  1. dim adoConn
  2. dim adoRS
  3. dim counter
  4. set adoConn = Server.CreateObject("ADODB.Connection")
  5. set adoRS = Server.CreateObject("ADODB.Recordset")
  6. strConn = "Provider=PostgreSQL.1;Data Source=localhost;location=postgres;" & _
  7. "User Id=login_role;password=login_role_password;"
  8. adoConn.Open strConn
  9. adoRS.ActiveConnection = adoConn
  10. if adoConn.errors.count = 0 then

  11. adoRS.Open "select * from phpbb.phpbb_users"
  12. while not adoRS.EOF
  13. response.write adoRS.fields(0).value
  14. adoRS.MoveNext
  15. wend
  16. else
  17. response.write "ERROR: Couldn't connect to database"
  18. end if

Probably the most interesting thing is the connectionstring where:
Localhost is the server
postgres is the database
login_role is ... the login role AKA username
and in the query phpbb is the schema.
To avoid access denied errors you'll have to grant proper rights to the phpbb schema to user login_role, like :

GRANT ALL privileges ON schema phpbb TO login_role;

Sunday, June 25, 2006

Hardware upgrades are good!

Hi there, working in the IT sector and standing in front of my laptop every day for many hours brought me to forget about my home desktop, used by my parents and expecially about their old CRT 17'' monitor.
I kept thinking it was a bit old but generally good, now I switched to a 17'' LCD display and I have to say that is's waaaaay much better, more environment friendly, more desk space friendly, more ... well, I increased the res to 1280x1024 from 1024x768 and that is the biggest improvement, even if I have to say that I'm probably on the edge as not too many web sites seem to be designed with that kind of res in mind.

Sunday, June 18, 2006

I love it!!

After the Olympics Turin has become a very nice place to stay, here is another great day

I'd love an LX 125cc 4t to speed through the city.

Saturday, June 10, 2006

Being a mod means ...

receiving a little gift from the owners of the site ;-) which is very much appreciated.
In my case the first gift turned into this book about composites.
Don't be fooled by the title, I'm more into the sailing or skiing
side of composites, but it's a nice book.

An year after I got another nice one, "The Design of Everyday Things", well I just received it and haven't had the time to even take a peek at it's content
but I love the whole idea of how design can be a great part of even the simplest thing.

Now if I only could discover why I'm charged an extra 5€ (the postal service asked me that money) for each book bought at ...