0

Case :

I'm creating a desktop application with VB.NET (Windows Forms), and using Oracle 11g Release 1 for its database.

Problem :

I want to create a client-server application, it means I just need a database on the server.

I have three computers. I set my first computers's IP to 192.168.1.1 , my second computer's IP to 192.168.1.2 and my third computer's IP to 192.168.1.3

Now I place the oracle database on my first computer whose ip address is 192.168.1.1, I want to connect the user "hr"

Problem is, how to connect my computer's database from the other two computers (the second one and the third)

specification: these are the Informations in the file tnsnames.txt

ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = pc)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )

Question :

  1. How to connect to the first computer (server) database from the two other computers (Clients)?

  2. Could you show VB.NET Connection String to the database and what kind of connection is used?

Thanks before.

  • You should download the .NET developer tools from Oracle and visit http://www.connectionstrings.com for info on the connection string. – jmcilhinney Apr 14 '17 at 03:36
  • http://www.oracle.com/technetwork/topics/dotnet/downloads/index.html – jmcilhinney Apr 14 '17 at 03:40
  • By the way, what you're talking about is not client/server. In a client/server scenario, you'd have a server application that connected to the database and then all your clients would connect to that one server. That sort of thing is generally done these days using a web service as the server. – jmcilhinney Apr 14 '17 at 03:42
  • Thanks for your response . I have downloaded that ODAC you mentioned and attach that file to VS as reference . I made a simple connection between oracle and vb.net (select data from a table in hr into a datagridview locally) . Now I want to connect the hr from another computer . Could U show me how the connection string will be written from the other computer . ConnectionString = – Dhafer Faisal Apr 14 '17 at 05:31
  • I don't use Oracle but I would assume that, if you're using that tnsnames.txt file, then you would put the name or IP address of the machine running the database in the HOST section. – jmcilhinney Apr 14 '17 at 06:00
  • @jmcilhinney, TO has a simple client-server architecture, you are referring to a Multi-Tier application. The application server is usually called "Mid-Tier". From database point of view this is the client, for the end-user it acts as (web-)server. Connecting from End-User client (typically you call such client a "fat client") directly to database server is also quite common - but maybe less "hype" nowadays. – Wernfried Domscheit Apr 14 '17 at 08:26
  • Replace `HOST = pc` by `HOST = 192.168.1.1` one each computer, then connection should work. – Wernfried Domscheit Apr 14 '17 at 08:28
  • The connection string depends on the provider/driver you are going to use. Which one do you use? See this list http://stackoverflow.com/questions/34803106/how-to-connect-to-oracle-11-database-from-net/34805999#34805999 to get all possibilities (known by me) – Wernfried Domscheit Apr 14 '17 at 08:29
  • Where do you mean to change HOST : In my ConString or in the file called"tnsnames.txt" this is my connection string : Dim OracleConnection As New OracleConnection() OracleConnection.ConnectionString = "Data Source=(DESCRIPTION=" _ + "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.1)(PORT=1521)))" _ + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));" _ + "User Id=hr;Password=hr;" is it correct? I tried that but there is an error appeares An unhandled exception of type'Oracle.DataAccess.Client External component thrown an exception – Dhafer Faisal Apr 14 '17 at 18:54

0 Answers0