Here is the problem I have met: An ActiveX control in the system of my company needs to connect Database, Oracle 10g in fact, via ADO. It works fine in IE8 of our customers' computers, but after IE8 is upgraded to IE11, it can't connect to database any more. I see no change on the face: connection string is same, codes don't change, Oracle is still the old one. Could any suggest what could possibly cause this problem?
ps: We use ADO2 developed by Carlos Antollini cantollini#hotmail.com.
Thanks for commenting. There is no warning, and I can't even extract error or exception from the program. It runs on win7. The ActiveX is a small control developed by my company years agao. The core code used to connect database is as follow:
strConnection = "Provider=OraOLEDB.Oracle";
strConnection += ";User ID=" + m_sUserName;
strConnection += ";Password=" + m_sPassword;
strConnection += ";Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)";
strConnection += "(HOST="+m_sSQLServerName+")(PORT=1521))";
strConnection += "(CONNECT_DATA=(SERVICE_NAME = " + m_sSQLDBName + ")))";
strConnection += ";Persist Security Info=False";
the strConnection will be used as parameter feeds to the Open() method of _ConnectionPtr object of ADO, the connecting code is like this:
m_pConnection->Open(strConnection , userId, password, NULL);
where m_pConnection a varible of type _ConnectionPtr, a pointer of Connection.
I am pretty sure the userID and password are right.
I guess the connection error might be related to Provider=OraOLEDB.Oracle, like dll missing or registration problem? But I can't be sure, I don't know the underlying mechanism of ADO.
2020.6.22 Add:
I have found the same problem in win10, it seems that is not a problem of IE, msado15 which is unable to connect to database after some update. The database-connection part of the code is:
_ConnectionPtr m_pConnection;
try
{
hr = m_pConnection->Open(_bstr_t(m_strConnection), _bstr_t(lpstrUserID), _bstr_t(lpstrPassword), NULL);
return hr == S_OK;
}
catch(_com_error &e)
{
dump_com_error(e);
return FALSE;
}
It works fine in win7 but throws exception in win10, the exception object gives information as follow:
_com_error &e:
m_hresult = E_FAIL
[0] = 0x536a8590 _com_error::`scalar deleting destructor'(unsigned int)
m_perrinfo = 0x013aaaa0
IUNKOWN
__vfptr = 0x532d120c
[0] = 0x533001e0
[1] = 0x533003c0
[2] = 0x532fedc0
m_pszMsg = 0x00000000 <Bad Ptr>
And the description in the exception object is:
CADODataBase Error
Code = 80004005
Code meaning = undefined error
Source = OraOLEDB
Description = ORA-12154: TNS: unable to resolve given connection identifier
Related
I am trying to connect to a SQL Server database using TestComplete 11, but I am getting an error
Provider cannot be found. It may not be properly installed.
I have added the ODBC Driver, you can look at the screenshot
Below is the code I am using, please let me know how can I fix it.
AConnection = ADO.CreateADOConnection();
// Specify the connection string
var AConnection = ADO.CreateADOConnection();
AConnection.ConnectionString = "Provider=SQLDriver; Server = KEOUS-SQL\MSSQLSERVER01,1724; Database=K212.HrPayroll.ThamesValley.Hina;user id = sql.server;password=sql.server";
// Suppress the login dialog box
AConnection.LoginPrompt = false;
AConnection.Open();
// Execute a simple query
RecSet = AConnection.Execute_("SELECT * FROM EC_GROUP WHERE EMP_GROUP_CODE = 'ADMIN1'");
// Iterate through query results and insert data into the test log
RecSet.MoveFirst();
while(! RecSet.EOF)
{
Log.Message(RecSet.Fields.Item("EC_GROUP").Value, RecSet.Fields.Item("EMP_GROUP_CODE").Value);
RecSet.MoveNext();
}
AConnection.Close();
As TestComplete is a 32 bit application, it will only work with strictly 32 bit ODBC drivers. Use a data source that is configured with a 32 bit driver.
I am trying to connect to an Oracle Database using the java.sql.DriverManager in a JSF application. I am using a Tomcat v7 with ojdbc5.jar.
I have a very simple sample project that consists of nothing else than this piece of java code:
String url = "jdbc:oracle:thin:#DBSERV:DBPORT:DBSID";
String user = "account_admin";
String password = "my_assword";
Connection connection = null;
try {
Class.forName("oracle.jdbc.OracleDriver");
connection = DriverManager.getConnection(url, user, password);
connection.close();
} catch ..
...
Executed I get the following error:
java.lang.NoClassDefFoundError: Could not initialize class oracle.jdbc.driver.OracleDriver
Infact the class specified there "oracle.jdbc.driver.OracleDriver" is deprecated...and I can't change the Tomcat configuration. Therefore I specified "oracle.jdbc.OracleDriver" which loads just fine.
So the question is: Why does the DriverManager tries to load the "wrong" oracle driver, although I am loading another one?
I also tried as an alternative to Class.forName the following:
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
That does not change anything though. I also checked for the registered drivers in the following way:
Enumeration<Driver> driverList = DriverManager.getDrivers();
while(driverList.hasMoreElements()){
Driver driver = driverList.nextElement();
System.out.println(driver.getClass().toString());
}
The output:
class sun.jdbc.odbc.JdbcOdbcDriver
class oracle.jdbc.OracleDriver
So the desired driver seems to be registered, no trace of the deprecated "oracle.jdbc.driver.OracleDriver".
Thank you for any help
My problem just disappeared when I restarted the container. I can't explain why that is though.
Hi I have a problem with my Java program, when I run the application within JDeveloper, the program works fine, it connects to the derby database properly.
When I create a executable jar i get the following error no suitable driver found for jdbc:derby://localhost:1527/c:..../dbcam
i have tried the following
{ public void DoConnect3( ) {
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
// conenct to the database
// String host ="jdbc:derby://localhost:1527/dbCam";
//String host ="jdbc:derby://localhost:1527/C:/Users/nasir/SkyDrive/Java/db_Backup/dbCam";
String host ="jdbc:derby://localhost:1527/C:/Users/nasir/.netbeans-derby/dbCam";
String uName ="userCam";
String uPass ="cam";
con = DriverManager.getConnection(host,uName,uPass);
stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
//String sql = "SELECT * FROM tableCustomer";
String sql = "SELECT * FROM tableTroubleshooting";
//String tsss = Integer.toString(tss);
//String sql = "SELECT * FROM tableTroubleshooting where ProbID "+"'"+tsss+"'";
rs = stmt.executeQuery(sql);
rs.next();
}
That still doesn't do much only shows me message saying org.apache.derby.clientdriver.
Any suggestions would be gratefully appreciated.
Thanks
The url you're using is a ClientDriver url, not an EmbeddedDriver url. You need to add the correct jar and load the correct driver.
HTH
D
We have a Silverlight application which uses WCF RIA Services and Entity Framework 4.1 to connect to a database.
At the moment, the connection string is supplied, as standard within the web.config and this all works successfully.
However, I now want to be able to change the connection string dynamically at runtime based on amongst other things, the user logged in.
I've found some other posts which hint at doing this, but they are using ObjectContext whereas we are using DbContext within the System.Data.Entity namespace and also the DbDomainService class.
In order to compensate for this I have overidden the CreateDbContext() method within my DbDomainService implementation as follows:
protected override CoreContext CreateDbContext()
{
dbServer = null, dbName = null;
httpCookie = System.Web.HttpContext.Current.Request.Cookies["DBServer"];
if (httpCookie != null)
{
dbServer = httpCookie.Value;
}
var cookie = System.Web.HttpContext.Current.Request.Cookies["DBName"];
if (cookie != null)
{
dbName = cookie.Value;
}
if (dbServer == null && dbName == null)
{
return new CoreContext();
}
string connStr = "Data Source=" + dbServer + ";Initial Catalog=" + dbName + ";Integrated Security=true";
return new CoreContext(connStr);
}
This works successfully the first time the Silverlight application is loaded, however, on all subsequent loads, the same connection as established initially is used despite changing the values being substituted into the connection string.
The only way to get the connection to be changed seems to be to recycle the application pool in IIS and load the app again.
Am I doing something wrong? Or is it not possible to have the DbDomainService change it's connection dynamically?
I'm thinking of the instancing model of your domainservice class. Have you tried a custom IDomainServiceFctory ? It permits you to decide when to create a new instance of them and is really simple to implement.
Take also a look at this post by Fredrik Normén.
I am trying to launch an existing MS Access database (Access 2010) from a Silverlight 4 OOB with elevated authorisation set. I keep getting an error. I can create a new Access application using the CreateObject keyword, but when I try to launch an existing one I get an error: "No object was found registered for specified ProgID."
Any help is appreciated. Here is the code I use:
string sMSAccess = "C:\\Users\\storltx\\Documents\\SL4Demo.accdb";
dynamic MSAccess = ComAutomationFactory.GetObject(sMSAccess);
MSAccess.Visible = true;
I think you should pass "Access.Application" string to GetObject call. like this:
dynamic MSAccess = ComAutomationFactory.GetObject("Access.Application");
Try your code like this:-
string sMSAccess = "C:\\Users\\storltx\\Documents\\SL4Demo.accdb";
dynamic app = ComAutomationFactory.CreateObject("Access.Application");
app .Visible = true;
app.OpenCurrentDatabase(sMSAccess);