0

My application has a feature to connect to 4 different database servers (MS SQL, MySql, SQLite and Oracle), and if no database exists, it will create a new one with the specified database name. This logic works on all servers, except on Oracle. If the database exists, i can connect to it on all four servers, so i think the problem is not related to my tns, or wrong dll, or anything like that, but maybe my connectionstring is wrong in this case.

The Oracle server version is 11.0.0.1, and i installed the necessary odac drivers. There is a tns set on my pc and everything is working properly when the database exists. In this case the connectionstring looks like this:

User Id=<myuser>; Password=<mypassword>; POOLING=true; Connection Lifetime=15;
Connection Timeout=15; incr pool size=10; Data Source=
(
DESCRIPTION=
(ADDRESS=
 (PROTOCOL=TCP)
 (HOST=<myserveraddress>)
 (PORT=<myport>)
)
(
 CONNECT_DATA=
 (SID=<mysid>)
 (SERVICE_NAME=<mydatabasename>)
)
);

Now, if i remove the servicename section from the connectionstring, i get an "ORA-12505: TNS:listener does not currently know of SID given in connect descriptor" exception.

What should i do when i only want to connect to a server, but not directly to a database?

4

2 回答 2

0

你误解了这里发生了什么。

在 Oracle 中,您不会创建数据库,而是创建用户/表空间。

甲骨文:

服务器 > 实例(数据库) > 表空间

其他:

服务器 > 实例 > 数据库

于 2014-03-22T07:45:45.973 回答
0

oracle 数据库创建的概念与其他数据库不同。

请点击以下链接

http://docs.oracle.com/cd/E16655_01/index.htm

并选择选项“2天DBA”

创建数据库最好的方法是使用oracle提供的图形界面,即从dbca.bat开始

于 2014-03-22T07:40:46.470 回答