C++ [ODBC]-MSSQLExpress 2008 SQLSTATE: 28000 || 42000 - c++

I'm facing some issues trying devloping a program that has to get informations from database and tables created under MSSQL 2008 management.
I have to admit that I'm new to ODBC...
If anyone could help me with this issues? I tried two solutions to connect to my database [CodeA] and [CodeB]. I found documentation on google and tried a couple of solutions but until now can't find the right one.
Please have a look at my connection string below.
CodeA:
SQLDriverConnect (sqlconnectionhandle,NULL,
(SQLCHAR*)TEXT("DRIVER={SQL Server};SERVER=TOWER-PC\\SQLEXPRESS;DATABASE=tfe;UID=adminA;PWD=#Admin1;IntegratedSecurity=SSPI;"),
SQL_NTS,retconstring,1024,NULL,SQL_DRIVER_NOPROMPT)
CodeB:
SQLDriverConnect (sqlconnectionhandle,NULL,
(SQLCHAR*)TEXT("DRIVER={SQL Server};SERVER=TOWER-PC\\SQLEXPRESS;DATABASE=tfe.mdf;UID=adminA;PWD=#Admin1;Trusted_Connection=Yes;"),
SQL_NTS,retconstring,1024,NULL,SQL_DRIVER_NOPROMPT)
CodeC:
SQLDriverConnect (sqlconnectionhandle,NULL,
(SQLCHAR*)TEXT("DRIVER={SQL Server};SERVER=TOWER-PC\\SQLEXPRESS;DATABASE=tfe.mdf;Trusted_Connection=Yes;"),
SQL_NTS,retconstring,1024,NULL,SQL_DRIVER_NOPROMPT)
The SQLSTATE that is returned from the execution.
While this are the roles attributed to my user:

Solution
I solved this problem by modifying the connection string to:
"DRIVER={SQL Server};SERVER=TOWER-PC;DATABASE=tfe;UID=adminA;PWD=#Admin1;"
Helpful link

Related

ora-1017 invalid username/password; logon denied using occi connection

I'm getting an ora-1017 error when trying to connect to my local oracle database(version 11.2.0.3) on an oracle linux version 5 virtual machine using occi.
Connection code piece:
user = "MY_USERNAME";
passwd = "MY_PASSWORD";
db = "localhost:1521/my_instance_name";
env = Environment::createEnvironment(Environment::DEFAULT);
try
{
con = env->createConnection(user, passwd, db);
}
catch (SQLException& ex)
{
cout << ex.getMessage();
exit(EXIT_FAILURE);
}
- I can connect to the schema using sqlplus.
- I tried setting SEC_CASE_SENSITIVE_LOGON to false, didn't help.
- The schema was created using uppercase username and password, I'm giving my variables uppercase values too, and as far as I know OCCI casts the credentials to uppercase anyway so it should work.
- ORACLE_SID environment variable is properly set, as well as the tnsnames.ora data too.
- By the way, this code was tested first on my host pc(win10) using visual studio 2010, and it was working properly, but not on my linux virtual machine(using virtualbox). I tried it using the host stated in tnsnames.ora and localhost both, still getting the same issue, but sqlplus lets me connect using both localhost and the tnsnames host.
I tried everything I could find on google, but still nothing, so if anyone has any useful tips it would be highly appreciated.
Turned out I needed to add the -D_GLIBCXX_USE_CXX11_ABI=0 flag to the compile command, it works now.

Google Native Client Visual Studio Add-in: Webserver fails to start because arguments to httpd.py are invalid

I have an application that I turned into a simple Native Client App a year ago, and I've been trying to get it running again. However, when I try to run it, or any of the example VS projects, the web server fails to start, giving me usage hints for httpd.py, and saying "httpd.py: error: unrecognized arguments: 5103".
I wasn't able to find anything about this on the NaCL guide or on the net. I could probably troubleshoot the issue if I could see the script that starts the webserver, but I have no idea where this is stored.
The script that start the server is 'nacl_sdk\pepper_43\tools\httpd.py'. The problem is with the port argument being formated incorrectly.
The expected format is:
httpd.py [-h] [-C SERVE_DIR] [-p PORT] [--no-dir-check]
But, the received arguments formatted by the add-in is:
['--no_dir_check', '5103']
where the port prefix is missing and should be '-p 5103'
For a quick fix, add the following line
parser.add_argument('args', nargs=argparse.REMAINDER)
before the parse_args(args) in the main(args) method in httpd.py.
This will keep the unknown arguments from being parsed and will use the default value for port instead (5103).

ora-24399- Invalid number of connections specified -OCCI program

I am using following simple code to connect to database and I am getting error as ORA-24399 which says invalid number of connections specified. I have googled enough but not clue. This is a CPP program.
Following is code Snippet:
try
{
Environment *env = Environment::createEnvironment(Environment::DEFAULT);
Connection *con= env->createConnection("test","test","testdb");
}
catch(SQLException ex)
{
cout<<ex.getMessage().c_str();
}
P.S Using SQL Plus I am able to connect to the database where this code is being run. There are no issues there. Only through program there is a failure seen.
P.P.S Tried using connectionpool as well but still no luck...
Looking at your error, it seems that the problem is somewhere else in your code: you should fix the parameters (related to connection numbers) in the call to OCIConnectionPoolCreate.

C++ Sqlite3 code seems to have issues prepping a statement

I was trying to just query some input to make sure things were inserted correctly.
I was doing the following:
//open database into 'db'
sqlite3_stmt *statement;
string query = "select * from A;";
if(sqlite3_prepare_v2(db, query.c_str(), -1, &statement, 0)==SQLITE_OK){
//...
}else{
cout << "Error prepping statement" << endl;
}
I was following a demo from dreamincode: http://www.dreamincode.net/forums/topic/122300-sqlite-in-c/ I just have no idea what i was doing wrong. Am i using the wrong prepare method, or defining something wrong?
Edit: The Returned Error Code is 1: SQL error or missing database. Am i doing the SQL statement wrong? I triple checked to make sure the DB was indeed open
Edit: RESOLVED I downloaded the database, opened it with a sqlite3 reader... and noticed something i SHOULDve been told about. The schema changed without me knowing without documentation being sent to the entire dev team. I am sending a very nice email to my coworker about that
Schema was changed without documentation or telling anyone on the dev team. I had to dl the db and open it with an sqlite3 reader.
Im going to have words with him about this.

IGraphBuilder::RenderFile() failing with VFW_E_BAD_KEY - 0x800403f2

Continuing investigation on a embedded WindowsMediaPlayer problem, i am trying to do simple file playback via a DirectShow in-process server:
::CoInitializeEx(0, COINIT_MULTITHREADED);
CComPtr<IGraphBuilder> spGraph;
spGraph.CoCreateInstance(CLSID_FilterGraph, 0, CLSCTX_INPROC_SERVER);
CComQIPtr<IMediaControl> spMediaControl(spGraph);
// ... later:
spGraph->RenderFile(L"c:\\foo.wav", 0); // fails with VFW_E_BAD_KEY
spMediaControl->Run();
Interestingly, this runs fine on both systems i tested on (Windows XP 32 & x64) when doing it in a stand-alone application.
It however fails in my real use-case, a NPAPI based browser plugin - i.e. a DLL loaded into Firefox/Chrome/Opera.
Does anyone have an idea what could be going wrong here?
Or ideas on what else to try?
Update: also asked on the Microsoft forums.
Update2:
IGraphBuilder::AddSourceFilter(path,path,&base) already fails with the following registry calls (as seen in process monitor):
"RegOpenKey","HKCU\Software\Classes\c","NAME NOT FOUND","Desired Access: Query Value, Maximum Allowed"
"RegOpenKey","HKCU\Software\Classes\Media Type\Extensions\.wav","NAME NOT FOUND","Desired Access: Read"
"RegOpenKey","HKCU\Software\Classes\Media Type","NAME NOT FOUND","Desired Access: Read"
It is reading the key from the wrong hive. It should use HKLM, not HKCU. The most likely reason for this is registry virtualization.