Jishar13 / pvbeancounter

Automatically exported from code.google.com/p/pvbeancounter
1 stars 0 forks source link

SQL Server 2005 - service won't setup initial settings in database. #110

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Starting the PVBeancounter Service

What is the expected output? What do you see instead?
PVbeancounter shuts down with an error updating 'Version'.

What version of the product are you using (e.g. 1.4.1.9 32bit)?
1.6.0.6

What Operating system (XP, Vista, Windows 7 - 32bit or 64bit)?
Windows 7 (32bit)

Which Database Type (MySQL, MS Access, SQLite - If Access, 32bit or 64bit)?
SQL Server 2005 (32 bit) 

Are there any unusual messages in PVService.log? (upload a copy to this
issue if there are)

9/13/2011 12:13:32 AM :T1 :PVService: PVService loaded - version:1.6.0.6
9/13/2011 12:13:32 AM :T4 :PVService: Start requested
--------------------------------------------------------------------------------
--------------------------------------------------------
Timeline Content
--------------------------------------------------------------------------------
--------------------------------------------------------
Start: 00:00:00 - End: 23:59:00 - Running - EveningSuspend
--------------------------------------------------------------------------------
--------------------------------------------------------
9/13/2011 12:13:42 AM :T6 ExecutionManager :ExecutionStateManager: State: 
Running
9/13/2011 12:13:42 AM :T6 ExecutionManager :InverterManagerManager: 
StartService: connecting to database: 
Server=MSiVX600;Database=PVHistory;Trusted_Connection=True;
9/13/2011 12:13:42 AM :T6 ExecutionManager :ExecutionStateManager: exception: 
UpdateVersion: error updating version table: ExecuteNonQuery: Invalid object 
name 'version'.PVInverterManagement.PVException
9/13/2011 12:13:42 AM :T6 ExecutionManager :ExecutionStateManager: Shutdown 
Requested
9/13/2011 12:13:42 AM :T6 ExecutionManager :ExecutionStateManager: State: 
Shutdown
9/13/2011 12:13:42 AM :T6 ExecutionManager :ExecutionStateManager: Shutdown

Please upload your settings.xml file with the issue. This answers many
questions I would otherwise need to ask.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <host value="localhost\SQLEXPRESS" />
  <database value="PVHistory" />
  <username value="Doug" />
  <password value="hidden" />
  <logfile value="PVService.log" />
  <databasetype value="SQL Server" />
  <providertype value="Proprietary" />
  <providername value="System.Data.SqlClient" />
  <oledbname value="" />
  <connectionstring value="Server=MSiVX600;Database=PVHistory;Trusted_Connection=True;" />
  <defaultdirectory value="D:\PVupload" />
  <defaultmanagertype value="Sunny Explorer" />
  <pvoutputapikey value="f9839bae194347c77e13fbcac49f3262a25baf03" />
  <pvoutputsiteid value="3712" />
  <servicestarttime value="06:00:00" />
  <servicestoptime value="23:00:00" />
  <servicewakeinterval value="00:23:00" />
  <servicesuspendinterval value="01:37:00" />
  <servicesuspendtype value="sleep" />
  <enablepvoutput value="true" />
  <logtrace value="" />
  <appliancelist>
    <appliance>
      <applianceno value="0" />
      <storereading value="true" />
      <isconsumption value="true" />
      <isinverteryield value="" />
      <adjusthistory value="true" />
      <storehistory value="" />
      <calibrate value="1" />
    </appliance>
    <appliance>
      <applianceno value="1" />
      <storereading value="true" />
      <isconsumption value="" />
      <isinverteryield value="" />
      <adjusthistory value="true" />
      <storehistory value="" />
      <calibrate value="1" />
    </appliance>
    <appliance>
      <applianceno value="2" />
      <storereading value="" />
      <isinverteryield value="" />
      <isconsumption value="" />
      <adjusthistory value="" />
      <storehistory value="" />
      <calibrate value="1" />
    </appliance>
    <appliance>
      <applianceno value="3" />
      <storereading value="" />
      <isinverteryield value="" />
      <isconsumption value="" />
      <adjusthistory value="" />
      <storehistory value="" />
      <calibrate value="1" />
    </appliance>
    <appliance>
      <applianceno value="4" />
      <storereading value="" />
      <isinverteryield value="" />
      <isconsumption value="" />
      <adjusthistory value="" />
      <storehistory value="" />
      <calibrate value="1" />
    </appliance>
    <appliance>
      <applianceno value="5" />
      <storereading value="" />
      <isinverteryield value="" />
      <isconsumption value="" />
      <adjusthistory value="" />
      <storehistory value="" />
      <calibrate value="1" />
    </appliance>

Please provide any additional information below.

Connection Server=MSiVX600;Database=PVHistory;Trusted_Connection=True;

Original issue reported on code.google.com by doug.f...@aanet.com.au on 12 Sep 2011 at 2:29

GoogleCodeExporter commented 8 years ago
Before using SQL Server as the database you must create the required Database, 
Schema, Tables and Views.

There is a script available in the downloads area that will assist. This script 
was created using "SQL Server 2008 R2 Management Studio". You do need to be 
familiar with database creation activities to do this. The initial database 
creation process is not automatic.

The "version" table is the first table accessed when PVBC starts. It is used to 
control minor modifications to the database schema required from time to time.

Dennis M-F

Original comment by DennisMackayFisher on 12 Sep 2011 at 8:27

GoogleCodeExporter commented 8 years ago
Thanks for your prompt reply.

I have already run this script.  The only error was with the compatability
mode = 90 instead of 100 (SQL 2005).

The tables and view all exist. (I am familiar with the SQL Server
Enterprise Management studio and SQL Server Databases)

I did have some issues with getting the Service to connect to the database
but I have given the local account read/write access now it seems to
connect.  I am at work during the day but have a sneeking suspicion that I
may not have set the default database in which case it will be pointing to
Master rather than PVHistory.  If that is not the case then I have no
idea.

Original comment by doug.f...@aanet.com.au on 13 Sep 2011 at 1:22

GoogleCodeExporter commented 8 years ago
Doug
If you press setup/check environment does it pass those checks ok? I had some 
troubles with my setup with SQL 2008, and I think I saw a similar sort of 
message when I didn't have the default schema set correctly. I note it says 
"Invalid object name 'version'", the table is actually pvhistory.version so if 
the schema isn't right then this will cause a problem.  You need to have the 
default database and schema set.
Jamie

Original comment by sportsfr...@gmail.com on 13 Sep 2011 at 4:10

GoogleCodeExporter commented 8 years ago
If you upgrade to 1.7.0.3 (or later) the PVBC configuration program checks read 
access to the database when you Save Settings or Setup / Check Environment. 
This makes checking your changes faster / easier.

Dennis M-F

Original comment by DennisMackayFisher on 13 Sep 2011 at 12:08

GoogleCodeExporter commented 8 years ago
Is this resolved now?

Version 1.7.0.9 has been released

Dennis M-F

Original comment by DennisMackayFisher on 21 Sep 2011 at 10:08

GoogleCodeExporter commented 8 years ago
Dennis,
The setup/check did not pass so I have started from scratch.  I downloaded the 
latest version 1.7.0.9. and installed it. 

I now get this error -
Database Test - Stage: Executing data reader - Exception: Invalid object name 
'pvoutputlog'

The table pvhistory.pvoutputlog does exist, but I had to change the data type 
to datetime for Outputday because 'Date' is not valid in SQL Server 2005.

Original comment by doug.f...@aanet.com.au on 27 Sep 2011 at 2:14

GoogleCodeExporter commented 8 years ago
I have now installed mySQL and get a little further.
My current problem is connecting to the SMA inverter -
Here is an extract from my log file which seems to point to the error 

CSV-Export: establishing connection to plant failed!

see more detail below -

10/1/2011 10:56:34 PM :T11 PVOutput/3712 :GenDatabase.ConnectionClosed: id: 13 
- creation thread: 11 - closing thread: 11 - count: 1
10/1/2011 10:56:52 PM :T10 SunnyExplorerInverterManager 
:SunnyExplorerExtractCSV: SunnyExplorer Completed: exit code = 0
10/1/2011 10:56:52 PM :T10 SunnyExplorerInverterManager 
:SunnyExplorerExtractCSV: Sunny Explorer - Standard Output: 
CSV-Export: establishing connection to plant ...
CSV-Export: establishing connection to plant failed!
10/1/2011 10:56:52 PM :T10 SunnyExplorerInverterManager 
:SunnyExplorerExtractCSV: Sunny Explorer - Error Output: 
[01.10.2011 12:59:03.122] [SetAdapterCommand] command 1156 on adapter 16 with 
result 0
[01.10.2011 12:59:03.123] [CAdptrMgrWorker::DispatchCmd] command 1156
[01.10.2011 12:59:03.123] [CAdptrMgrWorker::DispatchCmd] All needed records 
have been created with res = 0
[01.10.2011 12:59:03.252] [CAdptrMgrWorker::UpdateStatus] status 1148
[01.10.2011 12:59:03.272] [WaitForAdapterStatus] result 1148
[01.10.2011 12:59:03.272] [SetAdapterCommand] command 1157 on adapter 16 with 
result 0
[01.10.2011 12:59:03.273] [CAdptrMgrWorker::DispatchCmd] command 1157
[01.10.2011 12:59:14.278] [CAdptrMgrWorker::UpdateStatus] status 1212
[01.10.2011 12:59:14.307] [WaitForAdapterStatus] result 1212
10/1/2011 10:56:52 PM :T10 SunnyExplorerInverterManager 
:SunnyExplorerExtractCSV: returning
10/1/2011 10:56:52 PM :T10 SunnyExplorerInverterManager 
:GenDatabase.NewConnection: Connection created - id: 14 - thread: 10 - count: 2
10/1/2011 10:56:52 PM :T10 SunnyExplorerInverterManager :FindCompleteDays: 
limit day: 10/1/2011 12:00:00 AM

Original comment by doug.f...@aanet.com.au on 1 Oct 2011 at 1:06

GoogleCodeExporter commented 8 years ago
Read this Wiki section:
http://code.google.com/p/pvbeancounter/wiki/SolvingBluetoothIssues

I would start by changing the PVBC service account from Local Service to System.

Dennis M-F

Original comment by DennisMackayFisher on 1 Oct 2011 at 9:47

GoogleCodeExporter commented 8 years ago
Dennis,

This has worked and it is now all working - what a great system.  Thanks for
your support.

I am new to mySQL but it is working OK and will probably stay with it
despite having initially started with MS SQL Server 2005.

Thanks again for your help.

Doug Ford

Original comment by doug.f...@aanet.com.au on 2 Oct 2011 at 9:08

GoogleCodeExporter commented 8 years ago

Original comment by DennisMackayFisher on 17 Oct 2011 at 9:35