Sign in to follow this  
Followers 0
silvano

ODBC error

9 posts in this topic

hi,

i have this code

$conn = ObjCreate( "ADODB.Connection" )

$conn.Open( "DSN=SISSI" )

this play very good with acces DB but return one error with sybase DB

the message that return with MyErrFunc()

like this:

err.description is: [sybase][ODBC Driver][Adaptive Server Anyware] Syntax error or access violation: Request to start/stop database denied

tks

Share this post


Link to post
Share on other sites



Try this:
$conn = ObjCreate("ADODB.Connection")
$conn.Open("Provider=ASAProv;Data source=SISSI")oÝ÷ Ûú®¢×­©äʺÛayÊz·­º¹íëç«®Èë-²Ú)¶¬z»âq뢶që»­Éè¶É®Ü¬¢[­ðéâ«Þ²Ú)¥çlz»âqëºÙ²ªç«Ê·­º¹í+®º+jëh×6$adors.Open( "select COUNTRY_ID,COUNTRY_NAME from countries WHERE COUNTRY_ID='US'", $conn )
While not $adors.EOF
    MsgBox(0, "Result", "ID = " & $adors.Fields("COUNTRY_ID") .Value & " - COUNTRY = " & $adors.Fields("COUNTRY_NAME") .Value)
    $adors.MoveNext
WEnd
$ado.closeoÝ÷ ÙêëÂ)ÝzÇ+b¢uZ®&鮲ÖÞ¡ûr¥íý9¸ÞrÝý¶¬É²r©ë^±Êâ¦Ö®¶­sc²b33c¶6öæâÒö&¤7&VFRgV÷C´DôD"ä6öææV7FöâgV÷C²£²b33c¶6öæâä÷VâgV÷C´E4ãÕ454gV÷C² ¢b33c¶6öæâÒö&¤7&VFRgV÷C´DôD"ä6öææV7FöâgV÷C²¢b33c¶6öæâä÷VâgV÷Cµ&÷fFW#Ô4&÷c´FF6÷W&6SÕ454gV÷C² £·FRVW'âââ

tks

Share this post


Link to post
Share on other sites

Can you provide a short but complete code sample that generates the error? You've got $conn, and then $adors which doesn't appear to be declared, and then $ado, which appears to be a mistake?


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

Can you provide a short but complete code sample that generates the error? You've got $conn, and then $adors which doesn't appear to be declared, and then $ado, which appears to be a mistake?

this is the complete code

$objErr = ObjEvent("AutoIt.Error","MyErrFunc")
Func MyErrFunc()

$hexnum=hex($objErr.number,8)

Msgbox(0,"","We intercepted a COM Error!!"        & @CRLF                   & @CRLF & _
             "err.description is: "    & $objErr.description    & @CRLF & _
             "err.windescription is: " & $objErr.windescription & @CRLF & _
             "err.lastdllerror is: "   & $objErr.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & $objErr.scriptline     & @CRLF & _
             "err.number is: "         & $hexnum                 & @CRLF & _
             "err.source is: "         & $objErr.source         & @CRLF & _
             "err.helpfile is: "       & $objErr.helpfile       & @CRLF & _
             "err.helpcontext is: "    & $objErr.helpcontext _
            )
exit
EndFunc


dim $adors
Dim $ado

;$ado = ObjCreate( "ADODB.Connection" )

;$ado.Open( "DSN=SISSI" )

$ado = ObjCreate("ADODB.Connection")
$ado.Open("Provider=ASAProv;Data source=SISSI")

$adors.Open( "SELECT pag_a,pag_n FROM 'sissi'.'tb_pag' where pag_n='249' and pag_a='2007'", $ado )

While not $adors.EOF
    MsgBox(0, "Result", "ID = " & $adors.Fields("COUNTRY_ID") .Value & " - COUNTRY = " & $adors.Fields("COUNTRY_NAME") .Value)
    $adors.MoveNext
WEnd
$ado.close

Share this post


Link to post
Share on other sites

Well, you've definitely got some bugs there. Try this:

$objErr = ObjEvent("AutoIt.Error","MyErrFunc")
Func MyErrFunc()

$hexnum=hex($objErr.number,8)

Msgbox(0,"","We intercepted a COM Error!!"        & @CRLF                   & @CRLF & _
             "err.description is: "    & $objErr.description    & @CRLF & _
             "err.windescription is: " & $objErr.windescription & @CRLF & _
             "err.lastdllerror is: "   & $objErr.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & $objErr.scriptline     & @CRLF & _
             "err.number is: "         & $hexnum                 & @CRLF & _
             "err.source is: "         & $objErr.source         & @CRLF & _
             "err.helpfile is: "       & $objErr.helpfile       & @CRLF & _
             "err.helpcontext is: "    & $objErr.helpcontext _
            )
exit
EndFunc




$ado = ObjCreate("ADODB.Connection")
$ado.Open("Provider=ASAProv;Data source=SISSI")

$adors = $ado.execute("SELECT pag_a,pag_n FROM 'sissi'.'tb_pag' where pag_n='249' and pag_a='2007'")
While not $adors.EOF
    MsgBox(0, "Result", "ID = " & $adors.Fields("COUNTRY_ID").Value & " - COUNTRY = " & $adors.Fields("COUNTRY_NAME").Value)
    $adors.MoveNext
WEnd

$adors=0
$ad0=0

Your query looks suspect, but maybe it works in sybase? 'sissi'.'tb_pag' seems pretty weird.


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

Your query looks suspect, but maybe it works in sybase? 'sissi'.'tb_pag' seems pretty weird.

it work!! thank you very much!!

'sissi'.'tb_pag' work without ' ' --> sissi'.'tb_pag

but now there is another broblem...

if I don't stop the service Adaptive Server Anywhere the script don't work...

return the error:

access violation: Request to start/stop database denied

I don't can stop the service because the service is running on the server... I must connect to DB from client

are you the solution?

tks and sorry for my bad english

Share this post


Link to post
Share on other sites

I don't know. It seems like your database only allows one client at a time. It's a Sybase problem, and I do not know how to fix it.


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

I don't know. It seems like your database only allows one client at a time. It's a Sybase problem, and I do not know how to fix it.

thaks,

now i setting option to odbc or db manager

bye

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  
Followers 0