Hi,
Scheduler example “01_basic_init.html” works as expected with Mysql. But when I changed the connector to MSsql (sqlsrv) (MSSql 2008 server), then I got a problem.
When running the example, it correctly loads the data from MSSQL into the scheduler, but it refuses to save new or updated events.
I modified “01_basic_init_connector.php” as follows:
<?php
// include ('../config.php');
include ('../../codebase/scheduler_connector.php');
include ('../../codebase/db_sqlsrv.php');
$connectionInfo = array( "UID"=>"sa", "PWD"=>"password", "Database"=>"sampledb");
$res = sqlsrv_connect( "(LOCAL)",$connectionInfo );
// $res=mysql_connect($mysql_server,$mysql_user,$mysql_pass);
// mysql_select_db($mysql_db);
$scheduler = new schedulerConnector($res,"sqlsrv");
//$scheduler->enable_log("log.txt",true);
$scheduler->render_table("events","event_id","start_date,end_date,event_name,details");
?
I copied the data from Mysql to MSsql. But the event_id was a normal integer (not a identity field). (Is the increment of the event-id handled automatically?)
I tried uncommenting enable_log, but it gave an error: "failed to open stream: Permission denied"
Can you please help me what I did wrong?
IIS 7.5 / Windows 7 64 bit / MSSQL 2008
Thanks,
Koen
In case of MsSQL you need to create event_id as identity field. Connector doesn’t generate new IDs, it expects that new id value will be assigned by database.
As for log error - check that directory has write access ( or set path in enable_log to some writable directory )
Common error in case of MsSQL - it uses the different format for date formatting, so you need to change scheduler.config.xml_format on client side, but if loading works - it must not be your case.