Trying to connect, using Hibernate 4.3, to SQL Server with Windows Authentication, i'm getting a:
"No Persistence provider for EntityManager named instanceTest"
I have loaded the sqljdbc_auth.dll library and im using this url:
jdbc:sqlserver://localhost:1433;databaseName=WIN_AUTHDB;integratedSecurity=true
The parameters which i am using to create the entity manager factory are:
properties.put("background-validation", "true");
properties.put("hibernate.c3p0.idle_test_period", "3600");
properties.put("hibernate.hbm2ddl.auto", "update");
properties.put("hibernate.max_fetch_depth", "3");
properties.put("hibernate.connection.driver_class", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
properties.put("hibernate.connection.url","jdbc:sqlserver://localhost:1433;databaseName=WIN_AUTHDB;integratedSecurity=true");
Im missing something? Maybe is the dll not loaded? The error is thrown at this line:
Persistence.createEntityManagerFactory("instanceTest", initProperties(properties));
The database is correctly configured, i have connected through Windows Authentication with the SQL Server Management. Also, in a previous test, i achieved to create a database using the driver without hibernate.
Thanks in advance.
Along those, add the below property
properties.put("hibernate.dialect", "org.hibernate.dialect.SQLServerDialect");
Resolved!
Much more simple than I thought. When I was compiling the maven project, i was unintentionally deleting the persistence.xml file. Thats the reason because it never found the persistence provider at the war.
Related
Returns error 'Keyword not supported: 'authentication'' while trying to create a context using EF Core
"Data Source=tcp:XXXXXXX.windows.net,1433;Initial Catalog=XXXXX;Persist Security Info=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Authentication=Active Directory Integrated"
Azure Functions V2 builts on top of .Net Core and AFAIK SqlClient for .NET Core still does not support using the 'Authentication' keyword in the connection string. That should work when this issue is actually fixed.
You can reference this bob: Azure Active Directory Connection String.
It has the same error with you. And the answer gives two suggestions:
Have you been through this troubleshooting guide: Use Azure Active Directory Authentication for authentication with SQL.
do you have .NET Framework 4.6 or later installed?
Follow this two suggestions, the problem is solved. I think you can try it and maybe it can helps you.
Hope this helps.
I'm using EF Core in a small test application and I'm trying to create the database in SQL Server 2014 Express. Initially I used Update-Database script to create it and I didn't have any issues but when I tried to do this at runtime with dbContext.Database.EnsureCreated(), it no longer worked. I have checked the credentials for the SQL user multiple times and I'm sure that both approaches use the same. If I use the Update-Database script first, then all the queries work successfully in runtime using the same credentials.
Any idea what I might be missing here?
I'm developing chat application, I'm using ejabberd for my project. I installed ejabberd server(16.06) successfully and it performing good in auth method as internal. But it is not working when I'm changed auth method as sql. These are the things I'm changed in ejabberd.yml file
default_db: sql
auth_method: sql
## ODBC compatible or MSSQL server:
##
sql_type: mssql
sql_server: "Server=azure_server_name;DSN=DB_Name;UID=azure_DB_username;PWD=azure_DB_password"
sql_pool_size: 10
sql_keepalive_interval: 28800
mod_mam:
iqdisc: one_queue
db_type: sql
default: always
I'm getting following error for while I'm register new user and admin login into web admin portal
ejabberd_auth:is_user_exists:316 The authentication module ejabberd_auth_sql returned an error
when checking user <<"newuser">> in server <<"localhost">>
Error message: {timeout,{p1_fsm,sync_send_event,[<0.390.0>,{sql_cmd,{sql_query,{sql_query,<<"Q9525209">>,#Fun<sql_queries.9.38301790>,#Fun<sql_queries.10.38301790>,#Fun<sql_queries.11.38301790>,{sql_queries,145}}},3534866},60000]}}
I'm used register command:
bin>ejabberdctl register "newuser" "localhost" "password"
Thanks in advance. Please add your ideas and suggestions to resolve this issue.
Again- I am no Ejabberd expert- I imagine someone might have more experience with this; However, it seems that you're confusing Register which I assume is an action to create a login on the Ejabberd platform with the login that is being used on the database. (Or I'm misinterpreting your comments. One of the two.)
You will need to use a username/password combination that exists on the Azure SQL Database in your connection string.
Additionally, you might try the following connection string :
sql_server:"Server=tcp:azure_server_name.database.windows.net;DSN=DB_Name;UID=azure_DB_username;PWD=azure_DB_password"
I'm new to Play framework. I'm trying to configure MySQL database as a datasource to be used with Play.
i have done following setting to connect mysql database to play..
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost/phpmyadmin/index.php?db=formdemo&token=3882f545563c7df106e1daf21515e1b7#PMAURL:db=formdemo&server=1&target=db_structure.php&token=3882f545563c7df106e1daf21515e1b7"
but i am getting following configuration error.
play.api.Configuration$$anon$1: Configuration error[Cannot connect to
database [default]]
I am not able to connect my wamp localhost database to play.
How do I modify the configuration file to use a mysql database as opposed to an in-memory version. Do I need to setup an entirely separate DB or can I modify the db.default.url property?
I'm using Play! 2.1.
I have resolved with issue. Thank You for your guidance.
Few lines to Put.
dependency
"mysql" % "mysql-connector-java" % "5.1.18"
Conf
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost/FORMDEMO?characterEncoding=UTF-8"
db.default.user=root
db.default.password=""
Follow the reference,
http://blog.knoldus.com/2013/01/28/play-framework-2-0-connectivity-with-mysql-in-scala/
Your url should be in this structure:
db.default.driver=com.mysql.jdbc.Driver
db.default.url="mysql://username:password#localhost/formdemo"
If you didn't set the default password, it is usually root with no password, like this:
db.default.url="mysql://username:#localhost/formdemo"
I am new to Eclipse.
Currently developing a sample web application using primefaces 3.1 and glassfish 3.
I have created a oracle database connection under datasource explorer. I would like to know how to
integrate this with my web application, so that I could connect to database from my web application. I know that by creating context.xml and entering the following might be suffice for database access, but are there anyways to integrate database connection with my application? So that I do not need to hard code password in context.xml.
I have used Jdeveloper in the past and by creating a database connection corresponding datasource entries in xml are generated. So I was wondering something similar would be possible using Eclipse?
Any help is highly appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/SampleDB" auth="Container"
type="javax.sql.DataSource"
username="app" password="app"
driverClassName="org.apache.derby.jdbc.ClientDriver"
url="jdbc:derby://localhost:1527/sample"
maxActive="8" />
</Context>
I have found a solution to create datasource for glassfish.
I created a a JDBC Resource under GlassFish and pointed connection to my connection created under Date Source Explorer. It created a sun-resources.xml. I had to manually rename this to glassfish-resource.xml. By default there are no entry for password,so I had to manually add . When I ran my web application I was getting this error
java.sql.SQLException: Error in allocating a connection. Cause: No PasswordCredential found
So to resolve this error I added a property in JDBC Connection Pool in glassfish admin server. Now I could connect to Oracle database.
Not sure why I have to do two steps manually. Besides by default it creates sun-resources.xml. Perhaps someone could point out how to workaround these.
Thanks