cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Where is the data file for connecting to the database?

VladiSlav
17-Peridot

Where is the data file for connecting to the database?

Hello everyone, please tell me which file contains the data to connect to the database?
I want to change the data to others

6 REPLIES 6

There are a few lines to modify. The best place to do this is in the site.xconf and then run "xconfmanager -p" in shell command after to push the changes to the correct files. 

 

   <Property name="wt.db.dataStore" overridable="true" targetFile="codebase/wt.properties"
             value="SQLServer"/>
   <Property name="wt.pom.jdbc.service" overridable="true" targetFile="db/db.properties"
             value="WNCHV"/><!--This is the instance name. Only used if you have multiple DBs on the same server.-->
   <!--Setting the property wt.pom.dbUser during upgrade processing.--><Property name="wt.pom.dbUser" overridable="true" targetFile="db/db.properties"
             value="windchill"/><!--Windchill DB user.-->
   <!--Setting the property wt.pom.dbPassword during upgrade processing.--><Property name="wt.pom.dbPassword" overridable="true" targetFile="db/db.properties"
             value="encrypted.wt.pom.dbPassword"/>
   <!--Setting the property wt.pom.jdbc.database during upgrade processing.--><Property name="wt.pom.jdbc.database" overridable="true" targetFile="db/db.properties"
             value="windchill"/><!--name of the database.-->
   <!--Setting the property wt.pom.jdbc.port during upgrade processing.--><Property name="wt.pom.jdbc.port" overridable="true" targetFile="db/db.properties"
             value="00000"/><!--This is the service port you database is running on. Only used if you are running multiple DBs on the same server.-->
   <!--Setting the property wt.pom.jdbc.host during upgrade processing.--><Property name="wt.pom.jdbc.host" overridable="true" targetFile="db/db.properties"
             value="serverHost"/>
 

Hello,  AndyHermanson,can I use regular SQL queries?

 

I'm currently making a separate connection to the database, but it's not secure

private Connection getConnection() throws SQLException {
		String connectionUrl = "jdbc:sqlserver://%1$s;databaseName=%2$s;user=%3$s;password=%4$s;";
        String instanceName = "SERVER\\WINDCHILL";
        String databaseName = "wcuser";
        String userName = "adm";
        String pass = "adm";
        String connectionString = String.format(connectionUrl, instanceName, databaseName, userName, pass);

        Connection con = DriverManager.getConnection(connectionString);
		return con;
	}

 

        try(Connection con = getConnection();
        		Statement stmt = con.createStatement()) { 
            ResultSet executeQuery = stmt.executeQuery("INSERT INTO [wcuser].[Test]" + 
                        "([code],[name],[matId])" +
        		"VALUES(0,'test',1)"); 
        } catch (SQLException e) {
            e.printStackTrace();
        }

 

What are you trying to do? Are you just trying to parse some data or connect a Windchill instance to a different database? 

 

If you are trying to parse the Database we actually just replicate the Database into our MDM system and then they can do what they want to the data, but yes you can just connect to the DB using the management studio and running queries. 

 

If you are trying to connect a Windchill instance to the DB, then you need to modify your Windchill installation to point at the DB like i posted before.

 

AndyHermanson, I want to work with the database that Windchill is connected to by default.
I created tables in this database, now I want to fill them with data via java, but I can't find examples of how to write complex queries using Windchill rules

Ok, that goes beyond my knowledge. I am by no means a DBA. I hand that stuff off to our data team. Sorry I can't help you more. 

 

AndyHermanson,thank you very much for the information
Top Tags