cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
james_decosta
Level 9

hi i have a problem in minimal and typical install sets

hi,
i am basically preparing two install sets :

Typical
Minimal
In the typical i am giving a user input panel and asking the end user for mysql database parameters like:

server machine username password etc and i check for some specific tables if the tables exist i give a message like "the database contains the required tables for something". Similarily i give a user input panel for minimal install set and prompt the user for Database connection parameters but my problem is when i move in between the install sets,the same dialog appears.
That is say for typical install set i get a dialog saying " the database has the tables required"
But if i move back and give the wrong information or something goes wrong for minimal install set even then i get the same dialog box can someone suggest me where i am going wrong

i am using a custom code for checking the database connection and checking for the existance of tables. what shall i do to avoid this
Labels (1)
0 Kudos
(8) Replies
Yves_Kreis
Level 7

Can you post a sample project?

Probably you are setting a variable which does not get updated or your code only executes once...

Best Regards,
Yves
0 Kudos
james_decosta
Level 9

hi yves,
if i move between the install sets then also the proper message dialog does not appear and within the same install set if i change the fields also then also the proper dialog is not coming properly.
Regards,
James
0 Kudos
james_decosta
Level 9

package com.xxx.roinstaller;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

import com.zerog.ia.api.pub.CustomCodeRule;

public class RODataBaseRuleAnother extends CustomCodeRule {



public final static String DRIVER =ruleProxy.substitute("$DRIVER$");

public final static String URL =ruleProxy.substitute("$URL$");
public final static String USER = ruleProxy.substitute("$USER$");
public final static String PASSWORD = ruleProxy.substitute("$PASSWORD$");
//public final static String PATH_TO_FILE =ruleProxy.substitute("$PATH_TO_FILE$");
//public final static String DEBUG_SQL = ruleProxy.substitute("$DEBUG_SQL$");
public final static String DB_TO_BE_USED=ruleProxy.substitute("$DB_TO_BE_USED$");
private Properties dbprops = new Properties();
private Driver myDriver = null;
private Connection connection = null;
private Statement statement1 = null;

@Override
public boolean evaluateRule() {
// TODO Auto-generated method stub
dbprops.put("user",USER);
dbprops.put("password", PASSWORD);
try {
System.out.println(URL);
System.out.println(DRIVER);
System.out.println(USER);
System.out.println(PASSWORD);
//System.out.println(PATH_TO_FILE);
//System.out.println(DEBUG_SQL);
System.out.println(DB_TO_BE_USED);
myDriver = (Driver)Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL, dbprops);

statement1 = connection.createStatement();
ResultSet stored=statement1.executeQuery("SELECT * FROM yyy.xys_alert r;");
ResultSet storedano=statement1.executeQuery("SELECT * FROM zzzz.xys_dfphttp r;");
System.out.println("passing after the query");
System.out.println(URL);
System.out.println(DRIVER);
System.out.println(USER);
System.out.println(PASSWORD);
return true;

} catch ( ClassNotFoundException cnfe ) {
System.out.println("Unable to load database driver.");
//ruleProxy.getVariable("$USER_INPUT_RESULT_0$");
//ruleProxy.setVariable("$USER_INPUT_RESULT_0$",null);
return false;
} catch ( SQLException sqle ) {
System.out.println("Unable to connect to database.");

return false;

} catch ( IllegalAccessException iae ) {
System.out.println("Unable to access driver.");
return false;
} catch ( InstantiationException ie ) {
System.out.println("Unable to instantiate driver.");
return false;}
catch(Exception ee){return false;}
}

}

This is the rule which i am attaching to the panel for verifying if the database exits and contains the tables.
But it works fine for the first time if i move back and enter different data the same result is getting displayed,please show some way out of this issue
0 Kudos
james_decosta
Level 9

THE install.exe is attached herein
What i am doing is i am giving a user input panel and i ask for
ipaddress of the server machine,
username,
password,
database to be used
,
and then i add an action :
set installanywhere multiple variables action and set these installanywhere variables:
$DB_TO_BE_USED$ EQUALS database to be used
$URL$
$USERNAME$
$PASSWORD$
and then i show the dialog box
probably here i am doing wrong as i am setting installanywhere variables which i am using in the custom code ,if i move back and proceed these installanywhere variables set by me are not getting refreshed.
please suggest me why and show some way out of it.
0 Kudos
james_decosta
Level 9

the iap_xml is here please suggest me or shall i use installanywher variables directly in the code in such a case i need to write the custom code again and again
0 Kudos
Yves_Kreis
Level 7

You declare the variables as final. How should they be refreshed?

Best Regards,
Yves
0 Kudos
james_decosta
Level 9

hi yves,
Ok now i will declare the variables as public static and one more thing
:
I am getting the user input variables and setting the values of $DB_TO_BE_USED$ ,$DRIVER$ after that to these $USER_INPUT_VARIABLES$".
Shall i use the $DB_TO_USED$,$DRIVER$ ETCdirectly in the user input panels.
instead of setting them.
Looking for a suggestion.
0 Kudos
Yves_Kreis
Level 7

I would use them directly...

Best Regards,
Yves
0 Kudos