Sql developer custom connection string - oracle

How to use custom connection string in Oracle sql developer to connect?
jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=147.22.109.218)(port=1521))(ADDRESS=(PROTOCOL=TCP)
(HOST=147.22.109.219)(port=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=147.22.109.220)(port=1521)))
(FAILOVER=on)(LOAD_BALANCE=on)
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=cmphpd)))
Please help. Thanks

To us a TNS connection string, in the New / Select Database Connection window where you configure the connection:
Set Connection Type to TNS
Under the Details tab select Connect Identifier
Put the connection string into the text box next to Connect Identifier
Click Test if you'd like, to make sure it works
Click Save
Similarly, under Connection Type there also seems to be an option for a custom JDBC URL if that's what you prefer.
(Instructions and screenshot from version 19.4, in case it makes a difference)

Try this:
jdbc:oracle:thin:#147.22.109.220:1521/cmphpd

These are the best and complete instructions I've found.
https://blogs.oracle.com/dev2dev/ssl-connection-to-oracle-db-using-jdbc,-tlsv12,-jks-or-oracle-wallets
Below are the steps which I took to fix this issue:
Install JCE (following the instructions in Readme) - JCE
Add below lines in build.gradle
System.setProperty('oracle.net.ssl_version', '1.2')
System.setProperty('oracle.net.ssl_cipher_suites', '(TLS_RSA_WITH_AES_256_CBC_SHA256)')
System.setProperty('oracle.net.tns_admin', './lib')
System.setProperty('oracle.net.ssl_server_dn_match', 'true')
Setup db connection like
String connString = "jdbc:oracle:thin:#(description=(address_list=
(address=(protocol=tcp)(port=1521)(host=prodHost)))
(connect_data=(INSTANCE_NAME=ORCL)))";
OracleDataSource ods = new OracleDataSource();
ods.setURL(connString);
ods.setUser("scott");
ods.setPassword("tiger");
Connection conn = ods.getConnection();

Related

Telerik report not working

An error has occurred while processing Report 'ReportStandart': Unable to establish a connection to the database. Please, verify that your connection string is valid. In case you use a named connection string from the application configuration file, make sure the name is correct and the connection string settings are present in the configuration file of your application. ------------- InnerException ------------- !
Go to the folder where your report project is.
Open the folder and look for the file "Telerik.ReportDesigner.exe.config"
Open the file in Visual Studio and copy the connection string
Past the above connection string to your web.config
You can find the above here towards the end of the video (3':15'')
In this sample, we have got sqlDataSource by filling connection string:
MyReport report = new MyReport();
string selectCommand = #"SELECT * FROM Sales.Store";
string connectionString = "Data Source=(local)\\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True";
Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource(connectionString, selectCommand);
report.DataSource = sqlDataSource;
In my case, my start-up project has connection string in its config file so I cannot use the connection string again in another project because of this error:
an error has occurred while processing table 'crosstab 1' ...
format of the initialization string does not conform to specification
starting at index 0
This error is because of having 1 more connection string.
Maybe this discussion on the Telerik site entitled Set CrossTab DataSource in code-behind will help.

Umbraco - First run - connection string failed

I just downloaded Umraco (via Web Platform Installer).
It takes me to this web page:
How can I just select 'integrated security'?
That connection string is set to a blank database that exists. I have added 'IIS AppPool\DefaultAppPool' and 'IIS APPPOOL\UmbracoTest' as database owner. The next screen is like this Database configuration is invalid for connection string Data Source=.;Integrated Security=True;Initial Catalog=UmbracoTest:
That connection string is fine, I've used '.' datasource elsewhere with no problems (SQL Express).
Is there any way to get useful error messages?
How can I get this working?
Thanks.
I just ran into the same issue during an Umbraco 6.1.5 installation. My issue was the providerName being empty as suggested, so when I added:
providerName="System.Data.SqlClient"
I was able to install and upgrade my Umbraco 6.1.3 database. My full connection string is:
<add name="umbracoDbDSN" connectionString="server=72.18.**.***,1533;database=mydatabase;user id=emma;password=******" providerName="System.Data.SqlClient" />
The connection string is wrong, trust me :)
Instead of DataSource=. try DataSource=.\sqlexpress
Also ensure that the initial catalog=UmbracoTest is actually the correct name of the database.
Finally, since you are using an Umbraco 6.x version, the log files will be at ~App_Data/Logs but in this case they will just tell you much the same as the install screen, that an SqlException has occurred.
Edit:
Looking at the Umbraco source, the error you see is raised by the following code:
if (_configured == false ||
(string.IsNullOrEmpty(_connectionString) ||
string.IsNullOrEmpty(ProviderName)))
{
return new Result
{
Message =
"Database configuration is invalid. Please check
that the entered database exists and that the provided
username and password has write access to the
database.",
Success = false,
Percentage = "10"
};
}
So my assumption is that you are missing the Provider from your connection string. In your web.config file your connection should look like this:
I had the same issue. I fixed it by adding the IIS_IUSRS user to the Umbraco site directory with "Modify" rights as the setup process is trying to write to the web.config with your connection string. Hope this helps.

How can a client query a db4o server?

I've set up a db4o server and client. My client calls are not working.
What's puzzling to me is that the db4o examples show how the client can close the server, but not how to get and save data. See: http://community.versant.com/Documentation/Reference/db4o-7.12/java/reference/Content/client-server/networked/simple_db4o_server.htm
If I start the db4o server, and run netstat, I can see that the port is open. And on the client, I can do things like this:
Debug.WriteLine(db.Ext().IsClosed().ToString());
And that returns False, which is good.
But when I try to get or save data, it doesn't work. When saving data, it appears to work, but I don't see the data in the DB. When trying to retrieve the object, I get this error:
Db4objects.Db4o.Ext.Db4oException: Exception of type 'Db4objects.Db4o.Ext.Db4oException' was thrown. ---> System.ArgumentException: Field '_delegateType' defined on type 'Db4objects.Db4o.Internal.Query.DelegateEnvelope' is not a field on the target object which is of type 'Db4objects.Db4o.Reflect.Generic.GenericObject'.
Here are the client calls to save, then get:
Server server = new Server() { Name = "AppServerFoo" };
IObjectContainer db = GetDatabase();
db.Store(server);
db.Close();
Here's the only line in the GetDatabase() method:
return Db4oClientServer.OpenClient(Db4oClientServer.NewClientConfiguration(), "DellXps", 8484, "user", "password");
And here's the call to get from the DB:
IObjectContainer db = GetDatabase();
Server testServer = db.Query<Server>(server => server.Name == "AppServerFoo").FirstOrDefault();
db.Close();
What am I missing?
Well a server without a reference the persisted classes is a 'risky' thing. A lot of functionally doesn't work and the error which occur are cryptic. I highly recommend to always reference the assembly with the persisted classes on the server.
Another tip: Use LINQ instead of native queries. It works better and has less problems.
A ha! I got it. It took some googling, but the problem was that the server didn't have a reference to the entities. As soon as my server project referenced my client project, it worked. So, it looks like I just need to move my entities to a common project that both the client and server can reference.
Thanks to this link:
http://www.gamlor.info/wordpress/2009/11/db4o-client-server-and-concurrency/
This link looks like a gateway to having the server work without referencing the entities:
http://community.versant.com/Documentation/Reference/db4o-7.12/net2/reference/html/reference/client-server/server_without_persistent_classes_deployed.html

IIS5 - ODBC - Data source name not found and no default driver specified

I’ve got some problem using an ODBC connection with IIS.
Here is my config :
IIS 5 on Windows XP
ASP.NET 2.0
Oracle 9
VS 2005
When I try too use my web application on IIS, I’ve got the following exception:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
BUT, when I use it like a web site in VS2005, I didn’t have any error.
So, I’d try to make a very little app, with the following code:
using System;
using System.Data;
using System.Data.Odbc;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
OdbcConnection con = new OdbcConnection();
con.ConnectionString = "DSN=<MyDSN>;Uid=<LOGIN>;Pwd=<PASSWORD>";
IDbCommand com = new OdbcCommand();
com.CommandText = "select sysdate from dual;";
com.CommandType = CommandType.Text;
com.CommandTimeout = 30;
com.Connection = con;
try
{
con.Open();
Response.Write(com.ExecuteScalar());
}
finally
{
if (con.State == ConnectionState.Open)
con.Close();
}
}
}
It work fine on VS’s web server (ie: http://localhost:3715/Web/Default.aspx), but I’ve got the same exception (IM002) when I use it on IIS (ie: http://localhost/Tester/default.aspx).
My DSN is declared on the “ODBC Data Source Administrator” and work well when I test the connection…
The ASPNET account is in the same group as my user account (Administrators).
Full right for ASPNET Account on HKEY_LOCAL_MACHINE\SOFTWARE\ODBC and
HKEY_CURRENT_USER\Software\odbc keys.
I've read this post, but nothing work...
I'd look after an answer on stackoverflow (search, related questions, etc.), google...but I didn't found a working solution...
Is there anyone who have an idea?...
Where is my mistake?...
UPDATE: 2011/04/06
What I’ve done so far:
Tracing for ODBC: on VS’Web server, I got log; but on IIS, none...
System and User DSN are filled with the same information
Allow ASPNET, IUSR_XXX, IWAN_XXX, and all users (sic…) accounts full rights to: %ORACLE_HOME%, HKEY_LOCAL_MACHINE\SOFTWARE\ODBC, HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
Windows, VS and IIS are all for 32 bits (so, there is no c:\windows\syswow64).
Check PATH value, and put %ORACLE_HOME% first.
IIS was reset each time I do a modification, my computer reboot twice.
But, now, I’ve got this message:
ERROR [IM003] Specified driver could not be loaded due to system error 998 (Oracle dans OraHome92).
And I finally found...
The administrators have install all the drivers in order to be used by the user only...
I’d create a system env var ORACLE_HOME...
There was only a user var :s
Thanks for your help.
I validate the Garry M. Biggs' answer because of the difference between system/user...
Had this problem ..
The best solution is to re install your odbc driver ... worked for me ..
the registry entries in your system might have got tampered .
I did a complete uninstall and re install .. worked for me .. lame but quick solution .
Make sure you have created a System DSN rather than a User DSN.
IIS will be running as a System service and therefore does not have access to User registry entries...
Maybe your system is 64 bit version
of Windows and IIS is 64 bit, but VS
is 32 bit? If so, look at my
answers:
odbc connection string dosen't work on windows 7
If you can connect from one environment and not from the other then enable ODBC tracing and compare log files. MS described it at: http://support.microsoft.com/kb/274551

ORA-01019 connecting to Oracle from Excel

I have installed Oracle 10g Express Edition. When try to test the connection I am getting the error "Error while trying to retrieve text for error ORA-01019".
Below is my code.
strConnection = "Driver={Microsoft ODBC for
Oracle};Server=Servername;Uid=username;Pwd=password;"
Set conn = CreateObject("ADODB.Connection")
conn.Open strConnection
conn.Close
Set conn = Nothing
Thanks in advance
I had the following error occur recently.
System.Runtime.InteropServices.COMException (0x80004005): ORA-01019: unable to allocate memory in the user side
at ADODB.ConnectionClass.Open(String ConnectionString, String UserID, String Password, Int32 Options)
I managed to resolve the problem by simply modifying my connection string.
from:
"Provider=MSDAORA.1;Data Source=tprss;Persist Security Info=True;User ID=myUser;Password=myPassword"
To:
"Provider=MSDASQL;Data Source=tprss;Persist Security Info=True;User ID=myUser;Password=myPassword"
someone modified/updated the components on the box.
"ORA-01019 unable to allocate memory in the user side
Cause: The user side memory allocator returned an error.
Action: Increase the size of the process heap or switch to the old set of calls."
Followup from the comments:
Could you try this code?
Dim Cn As ADODB.Connection
Dim CP As ADODB.Command
Dim Rs As ADODB.Recordset
Dim Conn As String
Dim QSQL As String
'Connect to Oracele server begin
Conn = "DRIVER={ORACLE ODBC DRIVER};SERVER=Service name;UID=username;PWD=password;DBQ=Service name;DBA=W;APA=T;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;FRL=F;MTS=F;CSR=F;PFC=10;TLO=O;"
Set Cn = New ADODB.Connection
With Cn
.ConnectionString = Conn
.CursorLocation = adUseClient
.Open
End With
If Cn.State = adStateOpen Then
MsgBox "Connection successful."
End If
'Connect to Oracle server end
'close connection begin
Cn.Close
Set Cn = Nothing
Set CP = Nothing
'close connection end
(This didnt fit in a Comment box)
You need at least one driver. The oracle driver is best but Microsoft Driver will work too.
Lets first try to make a connection string. Right click on your desktop and the create a new .txt file.
Now rename your textfile to something.udl
Double click on the udl file. Go to "Provider" and select Microsoft OLEDB Provider for Oracle. Then click on next. In the server name field you fill in your TNS name. Then username and password and put a V inside "Allow saving password" (we will need this) And click on test connection. Make sure this works.
If it works then click on OK. Now open the UDL file with a text editor. You will see something similar to:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=MSDAORA.1;Password=yourpw;User ID=youruser;Data Source=yourTNS;Persist Security Info=True
Copy this part into your connection string:
Provider=MSDAORA.1;Password=yourpw;User ID=youruser;Data Source=yourTNS
Now your connection string should look like:
Conn = "Provider=MSDAORA.1;Password=yourpw;User ID=youruser;Data Source=yourTNS"
I hope this works.
We had the same problem, specifically on Windows 7 when using the Microsoft OleDb driver from VB6.
Following the instructions in this post fixed out problem:
http://prasanth4microsoft.blogspot.com/2010/11/windows7-excel-vba-ora-01019-unable-to.html
I had this problem also but it is on win10.. After I have tried a lots of different solution from web .. Finally.. it worked to change connection string to fix this problem.. But I changed "Provider=MSDAORA.1" to "Provider=OraOLEDB.Oracle"

Resources