I'm using oracle web logic server. How can I find out the database name and port number?
You can use nslookup or tnsping to know the host name and port of the database.
nslookup DATABASE_SID
tnsping DATABASE_SID
1) You can login to the console and navigate to Data Sources (for WLS10 and above) and click the available data source and click the tab Connection Pool. You would need to navigate to the tab Connection Pool if WLS 8 is being used.
2) Alternatively you can go to the weblogic domain of your instance and check in the config directory , $WLS_DOMAIN/config/jdbc and view the contents of the datasource's xml file.
Related
I am trying to open test url
jdbc:h2:tcp://localhost/~/test
from H2 web interface, but it says
Database "D:/Users/USERNAME/test" not found, either pre-create it or
allow remote database creation (not recommended in secure
environments)
How to fulfil either pf propositions?
If you have a separate H2 Server process (launched from a jar file or as a service), you can open H2 Console from its icon in the system tray and use jdbc:h2:~/test URL in it, this copy of H2 Console should be able to create embedded databases automatically (unless remote access from other hosts was enabled). Other Java processes will still need jdbc:h2:tcp://localhost/~/test URL for connections to this database and they can use this remote URL after creation of embedded database on the server.
If H2 Console and TCP Server of H2 were launched from your application, your application should create this database by itself by establishing a connection with the same embedded URL jdbc:h2:~/test first.
You can also use a shell tool or any other way to create your database:
https://h2database.com/html/tutorial.html#creating_new_databases
All these ways also require the jdbc:h2:~/test URL to be used during creation.
There is also a flag to enable remote database creation, but this feature opens a security hole, either local (if remote connections are disabled by default) or remote if they were explicitly enabled. You should avoid usage of this feature.
I'm not an Oracle guy, but I find that I need to touch on some oracle resources to respond to a new report request. I'm working at an office where the connection to an oracle server uses LDAP and I can't get to the connection info. I do have an ODBC connection on my machine, so I can get into the database through MS Access. But I'd like to be able to connect with SQL Developer so I can do more useful profiling on the tables.
Is there any way to use my ODBC connection through Access to tease out Hostname, Port, and SID/Service name so I can connect through SQL Developer?
It seems I do not have permissions to the UTL_INADDR functions.
Since you have an ODBC connection defined already, you can open the ODBC Data Source Administrator on your computer (Goto the start menu and type ODBC in to search for it).
In the ODBC Data Source Administrator select the data source for the database in question (it may be on the User, System or File DSN tab) and click the Configure button.
From the Configuration screen you will be able to see the TNS Service Name for the connection.
The TNS Service Name should be all you'll need to supply to SQL Developer when creating the connection. Aside from your account credentials of course.
You can query SID and Hostname like this:
select instance_name, host_name from v$instance;
Afaik there is no way to query the port name from the database, see also this article on Ask TOM on this subject:
You cannot get the port -- the port is not necessarily known to the
database. The listener need not be running on the same machine with
the database, a single listener might be servicing many databases. A
database may have many listeners servicing it.
I've created an IBM ODBC connection to my server via Microsoft's own ODBC Administrator. After initially finding difficulties on where to put in the IP Address (otherwise, the ODBC uses my local database server), it finally managed to connect to my server PC successfully.
During this process, however, I did not put in a Database Alias, as I did not know what it means, nor what it is for. The ODBC still works fine.
The server, however, changed its IP Address. I don't know how or why it does that, and how to stop it, but now my previously working ODBC is now unable to connect, saying it gave an error message at 192.168.1.127, the server's previous IP Address.
I tried, and failed, to find out how to change the Host IP via the ODBC configuration.
In frustration, I deleted the ODBC connection, created a new one under System DSN, etc., etc., but upon clicking finish, it says the alias URCDB already exists.
How can I solve these problems?
Note:
URCDB is the name of my database. In both occasions, I did not put
anything in the alias field.
There are two URCDBs during the ODBC creation process. One was for
the local test database I used to have on my PC (deleted), the other,
I guess, was the left over from the recently deleted ODBC to my
Server.
You have two options:
1. Create a DSN with different alias.
When creating DSN give the original database name in database name filed and in alias field provide different name other than origina database name.
uncatalog the database name using the below command
go to run --> type db2cmd
db2 uncatalog database database name
now open ODBC create the DSN with giving DSN name and alias name as original database name
Most likely your server has DHCP enabled whereas servers shoud have a static IP address. Hope this helps. DHCP addresses are usually consistent but depending on what level network protocols are in place, the can and will likely change at some point.
I followed the link http://mobileworld.appamundi.com/blogs/andywigley/archive/2008/12/08/building-a-sync-services-for-ado-net-solution-for-mobile-devices.aspx
and was able to sync DB.
Problem is that it is only for static connection string and Server IP where SQL server DB is located which i provided through designer wizard.
now i want to change the connection string and Server IP as provided in some file.So that user can change the Server DB location and synchronize.I don't know how to proceed.Please Help
In the tutorial the MiddleTierServiceLibrary project has an App.Config file with the DB connection string. You can set the DB connection there.
I have a web site developed locally with a local Sql Server database. I also have a web host that provides one Sql Server database for my site. Now I want to deploy the application, and I would like to be able to manage the remote database from the Server Explorer in Visual Studio. I have the connection string used in the application, which works fine for adding, say, a datasource to a control etc. But I don't know if there's any way to use it to connect the database inside the Server Explorer so that I can add tables etc. I have read that you're supposed to be able to this instead of using the Sql Server Management Studio, but I have'nt read anything about how to connect to the remote database in it.
What I have tried so far is this: I have selected Add database in Server Explorer. This brings up first a dialog where I choose Sql Server. And then I get a dialog where I can set Server name (which I tried using the ip address in the connection string below), and Authentication (where I chose Sql Server Authentication, with the user id and password from below). But when I test the connection it fails.
Here's the connection string, which works fine when used for datasources in the application (obviously with different user name and password):
Any help appreciated!
EDIT:
Well, I've done everything suggested by lewiguez below now, but it doesn't make any difference. I can't believe this should be so hard... I keep getting this error message in Sql Server Management Studio:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)
Here's the process I follow for working with remote databases:
In VS 2008 under the Server
Explorer tab, right-click on "Data
Connections" and then click "Add
Connection"
Change the Data Source to
"Microsoft Sql Server"
Put in your fully-qualified
"Server Name" (be it IP Address, domain name, etc.), select "Sql Server
Authentication" and put in "User
Name" and "Password" for the database user
Select the database you want to connect to under "Select or enter a database name"
Hit "Test Connection" to test and then "OK" to accept
You should be able to interact with the database at this point by expanding the connection and then the "Tables" folder. For example, right-click on the Tables folder and you'll be presented with an "Add Table" option in the dialog. Right-clicking an existing table will bring up the "Open Table Definition" options where you can change any columns, etc.
If you're not getting to this point (and it sounds like you're not), I'd recommend checking your Sql Server connection from whatever machine you're using.
I generally do this by going into the Management Studio and connect with whatever credentials I'm trying to use. If they don't work, make sure they are, in fact, added as a Sql Server user and a database user (they have to be both).
Also, I would check in the Sql Server Surface Area Configuration Manager. You have to allow TCP connections and you have to be set up to allow Sql Server Authentication connections as well from remote hosts. If THAT'S all set up, but you still can't connect, I'd double-check to make sure your firewall is allowing Sql Server connections. The default port is 1433.
Also, if you can connect, but then can't write to anything, double-check your table permissions. Hope this helps!
I finally understood the problem: as I suspected the settings in my own installation was not the problem, but rather it was the settings on the Sql Server installation on my web host. And in fact I found a place in the control panel on my web host where I could set an exception to my ip address so that my ip would be granted access to the port 1433 for Sql Server, which is otherwise closed by default for security reasons.
I've had no luck finding any information about this at all on the internet, which I find strange. All the information I could find had to do with changing these settings on your own local installation of Sql Server. But I'm sure there are loads of people out there who like me use a web host for deploying their web site, and then that info doesn't seem to apply. (Perhaps apart from the TCP setting, which I think must be set, and there's detailed info about that here: http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/ )
Hope this helps someone else who like me uses a web host. Now everything works fine for me at least, both in Management Studio and in Visual Studio Server Explorer.