473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Error connecting to DB2 Databse from C#

while opening a new DB2 connection using ODBC connection i get the
following error message

ERROR [08004] [IBM][CLI Driver] SQL30061N The database alias or
database name \"DATABASENAME \" was not found at the
remote node. SQLSTATE=08004\r\n\r\nERROR [IM006] [Microsoft][ODBC
Driver Manager] Driver's SQLSetConnectAttr failed"string

here i find some additional spaces are appended along with the
DATABASENAME and hence my connection fails.how to make a successful
connection here?

server is DB2 UDB for OS/390 7.1.1
client is DB2 CONNECT PE DB2 v8.2 installed in windows XP

I used IBM DB2 Data Access Application Blocks for .NET which uses .NET
native provider for DB2...still i get the same error message!

i use IBMDADB2 Provider
Nov 12 '14 #1
8 2789
Frinavale
9,735 Expert Mod 8TB
I have not used an IBM DB2 database before; however, that error messages states that the database that you are expecting to connect to does not exist.

Use the IBM tools available to you to ensure that your database server actually contains the database.

If it does not contain the database then you will have to run the appropriate SQL scripts/statements in order to create the database that you are expecting to be there (with the name that you are expecting it to have)

-Frinny
Nov 12 '14 #2
Frinny

Thank you for your response. I am able to connect to the DB and run SQL from IBM tool (DB2 Connect). I am having trouble connecting to the DB from C#.
Nov 12 '14 #3
Frinavale
9,735 Expert Mod 8TB
Could you post your connection string?

Maybe there's something wrong with it that you missed.

Double check that the database names match, the server locations match etc....

-Frinny
Nov 12 '14 #4
"Provider=IBMDADB2; Database=****; HOSTNAME=****; PROTOCOL=TCPIP; PORT=123; uid=****; pwd=****;"

this is how my connection string looks.

I did installed IBMDADB2 driver.
Nov 12 '14 #5
Expand|Select|Wrap|Line Numbers
  1. string db2ConStr = "Provider=IBMDADB2; Database=****; HOSTNAME=****; PROTOCOL=TCPIP; PORT=123; uid=****; pwd=****;"
  2.  
  3.     public DataSet GetCPData()
  4.     {
  5.         OleDbConnection db2Con = null;
  6.         OleDbDataReader CPReader = null;
  7.         try
  8.         {
  9.             db2Con = new OleDbConnection(db2ConStr);
  10.             string CPSelect = "SELECT Query;";
  11.  
  12.             OleDbCommand CPCommand = new OleDbCommand(CPSelect, db2Con);
  13.             db2Con.Open();
It fails on db2Con.Open();

I get

SQL30061N The database alias or database name "**** " was not found at the remote node. SQLSTATE=08004
Nov 12 '14 #6
Frinavale
9,735 Expert Mod 8TB
Ok,

According to the IBM DB2 Connection String Documentation your connection string should look like:

Expand|Select|Wrap|Line Numbers
  1. string conString = "Server=serverAddress:serverPortNumber;Database=theDataBase;UID=myUsername;PWD=myPassword;";

Your connection string does not match that.

Your connection string looks to be missing the address (the server's IP address or computer name for the if it is on an internal network with domain name resolution)


-Frinny
Nov 12 '14 #7
No, It expects Provider in the connection string.

"Provider=IBMDADB2; Database=****; HOSTNAME=****; PROTOCOL=TCPIP; PORT=123; uid=****; pwd=****;"
Nov 13 '14 #8
Frinavale
9,735 Expert Mod 8TB
Well, if your connection string doesn't work, and the documentation I found is not correct, consider trying to use the MsDb2ConnectionStringBuilder Class (<- a link to the documentation on the topic)

-Frinny
Nov 13 '14 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: kamilla | last post by:
I have a mysql 3.5 server installed on a suse linux 8.1, with address 10.0.0.100. Now I want to access that db from a W2K pc, address 10.0.0.200. I am able to ping 10.0.0.100, but I cannot connect...
3
by: GTDriver | last post by:
I'm trying to connect my application with a web service located on my own web server(localhost). I guess when the solution/proect is built it makes a file called 'Web...
6
by: Alexander Cohen | last post by:
Im trying to connect locally to a database on a running postgres cluster. If i connect with psql, everything is fine and i can transact. I i try and connect in my own app, i get this error: ...
1
by: Goutam Paruchuri | last post by:
Hello, I get an error in my log when connecting to postgres server on Windows. Postgres version : 8.0.0-beta4 LOG TEXT 2004-11-10 11:22:47 LOG: invalid entry in file "C:/Program...
0
by: Mike Snetzko | last post by:
Hi All -- I have a website on an IIS 6.0 server and I am trying to update the settings via asp page and vbscript. Below is the code that is supposed to retrieve the Metapath, and it does,...
3
by: Ann Marinas | last post by:
Hi there, I am currently developing an ASP.NET program that connects to a SQL Server 2000 database. I also have SQL Server 2005 Express installed on the same local machine. Prior to...
2
by: hfk0 | last post by:
Hello, I'm a newbie here and was wondering anyone could help me with this. I have a simple ASP.NET 2 web application running perfectly fine with IIS and SQLServerExpress installed locally on...
2
by: minckle | last post by:
hi, i am trying to get an enquiry form into a database, but i keep getting the following error: Microsoft JET Database Engine (0x80004005) Not a valid file name. The website and database are...
0
by: athindrans | last post by:
hi everyone first time using sql server. I have problem connecting from a small c++ program in visual c++ express editon to sqlserver 2005 developer editon. It says error connecting to...
10
by: mairhtin o'feannag | last post by:
Hello, I'm having problems connecting to my new v9 db box. The pertinent information is below: DB2_db2inst1 60000/tcp DB2_db2inst1_1 60001/tcp DB2_db2inst1_2 60002/tcp DB2_db2inst1_END...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.