Unable to connect the SQL database from servlet
Hi!
My servlet connects with an SQL server on some other machine.
I have create the servlet and deploy it on tomcat.
I first create this servlet on eclipse that I deploy it on tomcat manually.
While using it form eclipse it gave no error in connecting with the server.
But when I deploy the same code on tomcat manually and access the page it gave me an error saying
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
I used the following code for cenneting the server
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
out.println("Calling For Class Name success Now calling database <br>");
jdbcConnection = DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};Server=MyServerName;Database=MyDatabaseName","","");
Message was edited by:
nitin403
Hi!
Sorry for not formating my previous message properly.
My servlet connects with an SQL server on some remote machine.
I have create the servlet and deploy it on tomcat.
I first create this servlet on eclipse that I deploy it on tomcat manually.
While using it form eclipse it gave no error in connecting with the server.
But when I deploy the same code on tomcat manually and access the page it gave me an error saying
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
I used the following code for connecting the server
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
jdbcConnection = DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};Server=MyServerName;Database=MyDatabaseName","","");
Thanx for your help in advance
Message was edited by:
nitin403
Similar Messages
-
Can I connect Azure SQL Database from Project Siena ?
Can I connect Azure SQL Database from Project Siena ?
I want to connect Azure SQL Database of Office 365 SharePoint's Access App from Project Siena.
Access App's Database is Azure SQL Database.
and can connect to Excel/PowerBI/etc.
Access App's Database can connect from specific location / any locations.
Access App's Database can allow read-only connection / read-write connection.
I want to create Windows App connected to Access App's Database.
Regards,
Yoshihiro Kawabata.Hi Yoshihiro,
Could you share more with us about the high level scenario for what you are trying to accomplish offline? We can discuss further at
[email protected]
Once we are done, we will definitely share our findings with the community.
Thanks! -
Unable to connect to SQL database through ODBC calls
I have been looking around for an answer to this, but haven't found the exact issue I'm seeing.
I have several Excel spreadsheets which have been working until recently, which use an ODBC call to a remote SQL database. The database is running, remote connections are allowed. The SQL server is in a domain which has no external trusts. Users with accounts
in this domain can remotely access the SQl databases through ODBC just fine. Users who do not have domain accounts in this domain are being denied access by their domain account, and the SQL authentication is not passed through, even though remote access is
set to allow "everyone", and the database is set to Windows authentication and SQL authentication. This worked until early this week (the spreadsheet was created in 2010), and I have been looking fruitlessly for a fix ever since. As far as I know,
no changes were made to group policy on this domain, and no changes were made to the server or database recently, except Microsoft patches. None of the patches this month looked like they would affect this.It works locally on the server and remotely for users in the same domain. I am trying to use the SQL account and password to connect to the database, but users from outside this domain fail to reach the SQL database for authentication. It looks like Windows
authentication is not passing the SQL credentials on if the windows authentication fails. I don't know how to resolve this. The only options in SQL are "Windows authentication and SQL authentication" or "Windows authentication only". The database is already
set to the first option. Somehow, I need to set the server to allow the SQL authentication even if the Windows authentication fails.
Hi pkuti01,
SQL Server mixed mode is "Windows Authentication and SQL Server Authentication", we have to restart SQL Server service after change the authentication to mixed mode.
In your case, have you got any error message/information if you faild connect to SQL Server via ODBC? If so, please post them to us for further investigation. Furthermore, here is an article regarding steps to troubleshooting SQL connectivity issues for
your reference. Please see:
http://blogs.msdn.com/b/sql_protocols/archive/2008/04/30/steps-to-troubleshoot-connectivity-issues.aspx
If you have any feedback on our support, please click
here.
Regards,
Elvis Long
TechNet Community Support -
Windows 7 clients suddenly unable to connect to SQL database
Our environment in a nutshell:
Server1: Small Business Server 2003 R2 (Active Directory domain, it is the sole domain controller [DC])
Server2: Dedicated to SQL Server 2005 and the SAP Business One database
Server3: Windows Server 2003 R2 Standard Terminal Server. This provides user sessions that are the equivalent of Windows XP SP3.
Two Windows 7 workstations: 1x 64-bit, 1x 32-bit. Both are domain joined.
All above computers on a gigabit LAN.
Client product is SAP Business One 2007 A (8.00.181) SP:00 PL:49
SQL Native Client is 9.00.5000.00
SQL Server is mixed-mode authentication, however all users use trusted Windows connections. All users with access to the product are members of an "SAP Users" domain security group.
Normal operation is:
Local Win7 workstations have client installed and connect over the LAN to the SQL Server instance on Server2
Remote users log on to the Server3 Terminal Server, fire up sessions and connect to the SQL Server instance
Up to and including Thursday, March 12 everything was working fine for all users. As of Friday, March 13 the Terminal Server users/sessions are still working perfectly but the Windows 7 workstations can no longer connect to the SQL Server instance with trusted connections. They are still able to connect if they switch to a SQL Server logon and use the "sa" user account and its password.
Also, the users normally using the Win7 workstations can log on to the Terminal Server with their usual domain accounts, and run SAP from there, which works perfectly.
The error the Windows 7 users are seeing:
Connection failed:
SQL State: 28000
SQL Server Error: 18452
[Microsoft][SQL Native Client][SQL Server]Login failed for user ". The user is not associated with a trusted SQL Server connection.
Prior to each logon attempt above, the Server2 SQL Server machine logs another event to its Application Event Log:
SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT: xx.xx.xx.xx]
Source: SQL Server instance, event 17806. From SQL Server log, Severity 20, State 2
What I've tried so far:
All servers have been restarted in correct order
Running the client in Windows XP SP3 compatibility mode. No difference
Running the client as Administrator. No difference
Upgrading to SQL Server Native Client 11.0 via:
Uninstall B1 client
Uninstall v9.00 Native Client
Install v11.00 Native Client
Install B1 client
Net effect is no difference
Googling the event IDs that are being logged seems to point to:
Expired domain account. Manually checked that the 2 users accounts are not expired and they belong to the "SAP Users" group. Furthermore, the domain accounts are still working when used in Terminal Server sessions.
Problem with Service Primary Names (SPNs). This seems to be Active Directory-related. Again, the domain accounts normally used on the Win7 workstations work fine on the Terminal Server so I'm inclined to think AD is OK
Other information that may be useful:
No Windows updates applied between March 12 and 13 on either Win7 workstation
Both Win7 workstations running Microsoft Security Essentials and the native Windows 7 firewall
All servers running Trend Worry Free Business Security suite
Sorry about the length of the post but hopefully it will reduce wild goose chases. Any troubleshooting ideas greatly appreciated.Problem found!
It turns out it was some sort of subtle problem with Trend antivirus running on the servers.
On all 3 servers there are 3 main protection components that are enabled by default:
Antivirus/Anti-spyware
Web Reputation
URL Filtering
What I did was to turn off all 3 components for all the servers. With Trend this can be done from the central management console. SAP then worked on one of the Win7 clients using Trusted Connection (i.e. Windows Authentication).
Then I turned the Trend components back on, on all servers, one at a time (to try to find which component was the culprit). Here’s the funny part: I turned all 3 back on, and SAP still works on the Win7 client using Windows Authentication! I even restarted it to make sure that state of affairs persists across a restart, and it’s still OK.
It's worth noting the problem was not solved shortly after it appeared by restarting all 3 servers. There was even a scheduled installation of Windows updates a couple of hours ago, which restarted all 3 servers again, and the problem still persisted. It was not fixed until the Trend components were globally disabled (on all 3 servers), then re-enabled.
Trend WBFS is version 9.0, pre SP1. -
Unable to connect to 10g database from developer suite 10g
I have loaded oracle 10g on my server with OS windows 2003 and it is working fine.Now I have installed Oracle developer suite 10g on windows XP client . we have configured local listener also and its entry is found in tnsnames.ora
My database name is mbxdata .
I have defined my host name as
MBXDATA.mbxnet.com in tnsnames but I am unable to connect to the database since I get error as ORA-12154 : TNS :could not resolve the connect identifier specified.
Please suggest matter urgent.
Thanks in advanceWe are having the same issue now. Was this ever resolved? We created 2 new databases and added those entries in both tnsnames on the local pc, and the tnsnames on the application server. Able to connect via sqlplus, toad, etc. but not through forms developer. We are running 10g app server, 10g developer suite, 10g databases. Any ideas?
Thanks,
Deb -
Unable to see the sql serveroutput from shell script
Hello experts,
I have a shell script which I am using to call a pl/sql proc.
This proc writes to dbms_output.
I would like to capture the dbms_output to a file when calling sqlplus from my shell script.
Here is the code:
===============================
echo "
sqlplus apps/$APPS_PWD << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('$i');
end;
exit
ENDOFSQL
" >> new.log
===============================
What I get in the 'new.log' is given below:
===============================
sqlplus apps/prj08app << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('/oracle/apps/irc/candidateSelfService/webui/VisVacDispPG');
end;
exit
===============================
ENDOFSQL
What I would like to get is the dbms_output given by the procedure.
Please suggest.
Thanks,
VinodVinod wrote:
Hello experts,
I have a shell script which I am using to call a pl/sql proc.
This proc writes to dbms_output.
I would like to capture the dbms_output to a file when calling sqlplus from my shell script.
Here is the code:
===============================
echo "
sqlplus apps/$APPS_PWD << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('$i');
end;
exit
ENDOFSQL
" >> new.log
===============================
What I get in the 'new.log' is given below:
===============================
sqlplus apps/prj08app << ENDOFSQL
set serveroutput ON
set feedback off
set verify off
set linesize 250
set pagesize 250
begin
jdr_utils.listcustomizations('/oracle/apps/irc/candidateSelfService/webui/VisVacDispPG');
end;
exit
===============================
ENDOFSQL
What I would like to get is the dbms_output given by the procedure.
Please suggest.
Thanks,
VinodYou need to realize & understand that EVERY command line command runs in its own separate OS process.
So the results from DBMS_OUTPUT get sent to Standard Out for the sqlplus process; which is NOT attached to your terminal.
The bottom line is you can't get there from here. -
JDBC Data Sources: connecting the HR database from Oracle Express
What goes in the data string?
Where do I find the information for Host name, port and SDI?
Thanks!try these link
About 'create database link ...'
http://www.dba-oracle.com/t_how_create_database_link.htm
http://forums.oracle.com/forums/search.jspa?threadID=&q=dblink&objID=f251&dateRange=all&userID=&numResults=15&rankBy=10001
Edited by: Binepal on May 20, 2010 7:44 AM -
How to connect and query the sql database in mobile application
Hello,
Can any one say how to connect the sql database from the j2me application.
I have got some info that only through servlet or jsp only we can connect the database and from their we should get the info or query in mobile application.
Is it true? and can i have any sample codes or white paper or guildlines.
It would be more useful form my project.
Thanks in advance.
regards,
saraHi David,
According to your description, when you add Windows Azure Mobile Services to a Window Phone 8 app, then store app data in the new mobile service. I recommend you post the related question on the Windows Azure Mobile Services Forums at
http://social.msdn.microsoft.com/Forums/en-US/home?forum=azuremobile .It is appropriate and more experts will assist you.
In addition, there are the details about creating a Windows Phone app connected to your mobile service.
http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-wp8/
http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-data-wp8/
Thanks,
Sofiya Li
Sofiya Li
TechNet Community Support -
Connecting to MySQL Database with Servlet
Hi All,
I want to connect to MySQL Database from servlet.
I am using Tomcat websever 3.3.1, where i have to set classpath of mysql jdbc driver.
I tried by copying mysql jdbc driver in so many directiories of Tomcat server but it is
giving me error like "no specified driver find"
So please send me all the solutions and how to set the classpath to connect to
mysql database.
ThanksU r correct that so many people are giving me solutions but that are not working for me
I think i not correct in setting the classapath to mysql jdbc driver.
1)I have unjarred correctly and all the classes are present in that.
yes driver class is there in that .
2)Now i am using new version of the mysqljdbc that is 2.0.13
If now any driver after this send me url i will download it and use it
3)I am unable to under stand what is yourcontext in
yourcontext/web-inf/lib?
This is my directory structure.
c:tomcat in this i have
bin
conf
doc
lib
logs
modules
native
webapps
work
in bin there are no subdirectories
in conf i have
auto,jserv,jk,users
in doc i have
appdev,images
sample( in appdev)
etc,lib,src,web(in sample)
images(in sample\web)
in lib i have
apps
common
container(c:\tomcat\lib)
in logs,modules there are no subdirectories
in native (c:\tomcat\native) i have
mod_jk
mod_jserv
in mod_jk i have
apache 1.3
common
iis
jni
netscape
nt_service
in webapps i have (c:tomcat\webapps)
Admin,Examples,root
in Admin i have (c:\tomcat\webapps\admin)
contextadmin
Meta-inf
Test
Web-inf
in web-inf (c:\tomcat\webapps\admin\web-inf)
Classes,lib,script
in classes i have (c:\tomcat\webapps\admin\web-inf\classes)
tadm
in examples (c:\tomcat\webapps\examples) i have
Images,Jsp,Meta-inf,Servlets,Web-inf
in web-inf (c:\tomcat\webapps\examples\web-inf) i have
Classes,jsp
in classed (c:\tomcat\webapps\examplesweb-inf\classes) i have
Cal
Checkbox
Colors
Dates
Error
Examples
Num
Sessions
in jsp (c:\tomcat\webapps\examples\web-inf\jsp) i have
applet
I think this is enough to give correct answer for me .
Thanks -
Unable to connect to SQL Server 2008 from OBIEE 11G(on 64 bit Linux box)
We are unable to connect to connect to SQL Server 2008 from OBIEE 11G which is on 64 bit Red Hat Enterprise Linux.
Infrastructure: OBIEE 11.1.1.5 64bit, on 64 bit Red Hat Linux Enterprise Linux 5.6 , MS SQL Server 2008 on 64 bit Microsoft Windows Server
Issue Description: Unable to connect to SQL Server 2008 from OBIEE11G RPD
Details: We are unable to connect to SQL Server 2008 from OBIEE which is on a 64 bit Linux box. We created the ODBC connection on Linux box to the SQL server. Whenever we try to import metadata it throws an error that says ‘Connection Failed’.
Here are the steps we followed to setup the ODBC connection on Linux box.
1) We updated the user.sh file with the LD_LIBRARY_PATH and LD_LIBRARY_PATH_64 values that point to $ORACLE_HOME/bifoundation/odbc/lib
This is where we found the driver for SQL server SEmsss23.so.
2) We updated the odbc.ini file with the entry for SQL server with the connection details
SI_SQL_Server_DEV = SQL Server
[SI_SQL_Server_DEV]
Driver=/u001_OAS/Oracle/Middleware/Oracle_BI1/bifoundation/odbc/lib/SEmsss23.so
Description=DataDirect 5.1 SQL Server Wire Protocol
Address=10.230.216.52,54970
AlternateServers=
AnsiNPW=Yes
ConnectionRetryCount=0
ConnectionRetryDelay=3
Database=SVBDW_NEW
LoadBalancing=0
LogonID=SIDatavalidation
Password=~~~Password123
QuoteID=No
ReportCodePageConversionErrors=0
3) We updated the IDENTIFIER_QUOTE_CHAR with single quotes instead of double quotes in the DB features of the RPD
4) We updated the bash_profile file to point the ODBCINI variable to the path where the OBIEE odbc.ini file is present.
Export ODBCINI=/u001_OAS/Oracle/Middleware/instances/instance1/bifoundation/OracleBIApplication/coreapplication/setup/odbc.ini
The error in nqsserver.log file says “[nQSError: 16001] ODBC error state: IM002 code: 0 message: [DataDirect][ODBC lib] Data source name not found and no default driver specified.”Hi,
Make sure SQL Configuration Manager make sure the TCP/IP enabled. please try below method
Method 1
Re Create a new ODBC & Oracle Bi Server DSN Configuration test it and use it in the connection pools.
define your ODBC data source in your server where the BI Server is installed. Check your DB connections in your physical layer and make they are defined on your BI Server as well.
Method 2:
try using the complete TNS in below format in the datasource name section:
(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST =DB IP)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = ORCL) ) and provide the credentials.
Method 3:
To use the OCI call interface you need to have oracle client DB to be installed so that you can establish a connection using that DB credentials and connect to the remote dB and then import the tables.....this is the rule of thumb.
hope helps you.
Thanks
Deva -
I can't connect to MySQL database from The JSP Standard Tag Library
Hi All !
I have a problem, please help me anybody !
I don't connect to MySQL database from jsp page using JSTL tag but from servlet all work correctly. I set my path and put �mysql-connector-java-3.1.13-bin.jar� in ENVIRONMENT WinXP(classpath=C:\Java\jdk1.5.0_10\jre\lib\ext\mysql-connector-java-3.1.13-bin.jar) and in War project folder �WEB-INF/lib� and in [TomcatServer]\common\lib.
I have in folder�WEB-INF/lib� following files:
antlr.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-fileupload.jar
commons-logging.jar
commons-validator.jar
jakarta-oro.jar
jsf-api.jar
jsf-impl.jar
jstl.jar
mysql-connector-java-3.1.13-bin.jar
standard.jar
struts.jar
I'm using:
NetBeans 5.5 Build200610171010 (bundled Tomcat 5.5.17)
Ent.Pack 20061020 Visual Wb Pack 061103
OS WinXP SP2
Java 1.5.0_10
MySQL 5.0.18-nt
1:<%@page contentType="text/html"%>
2:<%@page pageEncoding="UTF-8"%>
8: <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
9: <%@taglib uri="http://java.sun.com/jstl/sql" prefix="sql"%>
10:
11: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
12: "http://www.w3.org/TR/html4/loose.dtd">
13:
14: <sql:setDataSource var="ds"
15: driver="com.mysql.jdbc.Driver"
16: url="jdbc:mysql://localhost:3306/test"
17: user="root"
18: password="xxxx"/>
19:
20:
21:<sql:query sql="select name, age from People" var="res"
22: dataSource="${ds}"/>
I have received report on mistake when entered code at the top:
�/index.jsp [21;0] According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions�
I used instead of (dataSource="${ds}")->(dataSource="ds") but this did not work.
After build and run I have received
=========================================START=================================
HTTP Status 500
type Exception report:
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /index.jsp(21,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
root cause
org.apache.jasper.JasperException: /index.jsp(21,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:955)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:710)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Validator.validate(Validator.java:1489)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
Apache Tomcat/5.5.17
=======================================END================================
Error: "According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions" - but according to documentation such parameter possible.
BUT WHEN JOINING With DATABASE FROM SERVLET ALL WORK FINE.
I read this doc - [http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html], this applicable if I Tomcat Admin, but i'am not Admin
I simply user, i.e. I want to place its database on virtual host (Tomcat+(JSP-JSTL)+MySQL).
There is idea how can resolve this problem
Thank you in advance ;)For all how have similar problem.
Decision instead of these ways
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
it is necessary to indicate these
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -
Unable to connect to sql server database
i run on CMD:
aspnet_regsql -C "Data Source =Davidchamoun/sqlexpress : intergrated security= true" -ssadd -sstype p
i got
a network-related or instance-specific error occurred while establishing a connection to sql server. the server
was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections. (provider: SQL Network interfaces . error: 25 – connection string is not valid
unable to connect to sql server database.
im using sql sever 2012 express, microsoft visual studio web 2008 express.
please help me.i run it as :
aspnet_regsql -C "Data Source =Davidchamoun\sqlexpress : integrated security= true" -ssadd -sstype p
i got the same error :
an error has occurred . details of the exception:
a
network-related or instance-specific error occurred while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections. (provider:
SQL Network interfaces . error: 25 – connection string is not valid
unable to connect to sql server database.
im using also windows 8.1
pls help me
ty for ur reply -
Hi All,
BackGround
I used to connect to database with Encrypt set true in sql connection which helps established encrypted data base connection . I verified that created certificate in order
to provide Encrypted connection to database for client is valid.
Issue :Issue
is un-able to connect to sql sever2008 r2 from vs2013 by enforcing encryption to true.
while trying to test the connection from vs2013 error log getting recorded as well as error notification is getting populated as below .
Step1 :
from Vs2013 trying to connect to sql server 2008 r2
step 2: on Click test Connection . getting below mentioned error notification
Event Viewer Log:<o:p></o:p>
<o:p></o:p>
(Process Id: 7472)
<o:p></o:p>
.Net SqlClient Data Provider:<o:p></o:p>
A connection was successfully established with the server, but then an error
occurred during the login process. (provider: SSL Provider, error: 0 - The
target principal name is incorrect.)<o:p></o:p>
at
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,
Boolean breakConnection, Action`1 wrapCloseInAction)<o:p></o:p>
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)<o:p></o:p>
at
System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle,
SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean
callerHasConnectionLock)<o:p></o:p>
at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean
canAccumulate)<o:p></o:p>
at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte
flushMode, Boolean canAccumulate)<o:p></o:p>
at System.Data.SqlClient.TdsParser.TdsLogin(SqlLogin rec,
FeatureExtension requestedFeatures, SessionData recoverySessionData)<o:p></o:p>
at
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, SecureString newSecurePassword, Boolean
ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)<o:p></o:p>
at
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo
serverInfo, String newPassword, SecureString newSecurePassword, Boolean
redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential
credential, TimeoutTimer timeout)<o:p></o:p>
at
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer
timeout, SqlConnectionString connectionOptions, SqlCredential credential,
String newPassword, SecureString newSecurePassword, Boolean
redirectedUserInstance)<o:p></o:p>
at
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential credential,
Object providerInfo, String newPassword, SecureString newSecurePassword,
Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions,
SessionData reconnectSessionData)<o:p></o:p>
at
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions
userOptions)<o:p></o:p>
at
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool
pool, DbConnection owningObject, DbConnectionOptions options,
DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)<o:p></o:p>
at
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject, DbConnectionOptions userOptions, DbConnectionInternal
oldConnection)<o:p></o:p>
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject, DbConnectionOptions userOptions, DbConnectionInternal
oldConnection)<o:p></o:p>
at
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate,
Boolean onlyOneCheckConnection, DbConnectionOptions userOptions,
DbConnectionInternal& connection)<o:p></o:p>
at
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions,
DbConnectionInternal& connection)<o:p></o:p>
at
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions
userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&
connection)<o:p></o:p>
at
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection
outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1
retry, DbConnectionOptions userOptions)<o:p></o:p>
at
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)<o:p></o:p>
at
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)<o:p></o:p>
at System.Data.SqlClient.SqlConnection.Open()<o:p></o:p>
Inner Exception:<o:p></o:p>
:<o:p></o:p>
The target principal name is incorrectThe target principal name is incorrect
Hi Rahul.U,
Are you able to connect to SQL Server successfully from SQL Server Management Studio (SSMS) when enforcing encryption?
According to above error message, it could be caused by the inappropriate server name or incorrect TrustServerCertificate configuration in the connection string from Visual Studio. There are some proposals for you troubleshooting this error.
1. Make sure that you connect to the SQL server using the fully qualified domain name (FQDN).
2. When connecting to a SQL Server instance with a valid certificate, please add the
TrustServerCertificate
parameter and set it to true in the connection string. For more details, please review this
article.
However, if you can successfully connect to SQL Server via SSMS, but still fail to connect to SQL Server from Visual Studio, I would like to recommend you post the question in the .Net Framework forum at
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=netdevelopment . It is appropriate and more experts will assist you.
There are similar articles about error “The target principal name is incorrect” for your reference.
http://serverfault.com/questions/458935/aws-rds-sql-server-ssl-connection-the-target-principal-name-is-incorrect
http://www.derekseaman.com/2013/09/sql-2012-failover-cluster-pt-12-kerberos-n.html
Thanks,
Lydia Zhang
Lydia Zhang
TechNet Community Support -
How do the application servers connect the new database after failing over from primary DB to standby DB?
We have setup a DR environment with a standalone Primary server and a standalone Physical Standby server on RHEL Linux 6.4. Now our application team would like to know:
When the primary DB server is crashed, the standy DB server will takeover the role of primary DB through the DataGuard fast failover. As the applications are connected by the primary DB IP before,currently the physical DB is used as a different IP or listener. If this is happened, they need to stop their application servers and re-configure their connection so the they coonect the new DB server, they cannot tolerate these workaround.
Whether does oracle have the better solution for this so that the application can automatically know the role's transition and change to the new IP without re-confige any connection and shutdown their application?
Oracle support provides us the answer as following:
==================================================================
Applications connected to a primary database can transparently failover to the new primary database upon an Oracle Data Guard role transition. Integration with Fast Application Notification (FAN) provides fast failover for integrated clients.
After a failover, the broker publishes Fast Application Notification (FAN) events. These FAN events can be used in the following ways:
Applications can use FAN without programmatic changes if they use one of these Oracle integrated database clients: Oracle Database JDBC, Oracle Database Oracle Call Interface (OCI), and Oracle Data Provider for .NET ( ODP.NET). These clients can be configured for Fast Connection Failover (FCF) to automatically connect to a new primary database after a failover.
JAVA applications can use FAN programmatically by using the JDBC FAN application programming interface to subscribe to FAN events and to execute event handling actions upon the receipt of an event.
FAN server-side callouts can be configured on the database tier.
FAN events are published using Oracle Notification Services (ONS) and Oracle Streams Advanced Queuing (AQ).
=======================================================================================
Who has the experience and the related documentation or other solutions? we don't have the concept of about FAN.
Thank very much in advance.Hi mesbeg,
Thanks alot.
For example, there is an application JBOSS server connecting the DB, we just added another datasource and put the standby IP into the configuration file except adding a service on DB side like this following:
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jta="false" jndi-name="java:/jdbc/idserverDatasource" pool-name="IDServerDataSource" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:@<primay DB IP>:1521:testdb</connection-url>
<connection-url>jdbc:oracle:thin:@<standby DB IP>:1521:testdb</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>TEST_USER</user-name>
<password>Password1</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<use-fast-fail>false</use-fast-fail>
<stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.jdbc">
<xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
If the failover is occurred, the JBOSS will automatically be pointed to the standby DB. Additional actions are not needed. -
Excel Application Unable to Connect the Highavailable(Mirrorining) database
Hi Folks,
Please help me out from below Issue.
We have developed an Excel application to pull data from Back-end Database.
The database is configured in High availability Mirroring, When fail over occurs the Database moving from One server DB to Another Server DB.
But my Excel application is not pointing to the Failover DB when the One DB fails.
We are using the below Connection string in the excel application:
*"Data Source=Server A;Failover Partner=Server B; Initial Catalog=AdventureWorks; Integrated Security=True;"*
When Server A is unavailable, it shows the below error.
PFA : Error.jpg
And again asking for Authentication
PFA : Authentication.jpg
Here we need to Enter Credentials manually and then it is able to connect the desired database.
But it is not possible to spread credentials to end –user.
Can anyone please provide solution for this issue to automate the above scenario without manual intervention?
Thanks in Advance make sure that "sun.jdbc.odbc.JdbcOdbcDriver" is on your classpath ,
Maybe you are looking for
-
IMac losing wireless connection when new wireless device is added.
I have a new 2.4 G iMac and have a 5.1 logitech surround set-up with wireless speakers. anytime i turn the speakers on and i'm using my wireless internet, the internet sits; when i turn the speakers off, the internet works as it should.sounds like th
-
Hello everyone. First, thanks a lot for the new shape tool. The stroke options (finally!!!) are great!!!! \o/\o/\o/\o/\o/ (now my Firework Lovers Friends will stop picking up on me for doing vectors in PS) I just find it to be a little hidden. After
-
Entering password for an encrypted time machine backup
During a recent hard disk failure. I have had to restore my system from a time machine backup. I keep this backup on an encrytped external drive. I booted into recovery mode, erased the drive to fix the hard disk errors (it wasn't repairable). Then
-
H.264 for iPad, problems in CS5 - OK in CS3 (Mac)
Hi all, I have a CS3 project built on a PC, I've just brought into CS5 on a Mac. The encoding setup is for iPad, running full screen: H.264, 25fps, 1024x768, with a keyframe every 5 frames. I'm using the same setting as the CS3 project. All movies ou
-
Problem in Asset update - AS02
Hi When I tried to update "Inventory number", system show the asset record message, when I check new value on AS03 "Inventory number" is equal to space. I have all autorization to update on AS02, but I don't know why this field "Inventory number" on