0

I would like to know how can I create a DataSource for SQL Server on WLP running on Bluemix.

Do you have any example on how to upload the library and also the edited server.xml?

Thanks!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

You would need to push a server rather than the application. You configure the server locally, ensure the application and database driver are inside the server directory and then do cf push of the directory containing the server. The server.xml configuration for the database would look something like this:

<library id="sqlDbLib">
  <fileset dir="${server.config.dir}/lib/sqlDb"/>   
</library>

<jdbcDriver id="sqlDbDriver" libraryRef="sqlDbLib"/>

<dataSource jndiName="jdbc/myDataSource" jdbcDriverRef="sqlDbDriver">
  <properties.microsoft.sqlserver URL="jdbc:sqlserver://host:1433;databaseName=myDB"/>
</dataSource>

The database properties for the properties.microsoft.sqlserver element are documented in the knowledge center

You'll need to ensure the application in bluemix can connect to your SQL server though.

Alasdair
  • 3,071
  • 15
  • 20
  • Hi, thanks for helping, but before this cf push is there any kind of pull that I should do first? I mean, the server.xml file has its settings on Bluemix environment, pushing a server.xml from my local there will override settings, right? Or will be both merged? Thanks! – Gustavo Martim Jan 19 '16 at 09:28
  • It is a merge, but bluemix wouldn't override settings you have unless they are required to tie you into bluemix. In this case since (I assume) the JDBC configuration isn't to a bluemix managed database then it wouldn't be overridden. – Alasdair Jan 19 '16 at 17:11