Michael Neumann
1/7/2005 3:25:00 AM
Ernest Ellingson wrote:
> Ernest Ellingson wrote:
>
>> Michael Neumann wrote:
>>
>>> Ernest Ellingson wrote:
>>>
>>>> I've installed the windows version of ruby-1.8.2 with the latest
>>>> one-click installer. I used gem to install postgres-pr-0.3.2.
>>>> However, I can't seem to get any of the examples to run. I'm
>>>> getting a
>>>>
>>>> uninitialized constant StartupMessage (NameError) in client.rb
>>>
>>>
>>>
>>>
>>>
>>> I fixed that. put a "include PostgresPR" after the requires and it
>>> works. Try postgres-pr-0.3.3.
>>>
>>>> The require statements are:
>>>> $LOAD_PATH.unshift "../lib"
>>>> requie 'rubygems'
>>>> require 'postgres-pr/message'
>>>> require 'socket'
>>>>
>>>> The first two lines of code are
>>>>
>>>> s = UNIXSocket.new(ARGV.shift || "/tmp/.s.PGSQL.5432")
>>>>
>>>> msg = StartupMessage.new(196608, "user" => "mneumann", "database" =>
>>>> "mneumann")
>>>>
>>>> I can't use a UNIXSocket because I'm not running Cygwin. However, I
>>>> don't see any requirements in postgres-pr/message.rb for (s).
>>>> Am I missing something?
>>>
>>>
>>>
>>>
>>> I don't understand your question... Maybe... The UNIXSocket is only
>>> used in the example, you can use postgres-pr/connection.rb without a
>>> UNIXSocket, with a TCPSocket. That's no problem.
>>>
>>>> Does someone have any experience using postgres-pr in the dbi. If so,
>>>> How does one connect to a server?
>>>
>>>
>>>
>>>
>>> Just use DBD::Pg. I've not tried it. But I know that it works with
>>> ActiveRecord and Og.
>>>
>>> Regards,
>>>
>>> Michael
>>>
>>>
>>>
>> Thanks Michael, I'll give it a whirl and let you know how things
>> worked out.
>> Ernie
>
> Something's still fowled up. I installed postgres-pr.0.3.3 using gem
> install. I uninstalled postgres-pr-0.3.2 using gem.
> There is no Pg driver in the DBD directory.
>
> dbi was installed with the one click windows installer not with gem.
> Should I just install postgres-pr.0.3.3 without using gem?
> Should I install the dbi using gem?
DBI via gem is not (yet) available.
And, postgres-pr is NOT a DBD! It has a compatibility layer to
postgres.so (the C-interface to Postgres), but that's not 100%
compatible as my focus was on getting ActiveRecord and Og working with
it. I've not tested postgres-pr with DBD::Pg (DBI). It might fail!
> How do I go about getting the Pg driver installed in the DBD directory.
You should not remove the Pg.rb driver!
> If I'm running a script from some other directory other than the example
> directory, what requires do I need? Up to now I've only had to require
> 'dbi' when using ODBC.
Again, postgres-pr has nothing to do with DBI. If it would be 100%
compatible to postgres.so, you should be able to just use the DBD::Pg
with a simple require 'dbi' and then DBI.connect("dbi:g:...").
> I ran the client.rb program after changing the socket to a TCPsocket. My
> system started thrashing. Page files jumped to 1.24GB that's right GIGA
> BYTES. Thrashed for a while and then just hung there. PF dropped back
> to 144MB. What's that all about?
I don't know. It works fine on my machine. Would you try
test_connection.rb? But note, that you should change the connection
parameters and make sure, you don't destroy data in your database!
Does it work?
Regards,
Michael