C++, do not connect then succeeds to express the database

I'm not sure this is the right forum but as it says Visual Studio and that my program is C++, I hope I'm not offending person.
The following code fails to connect to the database, even if when using Express database I managed to log very well.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oci.h>

// #pragma comment(lib, "d:\\orant\\oci80\\lib\\msvc\\ora803.lib")

static OCIEnv           *p_env;
static OCIError         *p_err;
static OCISvcCtx        *p_svc;
static OCIStmt          *p_sql;
static OCIDefine        *p_dfn    = (OCIDefine *) 0;
static OCIBind          *p_bnd    = (OCIBind *) 0;

void main()
{
   int             p_bvi;
   char            p_sli[20];
   int             rc;
   char            errbuf[100];
   int             errcode;

   rc = OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0,  /* Initialize OCI */
           (dvoid * (*)(dvoid *, size_t)) 0,
           (dvoid * (*)(dvoid *, dvoid *, size_t))0,
           (void (*)(dvoid *, dvoid *)) 0 );

   /* Initialize evironment */
   rc = OCIEnvInit( (OCIEnv **) &p_env, OCI_DEFAULT, (size_t) 0, (dvoid **) 0 );

   /* Initialize handles */
   rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_err, OCI_HTYPE_ERROR,
           (size_t) 0, (dvoid **) 0);
   rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_svc, OCI_HTYPE_SVCCTX,
           (size_t) 0, (dvoid **) 0);

   /* Connect to database server */
   rc = OCILogon(p_env, p_err, &p_svc, "BIG", 5, "BIG", 5, "S6S", 8);
   if (rc != 0) {
      OCIErrorGet((dvoid *)p_err, (ub4) 1, (text *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
      printf("Error - %.*s\n", 512, errbuf);
      exit(8);
   }
.......snip.......
errbuf contains 0x0012ff00 ' ORA-01017: username/password invalid name: connection refused ".

Please tell me what I did wrong?

Hello

This forum is made for the Oracle Developer Tools for Visual Studio, which is part of the family of Oracle products .NET. The forum of the OIC is above this way:

Oracle Call Interface (OCI)

However, I don't think anyone will be too offended.

A quick glance at your code, I see you have hardcoded the values for the parameters uname_len, passwd_len and dbname_len and the transmitted value is greater than the actual length of the parameters that you provide.

I would like to change this:

rc = OCILogon(p_env, p_err, &p_svc, "BIG", 5, "BIG", 5, "S6S", 8);

to do this:

rc = OCILogon(p_env, p_err, &p_svc, "BIG", 3, "BIG", 3, "S6S", 3);

Of course, I guess that hard coding is there just for a test, etc.

Kind regards

Mark

Tags: Database

Similar Questions

  • Firefox does not connect to any site since the new update to download.

    Firefox does not connect to all websites since the installation of the last update. Google Chrome and Internet work.

    Some problems occurs when your Internet security program was set to trust to the
    a previous version of Firefox, but no longer recognizes your updated as version
    level of confidence. Now how do I solve the problem: to allow Firefox to connect to the Internet
    Once again;

    • Make sure your Internet security software is up-to-date (for example, you are using the latest version)
    • Delete Firefox to list your program of trusted or recognized programs, then add it again. For detailed instructions, see

    Configure the firewall so that Firefox can access the Internet. {web link}

  • HP b209a printer range will not connect to router comcast using the WPS button

    HP b209a printer range will not connect to router comcast using the WPS button. I try to use a new Comcast router (technicolor TC8305C). When I try to connect the printer times out and says that no connections are when I check for wireless connections. Yet, when I print the network configuration page, the SSID for the new router is at the top of the list. I reinstalled the software by the support of Comcast, but it did not help.  I'm ideas please help!

    Thank you

    Never use WPS to connect.  If done it should be disabled in the router for security reasons.  Connect manually via the SSID and password following the instructions in the manual.

  • windows\system32\config\system\file is damaged or missing, system will not start, I have not connection wired, software was on the laptop at the time of purchase

    system will not start, I have not connection wired, software was on the laptop at the time of purchase.

    Hello

    There is no Windows Vista downloads available from Microsoft.

    You can contact your computer manufacturer and ask them to send you a set of recovery disks.

    They should do this for a small fee.

    And if you have never received a recovery disk when you bought your computer, there should be a recovery Partition on the hard drive to reinstall Vista on how you purchased your computer.

    The recovery process can be started by pressing a particular combination of the key or keys at startup. (Power on / start)

    Maybe it's F10, F11, Alt + F10, etc., depending on the manufacturer.

    Ask them to the proper key sequence.

    You can also borrow and use a Microsoft Vista DVD, which contains the files for the different editions of Vista (Home Basic, Home Premium, Business and Ultimate) must be installed. The product key on your computer / Laptop box determines what Edition is installed.

    Other manufacturers recovery DVDs are should not be used for this purpose.

    And you need to know the version of 'bit' for Vista, as 32-bit and 64-bit editions come on different DVDs

    Here's how to do a clean install of Vista using a DVD of Vista from Microsoft:

    "How to do a clean install and configure with a full Version of Vista '

    http://www.Vistax64.com/tutorials/117366-clean-install-full-version-Vista.html

    And once the operating system is installed, go to your computer manufacturer's website and get the latest drivers for your particular model or laptop computer.

    And phone Activation may be necessary when you use the above installation method.

    "How to activate Vista normally and by Activation of the phone '

    http://www.Vistax64.com/tutorials/84488-activate-Vista-phone.html

    See you soon.

  • VRM not connected to SQL 2008 Express database

    I have problems connecting using MRS 5. The user ID is good, I can connect to the instance with her, but the VRM device cannot see the database.  The error I get is "error boot configuration application. Please check the information provided by DB. I find nothing in the SQL or standard windows journals.

    SQL Express is supported for VRMS? We really do not want to deploy a complete SQL database in our environent DR.

    Did you create the DB yourself? You should check the connection information and permissions. There is a list of the explicit permissions that you should give the login in the VRMS installation guide, or you can be lazy and just do a sysadmin (not recommended for a production environment.) Was it an instance of SQLExpress by default? Do you use FULL domain name or IP to connect?

  • I've recently updated my Apple ID (including the change of password). However, could not connect to iTunes to update the applications or make purchases. Any help?

    I've recently updated my Apple ID (including the change of password). However, could not connect to the iTunes Store to update the applications or make purchases. Any help?

    Have you tried a forced reboot? Hold down the home and Sleep/Wake buttons simultaneously for about 15-20 seconds , until the Apple logo appears. You won't lose anything.

    Then sign out of the iTunes Store and reconnect.

  • Annoying Message "not connected" when TV goes to the Source of ATV4

    I use my Apple TV 4 as one of the three input sources for my new 65 ' 4 K Samsung TV. TV uses its system Anynet + (HDMI-CEC) to control the switching and control of the three entrances (the other two are cable box and a Blu Ray player).  This works perfectly except when I turn to the Apple TV 4 as a source. The screen then displays a message saying "Anynet + source not connected, please check the connections" for a minute. Otherwise, everything works correctly with picture, sound and control. The message disappears after a minute, but is a gene in a good state of market system.

    This moved not with my previous 3 ATV. Just, works and worked seamlessly. Only started happening when I replaced the 3 ATV with ATV 4. View from my layman, is that there is an oddity in Apple's application of the standard "HDMI-CEC' to the new ATV 4. One reason more why I'm not particularly excited by the 4 on the 3 ATV ATV.

    Has anyone seen elsewhere this sort of thing, and you have a recommended fix?

    If I don't get any input here suggesting a solution for me, I also wrote this up as a problem that need correction, on the Apple site.

    I have a Samsung TV and ATV 4.  I found what TV is off and ATV is off, then I turn on ATV TV source and changes of starts for himself.  Your problems is maybe because you change the source yourself?

  • What should I do when the display shows "at the service of the user could not connect. Unable to load the user profile... ?

    I connect to my profile and I am not able to log in. The display shows "at the service of the user could not connect. User profile cannot be loaded... » » ?

    Hello

    These methods should help for Windows 7 or Vista.

    References to Vista also apply to Windows 7.

    You can try to fix it with Safe Mode - repeatedly press F8 as you bootup. The ADMIN account in trunk
    Mode has no default password (unless someone has changed the password so it should be available).

    Some programs such as the updated Google (if you added the toolbar Google, Chrome or Google Earth)
    has been known to cause this problem.

    Error message when you log on a Windows Vista-based or Windows 7 using computer a
    Temporary profile: "the user profile Service has no logon. Unable to load the user profile.
    http://support.Microsoft.com/kb/947215

    How to fix error "the user profile Service has no logon. User profile cannot be loaded. »
    http://www.Vistax64.com/tutorials/130095-user-profile-service-failed-logon-user-profile-cannot-loaded.html

    How to fix error "your user profile was not loaded correctly! You have been connected with a
    temporary profile. "in Vista
    http://www.Vistax64.com/tutorials/135858-user-profile-error-logged-temporary-profile.html

    BE VERY CAREFUL IF YOU USE THIS ONE:

    DO NOT USE THE ACCOUNT HIDDEN ON A DAILY BASIS! If it corrupts you are TOAST.

    -------------------------------------------------------------------------------------------------------------------------------------

    For Windows 7:

    How to enable or disable the built-in Windows 7 Administrator account
    http://www.SevenForums.com/tutorials/507-built-administrator-account-enable-disable.html

    Use the Admin account hidden to lower your user account APPLY / OK then wear again to
    ADMIN. This allows clear of corruption. Do the same for other accounts if necessary after the
    above message.

    You can use the hidden - administrator account to make another account as an ADMINISTRATOR with your same
    password (or two with the same password) use a test or difficulty to another.

    You can run the command Admin account hidden from the prompt here if
    necessary.

    How Boot for Windows 7 System Recovery Options or use a Windows 7 boot disk.
    http://www.SevenForums.com/tutorials/668-system-recovery-options.html

    What are the system recovery options in Windows 7?
    http://Windows.Microsoft.com/en-us/Windows7/what-are-the-system-recovery-options-in-Windows-7

    How to create a Windows 7 system repair disc
    http://www.SevenForums.com/tutorials/2083-system-repair-disc-create.html

    -------------------------------------------------------------------------------------------------------------------------------------

    For Vista:

    How to enable or disable the real built-in Administrator account in Vista
    http://www.Vistax64.com/tutorials/67567-administrator-account.html

    Use the Admin account hidden to lower your user account APPLY / OK then wear again to
    ADMIN. This allows clear of corruption. Do the same for other accounts if necessary after the
    above message.

    You can use the hidden - administrator account to make another account as an ADMINISTRATOR with your same
    password (or two with the same password) use a test or difficulty to another.

    You can run the command Admin account hidden from the prompt here if
    necessary.

    This tells you how to access the System Recovery Options and/or a Vista DVD
    http://windowshelp.Microsoft.com/Windows/en-us/help/326b756b-1601-435e-99D0-1585439470351033.mspx

    What are the system recovery options in Windows Vista?
    http://Windows.Microsoft.com/en-us/Windows-Vista/what-are-the-system-recovery-options-in-Windows-Vista

    How to create a Vista - free methods recovery disk
    http://www.Vistax64.com/tutorials/141820-create-recovery-disc.html

    -------------------------------------------------------------------------------------------------------------------------------------

    If you cannot access your old account, you can still use an Admin to migrate to another (don't forget
    always leave to an Admin who is not used except for testing and difficulty account).

    Difficulty of a corrupted user profile
    http://windowshelp.Microsoft.com/Windows/en-AU/help/769495bf-035C-4764-A538-c9b05c22001e1033.mspx

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • BlackBerry Z10 works: "your device is not connected to a network", but the staff is OK

    Good day to all,

    We have a BDS server work with IBM Traveler.

    We have 1 user who, since this morning, cannot receive email.

    After looking around on the traveler and the BDS, servers, we found no manifest error.

    On the phone, we can see that the Internet/personal workspace work perfectly.

    But the BES 'Account' is in the status "not connected" and when you walk inside to examine the configs, we get the red message "your device is not connected to a network. To connect to a network and try again.

    That is, of course, completely false as works of personal data and its other, personal accounts work correctly as well.

    10.1 device.

    We triied what follows (no license):

    -> Stop / start the data on the device.

    -> Stop the data + mobile network > both start

    ->, Restart the phone

    -> Go into airplane mode > back to normal.

    We triied to reproduce the issue with the other 2 phones: both work well. If only 1 phone has the question.

    The BES server shows that, since the beginning of the question, we get this:

    <#03>[30371] (05/23 11:35:39.365): {0xAD4} {John Smith} Packet cancelled locally, Tag = 1520726

    We consider the deletion/re-create the account of a last resort and to explore other alternatives to build our knowledge base... but we are few ideas here!

    Any suggestions?

    Thank you very much!

    Jonathan

    you have the BlackBerry logo next to your connection?

    If not then do a batterypull while the power is on and see if it comes back

    happened twice with me

  • iPhone 7 will not connect to iTunes - request for the new version, but everything is up-to-date

    My new phone will not connect to iTunes on my computer windows laptop. It is said that it requires a newer version of iTunes but the latest version is all ready to date

    Is your "new version" iTunes 12.5.1.21? If this is not the case, your 'windows' laptop running Windows XP or Vista?

  • When I print one of my Yahoo mail, the message text not dressed, then is cut, and the sidebar with the Inbox, sent, drafts, etc. is printed with the message.

    When I print an email from Yahoo, the text wraps not (it was) then part of the text is cut off. In addition, the sidebar my Inbox, sent, drafts, etc. the list is printed with enamel - it has not used to and because of that there is not enough room for all of my email. I tried to restore to shrink to fit, but which did not help. always also tried changing the print from 100 percent to 60 percent setting, but it does not fit on the page.

    This has happened

    Each time Firefox opened

    Is today

    Webmail of Yahoo is not a ' print' button to give you a page 'printer ready', which does not have the left menu bar?

  • MacBook air will not connect to wifi at all the

    so my air was bought last year (June 3, 2015, to be exact) and the other to have me recheck everythings password a few times was fine, but today the wireless connection just stopped working and I have no idea why? I called my service provider and they have implemented a new wifi which worked for about 3 seconds before he told me that I could not connect again. my password is correct, but its mainly telling me connection timeout when I try to connect. its gives me the message "network could not be connected to.

    When I run Network Diagnostics told me that my information is incorrect, that is not true... its becoming very stressful for me given that 90% of my school work relies on my computer with internet.

    Ive tried everything say other issues, Ive tried to go into the advanced settings, ive tried removing all my other saved networks, ive tried to restart, ive tried to restart my router and nothing works. I need this problem really soon otherwise im going to be screwed come the time to write my English book.

    So MUCH for some reason any it plugged into his own again?

  • Windows XP: Network in the system tray icon shows not connected, but I can access the internet

    When I start my network icon in the tray system shows I'm not connected, or it shows that its acquiring network address and it stays like that, but when I opened my browser, I can browse the web, which means that I have a connection.
    I guess its some error or something, can someone please tell me how to solve this problem?

    IM using Windows XP

    Hello

    • How long have you been faced with this problem?
    • What were the changes made before the problem occurred?

    You can view these methods:

    Method 1:

    I suggest you to refer to the early stages of this link:

    http://support.Microsoft.com/kb/956196#gM1

    Method 2:

    Windows wireless and wired network connection problems
  • does not install the USB MTP device driver. I can not connect external devices such as the Samsung Galaxy. I tried several uninstall and re - install, no solution

    I tried in the manner suggested in many forums, nothing worked. in fact when I forst connected you Galaxy it worked for a few days, then it stopped. My company ha installed on my PC System Center 2012 Endpoint Protection; However, it is there even when I was able to connect.  I have also the ipad tird and I get the same error.

    the solution to my previous request on the same subject by Rob Thomas596 strictly relates to Apple products and I can't use it for the Galaxy

    Run as administrator command prompt and run the following command:

    NET local service localgroup administrators / add

    This is what fixed my problem after searching everywhere

  • After moving, it does not connect OfficeJet (Wes: impression of the printer)

    I have a j6450 HPOfficejet All in One Printer.

    We bought a new laptop - HP Pavilion g6.
    I have been using the printer and works great.
    I changed where my printer sat, all reconnected.
    A test page was performed, but the printer shows that it is not connected to a computer.
    ??? Don't know what to do, I rechecked everything, but nothing works.  I'm 100% sure it is connected exactly as before
    I just unplugged and reconnected it when I moved it.
    Any suggestions?   Thank you,
    Marie Mathis

    If the printer is connected via a USB cable, it is possible that you might not have re-connected cable back to the same UPS port on the laptop.

    You may need to uninstall and reinstall the printer drivers.  Be sure to unplug the USB cable before uninstalling the printer driver.  Only re - connect the USB cable when the driver to "Reinstall" the application process.

Maybe you are looking for