How to connect Liferay with Mysql Database - database

I am new in Liferay. I want to connect Liferay with MySQL database. I am using Liferay CE (Version? - came bundled with tomcat (6.0.29)). Please tell me the steps for this. Thank you

To build upon what has already been mentioned already, edit the file portal-ext.properties found in liferay-portal-xxx/tomcat-xxx/webapps/ROOT/WEB-INF/classes (if it doesn't exist already then create it).
Add these lines to it:
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=<insert your mysql username>
jdbc.default.password=<insert your mysql password>
It also might be worth creating the lportal table in mysql.
mysql -u root -p <<< "create database lportal character set utf8;"
Download and extract the Liferay database scripts found here. Then run one, e.g.
mysql -u root -p < /path-to-the-script/create-mysql.sql
More information can be found in this Liferay Ubuntu Installation Guide (be weary as it's for an version but the database section is useful) and this Liferay Database Configuration Guide.

Paste the following line of code in portal-ext.properties:
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=
jdbc.default.password=

Download Liferay CE
Install MySQL and create a database
Unzip liferay and create file if no exist portal.properties into liferay_home/tomcat-6.0.29/webapps/ROOT/WEB-INF/clases
Paste this:
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/nameDatabase?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=name
jdbc.default.password=password
Run onm Eclipse, or Windows .bat/Linux .sh
i hope works for you

1)path--->home/karthik/Desktop/LiferaySetup/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes---->create an empty doc with name as portal-ext.properties
paste the below code:
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=root
2)path--->/home/karthik/Desktop/LiferaySetup/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/conf/Catalina/localhost-->Enter the below code inside ROOT.xml
<Context path="" crossContext="true">
<!-- JAAS -->
<!--<Realm
className="org.apache.catalina.realm.JAASRealm"
appName="PortalRealm"
userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal"
roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole"
/>-->
<!--
Uncomment the following to disable persistent sessions across reboots.
-->
<!--<Manager pathname="" />-->
<!--
Uncomment the following to not use sessions. See the property
"session.disabled" in portal.properties.
-->
<!--<Manager className="com.liferay.support.tomcat.session.SessionLessManagerBase" />-->
<Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8"
username="root"
password="root"
maxActive="20"
/>
</Context>
If you follow the above 2 statements you can create easily

Related

How to configure p6spy for mssql server with hibernate?

In our web application we are using spring, hibernate & sql server 2016 as db. We are using jndi to connect to the database. To record all the queries executed by hibernate I am trying to implement the p6spy.
Here are the changes I have made.
Changed the resource information from
<Resource name="jdbc/eportalcore" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databaseName=eportal-core;"
username="eportaldbadmin"
password="P#ssw0rd"
maxTotal="100"
maxIdle="20"
minIdle="5"
maxWaitMillis="10000" />
to
<Resource name="jdbc/eportalcore" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.p6spy.engine.spy.P6SpyDriver"
url="jdbc:p6spy:sqlserver://localhost:1433/eportal-core"
username="eportaldbadmin"
password="P#ssw0rd"
maxTotal="100"
maxIdle="20"
minIdle="5"
maxWaitMillis="10000" />
and added the spy.properties file under lib folder of tomcat directory. Also I have placed the p6spy-3.0.0.jar too inside the lib folder.
But after this my application is not getting connected to the DB. What mistake I am doing here? If I remove this changes then it is working fine.
Any suggestions?
I had the same question and here is what I did to make it work. Note my Database connection properties are in a property file (shouldn't be an issue) and that I use tomcat as an Application Server. You can also add P6Spy as a Maven dependency in your project.
Before :
db.properties
db.driver=net.sourceforge.jtds.jdbc.Driver
db.url=jdbc:jtds:sqlserver://${db.server}/${db.name};useNTLMv2=true;domain=XX
After :
Download(latest version when writing this response) the project. Put the p6spy-3.7.0.jar and spy.properties in the tomcat/lib folder. Change the spy.properties and application properties as noted under. Restart application and you should find a spy.log where your logs are printed normally.
db.properties
db.driver=com.p6spy.engine.spy.P6SpyDriver
db.url=jdbc:p6spy:jtds:sqlserver://${db.server}/${db.name};useNTLMv2=true;domain=XX
spy.properties
driverlist=net.sourceforge.jtds.jdbc.Driver

TeamCity SQL Deploy

I followed the guide at http://blogs.adatis.co.uk/jonathon%20eveoconnor/post/Using-TeamCity-to-Automate-Building-and-Deployment-of-Database-Projects to set up SQL build and publish from TeamCity.
The build step works great, but I'm stuck when it comes to publishing. I've set the step up as below, which matches what is in the guide, but I'm getting an error.
Step 2/2: Publish (MSBuild) (2s)
[Step 2/2] KAInternal\KAInternal.sqlproj.teamcity: Build target: Publish
[KAInternal\KAInternal.sqlproj.teamcity] SqlPublish
[SqlPublish] SqlPublishTask
[SqlPublishTask] C:\TeamCity\buildAgent\work\1472f1322571ddd\KAInternal\bin\Debug\KAInternal.sqlproj.publish.sql error Deploy72002: Unable to connect to master or target server 'KAInternal'. You must have a user with the same password in master or target server 'KAInternal'.
[Step 2/2] Step Publish (MSBuild) failed
I've searched a fair bit, but everyone seems to believe this is a permission issue on the source machine, well my publish profile is using the built in "sa" SQL Server account to publish (for now, mainly to disprove this theory).
Here is the publish profile XML:
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludeCompositeObjects>True</IncludeCompositeObjects>
<TargetDatabaseName>KAInternal</TargetDatabaseName>
<DeployScriptFileName>Staging_KAInternal.sql</DeployScriptFileName>
<TargetConnectionString>Data Source=192.168.194.6;Persist Security Info=False;User ID=sa;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True</TargetConnectionString>
<BlockOnPossibleDataLoss>True</BlockOnPossibleDataLoss>
<ExcludeLogins>True</ExcludeLogins>
<IgnoreRoleMembership>True</IgnoreRoleMembership>
<ExcludeUsers>True</ExcludeUsers>
<ProfileVersionNumber>1</ProfileVersionNumber>
</PropertyGroup>
And the publish step in TeamCity
Hopefully someone can point me in the right direction, thanks in advance.
The guide you're following describes creating a separate proj file for the deployment, but here you're using the sqlproj file instead. There actually is an msbuild publish target for sqlproj files, so I'm not sure whether this was an intentional deviation on your part.
It may be the case that the sqlproj build task doesn't accept the password as an msbuild property. You could test whether this is the problem by specifying the password in the connection string in the publish profile file.
Also, I would suggest ensuring that you're using the latest versions of SSDT and DACFx. See the SSDT team blog for information about the latest versions and download links: https://blogs.msdn.microsoft.com/ssdt/

GuideWire BC configuration with SQL Server database

Currently working on PC-BC integration. I need to configure my studios with SQL Server database, For PC its working fine, but for BC I'm getting error. If anyone knows please help me to sort this out.
<database name="BillingCenterDatabase" dbtype="sqlserver" autoupgrade="true">
<dbcp-connection-pool jdbc-url="jdbc:sqlserver://localhost:1433;DatabaseName=BillingCenterDatabase;User=username;Password=pass#1121"/>
<upgrade defer-create-nonessential-indexes="false">
<versiontriggers dbmsperfinfothreshold="600" />
</upgrade>
</database>
my username is "username" and password is "pass#1121"
database name : BillingCenterDatabase
The error which I'm getting is
gw.pl.exception.GWLifecycleException: No appropriate database found in configuration: env = 'null'
try adding environment attribute in your database tag like shown below,
<database name="BillingCenterDatabase" dbtype="sqlserver" env="dev" autoupgrade="true">
<dbcp-connection-pool jdbc-url="jdbc:sqlserver://localhost:1433;DatabaseName=BillingCenterDatabase;User=username;Password=pass#1121"/>
<upgrade defer-create-nonessential-indexes="false">
<versiontriggers dbmsperfinfothreshold="600" />
</upgrade>
You should have to mention environment name in tomcat.conf in tomcat config file if you are deploying your application on tomcat.
JAVA_OPTS="-Dgw.server.mode=dev -Dgw.bc.env=st"
above line for st environment. you need to enter ut/st/st2 for different environment.

How do I force MSDeploy API to keep an existing Connectionstring?

We are deploying an ASP.Net application to IIS via MSDeploy API. We only want to update existing websites. In our ...pubxml we have defined following:
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)ConnectionstringA-Web.config Connection String">
<UpdateDestWebConfig>False</UpdateDestWebConfig>
</MSDeployParameterValue>
<MSDeployParameterValue Include="$(DeployParameterPrefix)ConnectionstringB-Web.config Connection String">
<UpdateDestWebConfig>False</UpdateDestWebConfig>
</MSDeployParameterValue>
</ItemGroup>
By default, the setParameters.xml created on publish, looks like this:
<setParameter name="ConnectionstringA-Web.config Connection String" value="metadata=res://*/itrDTO.csdl|res://*/itrDTO.ssdl|res://*/itrDTO.msl;provider=System.Data.SqlClient;provider connection string="data source=devServer;initial catalog=devDB;User Id=devUser;Password=devPW;MultipleActiveResultSets=True;App=EntityFramework"" />
<setParameter name="ConnectionstringB-Web.config Connection String" value="data source=devServer;initial catalog=devDB;integrated security=True" />
I also tried to create a "Projectname.wpp.targets" with this configuration inside my project:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<AutoParameterizationWebConfigConnectionStrings>false</AutoParameterizationWebConfigConnectionStrings>
</PropertyGroup>
</Project>
The result is that the connectionstrings are not created inside setparameters.xml.
However, all combinations of configurations here are changing the connectionstrings inside the web.config on the destinationserver. This happens if we import the package by the IIS-ManagementUI AND when we deploy the package by MSDeploy API.
All examples I've found for the "parameterization" - topic are for the IIS-Management process. As I understand parameterization, this is only usefull for manually installing updates, so that the admin has a UI to configure stuff. But we have no UI when we update the systems of our customers.
Update:
When I Publish with Visual Studio, here is the funny result:
I think this means "Hey WebDeploy, keep your hands off the connection strings!"
When I preview the changes, this is the result:
Parameterization is useful both through the IIS install UI and via the commandline. We use WebDeploy/Parameterization for the deployment of all our 40+ applications.
I just ran a test with a new blank ASP.NET application and found that by default the ConnectionString is parameterized but after setting the AutoParameterizationWebConfigConnectionStrings MSBUILD property to false it did not parameterize the ConnectionString. The parameter entry was removed from both the parameters.xml and SetParameters files.
I suggest you clear out your target website folder and republish with this property set.
Also double check that you don't have config transforms or something else that might be changing the config.

How to completely dump the data for Django-CMS

I have an instance of Django-CMS already running in a production environment. I would like to dump all the data related to the CMS (PAGES and PLUGINS) so that I may load it back into my development environment.
When I do python manage.py dumpdata cms it dumps most of the data, but not all of it. None of the content for the plugins is dumped. When I look at the django-cms source, I see that the plugins are organized in a different folder than the rest of the models - I'm sure this has something to do with the behavior of dumpdata.
Does anyone know how they would achieve what I am trying to do?
Thanks for your help/answers!
Django's built in dump and restore commands work well for migrating the contents of the CMS.
To dump the contents of the CMS, you need to include both the cms app as well as each of the plugin types you are using in the dumpdata command, so something like:
manage.py dumpdata cms text picture link file [other plugin types] > cms_export.json
to dump your content (you just need the app name, not the full path, like cms.plugins.text).
Here's an update to the procedure I use:
./manage.py dumpdata >fixtures/all.json
psql
DROP DATABASE [DBNAME];
createdb -T template_postgis [DBNAME]
./manage.py syncdb
psql [DBNAME]
delete from auth_group_permissions; delete from auth_permission; delete from django_admin_log; delete from django_content_type;
If you don't delete the tables above you'll get this error when loading the fixtures:
IntegrityError: duplicate key value violates unique constraint django_content_type_app_label_key
And then:
./manage.py loaddata fixtures/all.json
Philipp
For DjangoCMS 3.0, the syntax is the same but the names of the plugins have all changed. To get all standard plugins:
./manage.py dumpdata cms djangocms_column djangocms_file djangocms_flash djangocms_googlemap djangocms_inherit djangocms_link djangocms_picture djangocms_style djangocms_teaser djangocms_text_ckeditor djangocms_video > cms_export.json
Your dumpdata command only dumps the data for the cms app, but each plugin (cms.plugins.text, cms.plugins.picture, etc.) is its own app, and so needs to be added to the command line.

Resources