Forum

Free Download More Info
Welcome to the Personal Stock Streamer Developers Forum. Anyone can read messages, but you must be a registered user in order to post. (Sorry, we did this in order to prevent forum spam.)

Everyone who is registered for the Developers Forum on this site should now also have permission to log in and post to the Support Forum.  This was done by hand, so we may have missed a couple of people.  Please let us know if you do not have access to both forums.
Subscribe to RSS Feed
PSS Developers Forum -> Extensions/DB
Not logged in.
2006-05-28 14:08:56
1 of 3
#741
I was trying to figure out if I could write an extension that could periodically write/read some information to a MySQL database. I'm new at scripting, and looked at some very simple examples, but the server object isn't present, and I can't seem to find any information about how it exists in all the examples I've looked at. So in the example below I get an error back that the server object doesn't exists. Any ideas?

Thanks for any help
-Steve

set myconn = server.createobject("adodb.connection")
   connection = "driver={MySQL};server=localhost;uid=demo;database=mydatabase"
   myconn.open (connection)
   set result = server.createobject("adodb.recordset")
   sql = "SELECT * FROM gazetteer WHERE feature ='" & request("place") & "'"
   set result = myconn.execute(sql)
   if not result.EOF then
   
      response.write("<p>Data for " & request("place"))
      response.write("<table border=2><tr><th>Latitude<th>Longitude<th>Easting<th>Northing")
      while not result.EOF
         response.write("<tr><td>" & result("latitude"))
         response.write("<td>" & result("longitude"))
         response.write("<td>" & result("Easting"))
         response.write("<td>" & result("northing"))
         result.movenext()
      wend
      response.write("</table>")
   else
      response.write("<p>No Entry for " & request("place"))
   end if

-Steve
-Steve
Posted by: sday
2006-05-29 11:39:02
2 of 3
#743
in reply to #741
Steve,

This example looks like it's intended to run in a web server, and won't work in PSS because the object model is completely different; you can't run a script intended for a different environment and expect it to work in PSS. To start with, PSS doesn't have a "server" object, which is why you're getting the error. VBScript has its own CreateObject function that you can call to create the database connection; check the VBScript documentation for. Also, there is no "response" object in PSS since it's not a web server, so that will give you an error as well; you will have to send your output somewhere else.
      
Anatoly Ivasyuk
DTLink Software

Anatoly Ivasyuk
DTLink Software
2006-05-31 00:43:48
3 of 3
#746
in reply to #743
Thanks, I'll do some more research.
      
-Steve
-Steve
Posted by: sday