Skip to main content
17-Peridot
January 17, 2020
Question

Where is the data file for connecting to the database?

  • January 17, 2020
  • 1 reply
  • 2620 views

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

1 reply

14-Alexandrite
January 17, 2020

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"/>
 
VladiSlav17-PeridotAuthor
17-Peridot
January 20, 2020

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();
 }

 

14-Alexandrite
January 20, 2020

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.