LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   MS SQL 2000 access using C++ in linux (https://www.linuxquestions.org/questions/linux-software-2/ms-sql-2000-access-using-c-in-linux-286509/)

gourav 07-17-2006 10:22 AM

Hi nidhi,

Try using ODBC only configuration i.e changing "Servername" to "Server" and "mssql" to "192.168.1.54" in your [mssql] dsn( ODBC-freeTDS configuration )as shown below and try running your program.


---odbc.ini ---
[mssql]
Description = TDSDriver
Driver = TDSDriver
Server = 192.168.1.54
Database = DigitalkDB
UID = sa
PWD = nidhi
Port = 1433


Gourav

gourav 07-17-2006 10:28 AM

hi nidhi,

use OTL_ODBC_UNIX as you are using unixODBC and then compile your code.

Gourav

gourav 07-17-2006 10:36 AM

hi nidhi,

In my previous mesg I forgot to mention.
Use both OTL_ODBC and OTL_ODBC_UNIX

#include <stdio.h>
#define OTL_ODBC // Compile OTL 4.0/ODBC
#define OTL_ODBC_UNIX
#include <otlv4.h> // include the OTL 4.0 header file

.................
..............



Gourav

nidhi 07-18-2006 02:53 AM

thanks for the help Gaurav, i tried every seting which u have mentioned but still its giving me the same error.

should i reinstall unixODBC package.


Nidhi

gourav 07-18-2006 12:16 PM

hi nidhi,

did u try tsql?
try if its connnecting using tsql.
After that try re-installing freeTDS and configure it for unixODBC.
Check the flags..

http://www.unixodbc.org/doc/FreeTDS.html

# ./configure --with-tdsver=7.0 --with-unixodbc=/usr/local <- give necessary path
# make
# make install


Cheers
Gourav

nidhi 07-18-2006 02:49 PM

Hi Gaurav,
how are you doing?

thanks, I tried tsql and it was connected to database.

I installed freetds support with unixodbc, but will reinstall it tomorrow.

Hey your yahoo id is not working everytime messenger gives error.

Regards,
Nidhi

gourav 07-18-2006 09:48 PM

hi nidhi,

i am doing good.
How are you?

my yahoo id is "gdtilve"


Gourav

nidhi 07-19-2006 06:26 AM

Hi gaurav,

I reconfigured freetds but no effect on program.

even dsn has stoped working with isql :(

Is there is another way i can connect mssql through C++

Nidhi

gourav 07-19-2006 12:07 PM

hi nidhi,

dont worry.
Just give the correct path for TDS driver in odbc config.
Coz you have reinstalled (may be with a diff path) check the odbc.ini and odbcinst.ini and
make sure if the path for tds driver is correct.

Also, i think why ur C++ program is not running is, your are using libodbc.so.
Use libtdsodbc.so during linking.

g++ -I<necessary path> sample.cpp -o sample -L<tds_lib path> -ltdsodbc


try the above and let me know.

Cheers

Gourav

nidhi 07-19-2006 02:18 PM

Hi Gaurav,

thanks, i solved the issue of isql today.

today i installed unixODBC-2.2.11 on the server, after compiling the C++ program the poutput was like

[unixODBC]: uid=sa;pwd=nidhi;dsn=mssql

I dont understand why its giving the connection string in the output.

i will execute the program according to your mentioned way.lets see.

Regards,
Nidhi

gourav 07-20-2006 05:57 PM

hey,

i got your problem.

Plz tell me,How you have installed freeTDS and unixODBC?
Can you please let me know your installed paths i.e what path
you have configured during the installation process of both?
EX: /usr/local which is the default path

Cheers
Gourav

nidhi 07-21-2006 02:43 AM

Hi Gaurav,

I installed uniODBC through a package and when i fire odbcinst -j commnad

unixODBC 2.2.11
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
USER DATA SOURCES..: /root/.odbc.ini


Path for freetds i didnt specified any prefix at the time of installing it, its installed at its default path i.e /usr/local/freetds/



Thanks,
Nidhi

nidhi 07-21-2006 01:46 PM

Good Morning Gaurav,
How are you doing?
I added you on my messenger, if possible for you can we chat on messenger tomorrow anytime.i think through chat we will be able to solve the issue in faster.

Thanks,
Nidhi

gourav 07-21-2006 02:40 PM

hi nidhi,

I am doing good. How about you?

okay copy paste your previous(old config) odbc.ini and odbcinst.ini to /usr/local/etc/.
hey I installed freeTDS without any prefix and the default installation path was /usr/local/.
A freeTDS directory is not created in /usr/local/. Please tell me where are you untarring freeTDS.
Are you untarring in /usr/local/freeTDS and then installing from within that directory?
Coz default freeTDS conf file was in /usr/local/etc/freetds.conf in my case.

Please check it and let me know.

hey nidhi theres almost 12:00 hours difference in india's timing and the timing in the place
where i am in. (USA).
So i think , now when i am writing this mesg it will be around 1:00 am (Saturday) there in India, as its 1:00 pm here (Friday).

We can chat maybe on Monday at 10:00 am indian time (10:30 pm Sunday here). In that way you will most probably be in office and be able try the different configurations.

Let me know.

regards
Gourav

nidhi 07-22-2006 12:18 AM

Hi Gaurav,

how are you?

I am doing good, thanks.

Yes that is fine with me, we can chat on Monday morning (my time).

Freetds is installed in /usr/local/freetds directory on my server.

I have 3 freetds.conf files in different directories
/etc/freetds.conf
/usr/local/etc/freetds.conf
/usr/local/freetds/etc/freetds.conf

Regards,
Nidhi


All times are GMT -5. The time now is 08:38 AM.