SQLConnect question...

Posted on 2002-06-05
Last Modified: 2010-05-18
I am writing a C++ front end for an SQL database ass a school assignment. (Cal State Hayward in California - A Database Architecture class...)

I am having trouble connectuing to the school's SQL database with the SQLConnect function.  Where I supply the database name, I have an IP address for the database, but it's not port number 80, it's a port number in the 1500 range.  (The database also has a short five letter name.)  Specifying the IP address won't let me connect.  How do I specifiy the port number in SQLConnect argument that asks for the database name?  Do I need to provide the database name as well?  

The function parameters are like so:
SQLConnect(hdbc, (SQLCHAR*) "database name (Or IP address)", SQL_NTS,
                           (SQLCHAR*) "username", SQL_NTS,
                           (SQLCHAR*) "password", SQL_NTS);

Confused.  Ack!

Question by:Ubercat

Accepted Solution

andymurd earned 50 total points
ID: 7078070
Hi Ubercat,

If your using the ODBC function SQLConnect(), the 1st parameter is not an IP address, but the name of a (previously configured) ODBC connection.

On Windows, you configure a connection using the ODBC Administrator found in the control panel. Setting up an ODBC connection will provide a means of specifying the host, port number and database name.

Here's Microsoft's documentation on SQLConnect:

Have fun...
LVL 11

Expert Comment

ID: 7261502
Dear Ubercat

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept


comment(s) as an answer.


Expert Comment

ID: 7332887
Force accepted

** Mindphaser - Community Support Moderator **

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now