How can I use a model with database operations in java ?

Use this forum to post Vensim related questions.
Post Reply
lifan2010
Junior Member
Posts: 6
Joined: Wed Oct 08, 2014 5:48 am
Vensim version: DSS

How can I use a model with database operations in java ?

Post by lifan2010 »

hi.
I can run java example comes ; java example of the model will address modification model for database operations can not run my establishment .
But vensim mine is running .
Can anyone tell me how to do ?
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: How can I use a model with database operations in java ?

Post by Administrator »

I do not understand your question.

Can you explain again? Can you upload your model?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
lifan2010
Junior Member
Posts: 6
Joined: Wed Oct 08, 2014 5:48 am
Vensim version: DSS

Re: How can I use a model with database operations in java ?

Post by lifan2010 »

Administrator wrote:I do not understand your question.

Can you explain again? Can you upload your model?

oh,sorry.
My English is poor.

java
-------------------------------------------------
result = vensim.command( "SPECIAL>LOADMODEL|C:\\Documents and Settings\\All Users\\Vensim\\odbc2\\odbctest.vpm" );
result = vensim.command( "SIMULATE>RUNNAME|1" );
result = vensim.command( "MENU>RUN|O" );

when it runs,some error like that
---------------------------
Stop from Vensim
---------------------------
Problems encountered in the simulation.
---------------------------
enter
---------------------------

the model can run in vensim dss.
Attachments
odbc2.zip
(1.44 MiB) Downloaded 165 times
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: How can I use a model with database operations in java ?

Post by Administrator »

What values are you getting for "result"? It should be =1 if the command has executed properly.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
lifan2010
Junior Member
Posts: 6
Joined: Wed Oct 08, 2014 5:48 am
Vensim version: DSS

Re: How can I use a model with database operations in java ?

Post by lifan2010 »

Administrator wrote:What values are you getting for "result"? It should be =1 if the command has executed properly.
result = vensim.command( "MENU>RUN|O" );
After executing the above code
result = 0
before result value is 0 ,there has two dialog ("确定" it means ok or enter):
QQ20141009093019.jpg
QQ20141009093019.jpg (62.9 KiB) Viewed 4190 times
when i click "确定" button,it will pop the other dialog:
QQ20141009093037.jpg
QQ20141009093037.jpg (64.78 KiB) Viewed 4190 times
My java code logic is right?
Is there any conditions need to be set in advance ?
lifan2010
Junior Member
Posts: 6
Joined: Wed Oct 08, 2014 5:48 am
Vensim version: DSS

Re: How can I use a model with database operations in java ?

Post by lifan2010 »

QQ20141009095703.jpg
QQ20141009095703.jpg (58.46 KiB) Viewed 4190 times
this is the publish .vpm file dialog.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How can I use a model with database operations in java ?

Post by tomfid »

Are you using a recent version? There were some problems in the ODBC example prior to 6.2 or 6.3, as I recall.
lifan2010
Junior Member
Posts: 6
Joined: Wed Oct 08, 2014 5:48 am
Vensim version: DSS

Re: How can I use a model with database operations in java ?

Post by lifan2010 »

tomfid wrote:Are you using a recent version? There were some problems in the ODBC example prior to 6.2 or 6.3, as I recall.

oh,the version is 6.1c .
I will try the recent version.

thank you
lifan2010
Junior Member
Posts: 6
Joined: Wed Oct 08, 2014 5:48 am
Vensim version: DSS

Re: How can I use a model with database operations in java ?

Post by lifan2010 »

I using the recent version,the result is 0 too.

Whether that version the .vpm file run in java alway show me the .vdf file is protected,when I choose another one,it can run and delete .vdf file what I choose.

Is it a bug?
or
I operate it in the wrong way.

help!!!
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: How can I use a model with database operations in java ?

Post by Administrator »

When you publish, do not include any files and untick the "Settings" box.

What value to you get for "result" when you open the model?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: How can I use a model with database operations in java ?

Post by tomfid »

Also, using "1" for the runname is theoretically OK, but potentially troublesome, because that means your vdf will be named 1.vdf, which might have side effects. Can't say as I don't do it.
Post Reply