nikhilgupta10 / GridLAB-D

Other
1 stars 0 forks source link

#918 having more than one database in the glm causes a connection error, #2644

Open nikhilgupta10 opened 7 years ago

nikhilgupta10 commented 7 years ago

Can we have two databases in the glm file (one recorders and one for players)? I have two database but I get this error: (they have different name but I get this error)

ERROR [INIT] : init_database(obj=1;pedram_mysql1): pedram_mysql1: mysql conne
ct failed - This handle is already connected. Use a separate handle for each con
nection.
ERROR [INIT] : init_by_deferral(): object pedram_mysql1 initialization failed
object database {
  name pedram_mysql_player;
  schema \gridlabd\;
  hostname \localhost\;
  username \gridlabd\;
  password \;
  port 3306;
}
object database {
  name pedram_mysql1;
  schema 
ecorder\;
  port 3306;
  on_init \./sql/test_mysql_recorder_init.sql\;
  options NEWDB;
}

,

nikhilgupta10 commented 7 years ago

nikhilgupta10 imported these comments from Sourceforge: The user dchassin does not exist anymore. Therefore assigning this to afisher1. "dchassin":- Description has changed:

Diff:


--- old
+++ new
@@ -1,31 +1,25 @@
-Can we have two databases in the glm file (one recorders and one for players). I have two database but I get this error: (they have different name but I get this error) 
+Can we have two databases in the glm file (one recorders and one for players)? I have two database but I get this error: (they have different name but I get this error) 
+
+~~~~~
 ERROR [INIT] : init_database(obj=1;pedram_mysql1): pedram_mysql1: mysql conne
 ct failed - This handle is already connected. Use a separate handle for each con
 nection.
 ERROR [INIT] : init_by_deferral(): object pedram_mysql1 initialization failed
 object database {
-name pedram_mysql_player;
-schema \gridlabd\;
-hostname \localhost\;
-username \gridlabd\;
-password \;
-port 3306;
+  name pedram_mysql_player;
+  schema \gridlabd\;
+  hostname \localhost\;
+  username \gridlabd\;
+  password \;
+  port 3306;
 }
 object database {
-name pedram_mysql1;
-schema 
ecorder\;
-port 3306;
-on_init \./sql/test_mysql_recorder_init.sql\;
-options NEWDB;
+  name pedram_mysql1;
+  schema 
ecorder\;
+  port 3306;
+  on_init \./sql/test_mysql_recorder_init.sql\;
+  options NEWDB;
 }
+~~~~~

-
-David comment:
-I suggest trying the following change to mysql/database.h (sorry but I don't have complex enough database environment to try multiple connections).
-   delete line 45 \EXTERN MYSQL *mysql_client INIT(NULL);\n-   add \    MYSQL *mysql_client;\ after line ~69 \MYSQL *mysql;\n-Recompile and test. Hopefully this gives each \database\ object its own handle. Advantage: it works for many databases. Disadvantage: it creates multiple connections for a single database. Seems ok on balance.
-
-
-
   delete line 45 \EXTERN MYSQL *mysql_client INIT(NULL);\r
   add \    MYSQL *mysql_client;\ after line ~69 \MYSQL *mysql;\r

Recompile and test. Hopefully this gives each \database\ object its own handle. Advantage: it works for many databases. Disadvantage: it creates multiple connections for a single database. Seems ok on balance for case where you don't have too many player or recorder object per connection.

,

"dchassin":- summary: having more than one databases in the glm --> having more than one database in the glm causes a connection error ,

"dchassin":Trunk is fixed in r4894 and branch/3.1 is fixed in r4895. This fix will probably not be release as a patch for the 3.1 download unless there is another bug that justifies making another release of 3.1. It will be part of the 3.2 release.,

"dchassin":- Resolution: none --> validate ,

"dchassin":- Milestone: Unscheduled --> Version 3.2 RC1 ,

"dchassin":The fix was incorporated into 3.2.,

"dchassin":- Status: accepted --> assigned