Create a new database in Oracle Developer - database

I downloaded and installed Oracle SQL Developer on my computer. I connected to my company's database. However, as I'm still learning SQL queries - I would like to test out the queries that I wrote on a mock database.
My question is how do I create a database?
I searched through the internet and tried the following.
On the New/Select Database Connection Menubox I typed in the following:
Connection Name: HR_ORCL
Username: HR
Password: HR
Connection Type: Basic
Role: default
Hostname: localhost
Port: 1521
SID: ORCL
I then clicked on test and got the following error message: "Status: Failure-Test failed: IO Error: The Network Adapter could not establish the connection".
How do I create a mock database?
Thank you!

Oracle's flagship database product is a "client/server" system where databases run inside a server process that often runs on a dedicated database server computer, all other client software (including business web-applications, web-services, desktop software and development tools like Oracle SQL Developer) are separately run and do not require the database server be running locally.
To create a database that runs on your computer you need to install the Oracle database server on your computer. Given Oracle's business model of turning software licensing audits into a very profitable business model you likely won't get approval from your company's IT people to install Oracle server on your local machine: they'll either set you up with your own private database instance in an existing server for you to play with or instruct you to install a different (and free) database server not covered by Oracle's licensing schemes - these different products use a different dialect of SQL (e.g. MS SQL Server uses T-SQL, Oracle uses PL/SQL, etc) and different DBA and development tools (e.g. SSMS+SSDT instead of Oracle SQL Developer).

There's multiple options to getting a free Oracle database.
XE 18 was recently released here:
https://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html
There's a developer day vm that has labs inside it along with a database here:
https://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html
There's the docker option outline by Tim Hall here:
https://oracle-base.com/blog/2018/07/26/oracle-database-18-3-0-and-docker/

Related

SQL4499N when connecting to DB2 express V10.5 from IBM Data Studio 4.1

Background: I have to transfer VS 2003 and VB6 applications from Windows 7 to a new Windows 10 Home machine. The applications are currently using DB2 9.7, Sql Server or Ms Access via ODBC. I decided to consolidate all dbs to DB2 on the W10 machine, using separate schemas for the different databases. The W10 machine is normally standalone (No Lan or Internet).
Details: I installed DB2 Express V10.5 and IBM Data Studio 4.1 on the W10 machine. DB2 Express gives me enough for my db needs, and I assume that Data Studio will give me similar GUI functionality as DB2 Control Center v9 on the W7 machine.
I installed DB2 and Data Studio under at least two different user ids(one being Db2admin), all with windows admin rights, and different credentials.
But every time I try to login/connect in Data Studio I'm rejected with SQ4499N, I must be doing something fundamentally Wrong.
when running the following commands from CMD I get the shown results.
db2val
DBI1379I The db2val command is running. This can take several minutes.
DBI1333I Installation file validation for the DB2 copy DB2COPY1
was successful.
DBI1339I The instance validation for the instance DB2 was
successful.
DBI1343I The db2val command completed successfully. For details, see
the log file C:\Users\User\DOCUME~1\DB2LOG\db2val-Wed Mar 02 16_28_37 2022.log.
DB2LEVEL returns:
DB21085I This instance or install (instance name, where applicable: "DB2")
uses "32" bits and DB2 code release "SQL10054" with level identifier
"0605010E".
Informational tokens are "DB2 v10.5.400.191", "s140813", "IP23617", and Fix
Pack "4".
Product is installed at "C:\PROGRA~2\IBM\SQLLIB" with DB2 Copy Name "DB2COPY1".
DB2Start returns:
SQL1026N The database manager is already active.
Switching to DB2 CLP
db2 => List Active Databases returns:
SQL1611W No data was returned by Database System Monitor.
db2 => List database directory returns:
SQL1057W The system database directory is empty. SQLSTATE=01606
db2 => list system odbc data sources returns:
DB21037W No data sources found.
Checking Google and stackoverflow didn't yield any suitable help, at least I didn't see it.
My experience is as app developer, not db2 admin except what is needed for app dev, and I had no problems with DB2 V9.7 on W7, but I'm lost what to do.
Any help is appreciated.
The prerequisites and expected behavior is described at the Configuring the IBM Data Studio client for remote operations link.
You got this error either because of misconfiguration or some DS bug / unexpected behavior.
The solution was to create the database manually and just to register this database in DS afterwards.
In practical terms: DB2 V10.5 SQL-Express failed to install the Sample Database. IBM Data Studio tried to connect to the Sample Database and failed the operation with SQL4499N. Manually creating a database overcame this problem.

Is DB2 Server Discovery possible over a network?

I need to discover the running db2 servers in a network.
I tried to connect to all servers in the network using the JDBC connection. But the problem is while using JDBC, we need to specify the database name in the URL. As of now, I tried to connect to the SAMPLE database. But if a db2 instance does not have the SAMPLE database, the connection will fail.
So I want to know the other possibilities to discover db2 servers in a network and also Is there any way to connect to the instance of the db2 server unlike connecting to a particular database(Similar to SQL - Connecting to an instance using port only)
Db2 administration server (DAS) has the corresponding functionality. Refer to the following link:
Discovery of administration servers, instances, and databases.
Note, that DAS is deprecated and may be removed in future Db2 releases.

Multiuser SQL Powered Access Database Over Network

I have been creating an access database for my assignment. I am using SQL Server 2014 for the datasource for the access tables. Now the problem is that according to the assignment
I need to make the db multiuser over network
it has to be an accde file
In short, how can I connect to SQL Server when I deploy the database on my college pc. And how to make the accde work on my school network where the SQL Server is not the one I am using at my personal machine.
It is a simple book entry database containing few tables including print button and picture of book attachment.
Use a DSN-less connection. Provide a function that changes the connection string on all linked tables.
See Linked table ms access 2010 change connection string
or Changing SQL connection information for DSN-less Access frontend
You don't want each user having to enter the server information into the frontend. So take your frontend to the school network, run the function to re-link all tables, then create the .accde, then distribute it.
If the sql server is on your same network, then all you have to do is link your tables to the production sql server. You then crate the accDE, and that can be deployed to any machine.
Access by “default” creates a DSN less connection. So if you follow the defaults when linking to sql server (use a FILE dsn), then once access links to those tables, access “converts” the DSN to a DSN less connection for you.
What this means is that you do not need any VBA re-linking code. When using a file dsn, access converts these to DSN less for you. Once linked, then Access ignores and does not use nor require the original DSN.
So your steps are:
Linking to the production SQL server on the network. Just make sure you use the “default” file dsn.
Once you are sure the accDB works with that production SQL server, you can then compile/create the accDE. That accde will now function on ANY workstation (and this work since access by default creates and uses and makes a DSN less connection for you).
You do NOT need any VBA re-link code.
You do NOT have to write some VBA code to create a DSN less connection (access does this automatic for you).
Of course, during this re-link process, your computer will have to be on the same network with the production SQL server you plan to link to.
If you were some off site worker, and you cannot be on the same network during the re-link process, then YES you would have to adopt some VBA code to re-link for you. However, if you can be on the same network during this re-link process, then at that point you can create the accDE file, and it can be distributed to any workstation on that network without further configuration.
About the only issue would be to ensure that you link to this production server using the standard and legacy “SQL Server Driver” as your linking choice. You can use the later “native 11” etc. drivers, but they are not installed by default on each version of windows and thus this ODBC driver may well not be installed on each workstation (but the standard SQL Driver is installed by default.
Again:
You do not need some VBA code or re-link code to create a DSN-less connection. Access by default when choosing a “file” DSN will create DSN-links for you – you thus don’t need any special re-link code, nor do you need some VBA re-link code to achieve DSN-less links.

Oracle AWS RDS database link ORA-12545

I'm trying to create a database link from my Oracle AWS RDS instance to another Oracle database outside my VPC. I created the database link this:
create database link test
connect to myusername
identified by "mypassword"
using '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=my.db.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=servicenameame)))';
However when I run a query against that database link I get the following:
SQL> select sysdate from dual#test;
select sysdate from dual#test
*
ERROR at line 1:
ORA-12545: Connect failed because target host or object does not exist
I did some googling of ORA-12545 and the majority of the issues people are having with this error is either an intermittent connectivity failure (of which mine is not, it fails every time), or a misspelled hostname/incorrect port. My issue is also not an incorrect hostname/port because I am able to CONNECT to my.db.com using the same connection string and query the database that way.
Does anyone have any suggestions?
Source Oracle database is:
Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
Destination Oracle database I am trying to connect to is:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
I (somewhat) found the answer I needed. The TLDR version is that after much googling and desk pounding I did an nslookup on the hostname of the database I am connecting to (the my.db.com portion of TNSNames). I modified the TNSNames to connect to the IPs returned by the nslookup. My final TNSNames looks something like the following:
(DESCRIPTION=
(ADDRESS_LIST= (LOAD_BALANCE=on)(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=w.x.y.z1)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=w.x.y.z2)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=w.x.y.z3)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME= servicenameame)))
The long version is that the Oracle host I am connecting to is configured with a Single Client Access Name (SCAN). After looking at the discussion on this post I went with just looking up the host name. I initially tried to modify the REMOTE_LISTENER in the AWS RDS Parameter Group, but that was not modifiable.

Connecting to DB2 through ODBC is extremely slow

I am experiencing extremely slow connections to a local DB2 (v9.7 Express-C) database through ODBC on a Windows 7 system (x64). I wrote several test programs, each connecting to a local database for 100 times in a row (without querying) and measuring the time. Results are:
C++ x86 DB2/ODBC: 32bit C++ application, connecting to a local DB2 database via CDatabase
C++ x86 DB2/ODBC: same as above, but x64 application
PHP DB2/ODBC: Connecting to a local DB2 database via odbc_connect.
PHP MySQL/ODBC: Connecting to a local MySQL database via odbc_connect.
JDBC DB2: Java application, connecting to a local DB2 database using the DB2 JDBC driver.
JDBC MySQL: Java application, connecting to a local MySQL database using the MySQL JDBC driver.
My first thought was that something's wrong with my ODBC configuration, but as you can see connecting to a MySQL database through ODBC works like charm. On the other hand, connecting to DB2 with the JDBC driver instead of ODBC works fine too (although it's still a lot slower than MySQL).
I found this related question, but it does not apply to me.
Any hints on what might be causing this and how to resolve would be great!
Supplementary question: What are common connection times when connecting to a DB2 database through ODBC? Is it normal for the DB2 ODBC driver to be so slow?!
One thing that you should look at is the database activation. DB2 activates the database upon the first connection and deactivates it when the last connection is closed. During activation DB2 allocates transaction log files, memory pools, and performs a number of other tasks that take time.
This behaviour does not depend on the type of connection (ODBC or JDBC); the difference you observe might be explained by an extra connection that keeps the database active during your JDBC tests.
Try issuing ACTIVATE DB <YOURDB> before your tests, which will keep the database active even in the absence of connections. There is no way to activate databases by default, apart from issuing this command upon the system startup, e.g. from a batch file.

Resources