nznet Posted February 9, 2007 Posted February 9, 2007 Hi Guys, I have searched your forum for my answer and found a couple of helpful topics but none actually answers my problem. I have a PostgreSQL database on another computer and I am trying to access it across the network. I have setup the following in AutoIT: --- Local $oRS Local $oConn $line = 2 $GameNumber = ... number of current game ... $PlayerID = ... name of player ... ; Open Access DB Connection $oConn = ObjCreate("ADODB.Connection") $oRS = ObjCreate("ADODB.Recordset") ;$oConn.Open ("Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\Poker\ptrack.mdb") ;$oConn.Open ("DRIVER={PostgreSQL};SERVER=IP address of server;DATABASE=PokerTracker;USER=postgres;PASSWORD=password;PORT=5432;") $oConn.Open ("ODBC;DRIVER={PostgreSQL};SERVER=IP address of server;DATABASE=PokerTracker;Uid=postgres;Pwd=password;PORT=5432;") ; error appears to be on this line!!! ;Getting Players for current session - Includes VPIP $oRS.Open ("SELECT game.table_name, game_players.player_id, (SELECT players.screen_name from players where game_players.player_id = players.player_id) AS screen_name, game_players.seat_number, game_players.session_id, (SELECT vol_saw_flop/total_hands AS VPIP FROM session WHERE game_players.session_id=session.session_id AND session.player_id=game_players.player_id) AS VPIP FROM game, game_players WHERE (((game.game_number)=" & $GameNumber & ") AND ((game_players.game_id)=[game].[game_id]))", $oConn, 1, 3) $oRS.MoveFirst For $iIndex = 1 To $oRS.RecordCount ;If $oRS.Fields ("ScreenName").value = $PlayerID Then $TableName = $oRS.Fields ("table_name").value $PlayersID = $oRS.Fields ("player_id").value $ScreenName = $oRS.Fields ("screen_name").value $SeatNumber = $oRS.Fields ("seat_number").value $SessionID = $oRS.Fields ("session_id").value $VPIP = Round($oRS.Fields ("VPIP").value * 100, 0) & "%" ;EndIf $oRS.MoveNext Next MsgBox(1, "", "Table Name = " & $TableName & " Players ID = " & $PLayersID & " Screen Name = " & $ScreenName & " SeatNumber = " & $SeatNumber & " Session ID = " & $SessionID & " VPIP = "& $VPIP) $oConn.Close $oConn = 0 ---- I had this working perfectly with Microsoft Access on the local machine but the database got too large and queries took too long. I converted the database to Postgres and it all works fine on the remote computer. The problem is I am trying to convert my AutoIT script to support the PostgreSQL. I have installed the ODBC driver for PostgreSQL on the local computer and had taken the format of the ODBC connection from a sample script incorporating it in to my Access Script format. The popup msgbox error I am getting is: The requested action with this object has failed. My question to you guys is have I gone about writing the script above correctly? Or can you suggest some chnages that may make it work? I would very much appreciate your help... Have a great weekend guys... Cheers, Stephen
evilertoaster Posted February 9, 2007 Posted February 9, 2007 does it say which line it is breaking on?
nznet Posted February 9, 2007 Author Posted February 9, 2007 Hi, Yes, the error appears on this line... the establishment of the ODBC connection. $oConn.Open ("ODBC;DRIVER={PostgreSQL};SERVER=IP address of server;DATABASE=PokerTracker;Uid=postgres;Pwd=password;PORT=5432;") Cheers, Stephen
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now