How to connect MySQL database with JSF and Primefaces in Netbeans? - mysql

I'm building a Java Web project with JSF 2.2 and Primefaces 4 using Netbeans IDE 8.
I'm trying to connect a database that I made in MySQL with my netbeans project.
The problem is that when i create a new project and make an entity class from database and choose jdbc/sample and make JSF pages from those entity classes the program runs ok BUT when I choose a new connection (MySQL) and choose my database with my tables and make JSF pages from entity class, the project doesnt run.
The database is visible in netbeans it's also visible in phpmyadmin in wamp. I'm thinking it has to do something with glassfish resources.xml file that
I need to configure something there or maybe not.
The short version of my problem:
How to configure and how to connect my database made in mysql (not a sample one) with netbeans jsf primefaces project and create entity classes from database and make JSF pages from those entities ?
PS can anyone post some links - videos or tutorials regarding this problem also
Resolved1: The problem is with netbeans 8 in 7.4 and earlier versions it works...
RESOLVED2: In Netbeans 8 the problem is with JDBC Resources and Connection Pool... just follow this tutorial at the end of the page it will solve the problem https://netbeans.org/kb/docs/web/jsf20-crud.html#troubleshooting

Related

Connecting to MySql on Docker

I have an ASP.NET 5 Web API application which I have deployed on docker. It connects to a MySql instance, also on docker. I am using Entity Framework 6 to connect to the MySql database. I have not referenced Entity Framework directly, but am using the MySql.Data.Entity package which internally uses Entity Framework 6.
When I invoke the API, I get this error:
Unable to determine the provider name for provider factory of type 'MySql.Data.MySqlClient.MySqlClientFactory'
Outside docker, i.e., on my windows machine, in Visual Studio 2015, I point my web API to the MySql instance on docker, and I can connect just fine. Inside docker, I get the error mentioned above.
What could be wrong?
The provider name is not being passed. Prior to ASP.NET 5 the provider value could be set alongside connectionString in in the web.config. This is no longer the case, as the connection string is just a string value in a json file with no extra properties.
You need to set it programatically. Here's an example, notably this part;
SetProviderServices("MySql.Data.MySqlClient", new MySqlProviderServices());
I'm not an expert on ASP.NET, but doesn't your question translate to:
If I run ASP.NET on Windows everything works fine, if I run it on
Linux I get an exception.
?
I don't think this is a Docker issue and would rather investigate about issues / driver needs the Entity Framework has on Mono.

I can't see MySQL in datasource list for entity framework

I use visual studio 2010-12 and I installed ADO.NET Entity Framework 4.1 , Mysql .Net Connector and Mysql Workbench
Before formatting, my computer, I could use entity framework for MySQL. but not I cant see MySQL in data source list. Here is what I mean
Well...where is the my mistake or missing?
Try uninstall existing mysqlconnector.
Download mysqlconnector/net 6.5.6
It works with VS2010 on my desktop.
However, id you're using vs2012, you may try the
latest version.
Okay I solved, I opened server explorer and I connected to mysql database, after I tried to add an ado.net entity framework object and it works

How to change the database which is used to store liferay content?

I have a glassfish server built with company default script. Then I have Liferay installed upon it. Liferay uses some predefined database to store the content on the pages it shows. It is a company shared database don't know where. How could I connect my liferay to a local clean database?
My setup is a Glassfish with Liferay, the DatabaseI use is MySQL.
Thanks for any help!
It's all explained here:
http://www.liferay.com/community/wiki/-/wiki/Main/Database+Configuration

How do I use Entity Framework with MySQL Connector noinstall version?

Does anyone know any way to have the Entity Framework working with mysql connector 6.3/6.4 no install version? I can add the dll-s to my project, but I can't add the connection to the Entity framework because it doesn't see mysql.
The steps to get mySQL and entity framework working are available in this blog post
If you are trying to do it without have a database installed, I do not think that that is possible.

How do I connect to MySQL 5.1 in Visual Studio 2010?

Does any one know how to connect to MySQL 5.1 with Visual Studio 2010?
I have already tried the MySQL Connector/ODBC route and it got me really nasty results. The table rows were all listed as a view in the views section and nothing at all was listed in the tables or procedures folder.
To get the Entity Frame working with VS2010, I had to do the following:
This only worked with Mysql .net Connector v6.3.1 (alpha). Previous versions ignored VS 2010 (click Development Releases)
I had to rename my Framework\v1.1.4322\CONFIG folder. Otherwise the install will fail. Rename it back when finished
(I've blogged about this here)
Update
6.3.2 is in beta and I can confirm this works. (I didn't need to rename the framework folder)
this seems to solve the issue
UPDATED LINK TO LATEST RELEASE THANKS #Christian Payne
Update: looks like there is already a non-beta!!!!
http://www.mysql.com/downloads/connector/net/
As someone else suggests..
http://dev.mysql.com/downloads/mirror.php?id=382641
..fixes the problem.
I had v6.2.3 installed after I had vs2010 installed and the MySQL driver was not shown in the list of the Database Connect dialog. I wrongly assumed I should use the .NET ODBC drivers instead and it caused all sorts of problems. Although I could easily connect to the DB using codebehind, the server explorer wouldn't connect to the DB.
Luckily after uninstalling 6.2.3 and installing 6.3.0 (from the link above) the MySQL driver was added to VS2010, and I was able to connect to the database and see it in my server explorer.
http://bugs.mysql.com/bug.php?id=45122
I was able to get this to work by doing the following:
My Environment:
Development Box -- Win7 64bit,
VS2010 Pro
Deployment Box -- Win2k8 svr with IIS7
running ASP.NET .Net 2.0/3.0/3.5 sp which is
hosted at DiscountAsp.Net (Note:
DiscountAsp.Net does not provide a
MySQL DB when running on a Win2k8
svr, I'm using a MySQL DB that I connect
to elsewhere on the InterWebs)
Steps I took:
Installed MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d
Ref'd the .Net 2.0 version of the MySQL assembly in my ASP.NET MVC2 Web project set to target .Net 3.5 (the path for the MySQL assemblies I used was C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0)
I ref'd all 3 of the MySQL assemblies (MySql.Data.dll, MySql.Data.Entity.dll & MySql.Web.dll)
I marked each of those assemblies as "Copy Local=True" in my project (a.k.a bin deployment)
Added a MySQL DB connection string to my Project (using the MySQL provider)
Added an ADO.NET Entity Data Model to my project in VS2010 using the connections string
VS2010 took about 30 secs to chew thru my MySQL DB schema but then provided me with a beautiful GUI interface to tweak my MVC Models
Used the DB Entities in my MVC controllers
Deployed the app to my hosted server at DiscountAsp.Net
It works like a charm :)
Erm... through code? Or do you mean the server explorer add-in? Have you tried the latest (albeit GPL-ed) connector version for .NET from Mysql themselves? Again, it's GPL-ed so be aware of the consequences of using that for your own software.
Microsoft Visual Studio 2010 Beta 2 is busted for DDEX providers. They are auto promoting a VS 2008 assembly from 9.0 to 10.0 and it fails. The failure has to do with the fact that a .NET 2 assembly cannot load a .NET 4 assembly.
This worked in beta 1, so it is something they broke.
I even went back and tried the reference DDEX provider from the SDK. It won't load in VS 2010 beta 2 either. That tells me they have something that needs to be fixed.
When is the next beta?