Database

Linux specific forum
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Database

Post by Nik »

Hey guys,
I have got a linux vserver and I am developing an Instant Messenger thats fine but because the new server uses Linux I will have to port it. Thx to Fred that will be possible but. I have to use a databse and now i want to know how to use a mysql databse which is running on localhost from within a Pb app an example would be great.
bye Nik
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I think you need to install the unixodbc package, then create a new dsn (ther is probably a GUI tool provided for this) and you should be able to use the PB database commands with it.
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Thanks Fred i apreciate your answer but there is a Problem as i said its a Server so i only have ssh access. I can upload files but i think it will be a bit hard to install the odbc dirver like this. I did achieve to create the database using confixx(its MySQL on localhost). Isn´t there a simpler method than installing the odbc driver interface I think a server should be able to work with databases.
Something like a libary working under linux allowing access to mySQL without ODBC
bye Nik
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Ok I installed the ODBC Database Interface on my Server first it couldn´t find the libodbc1.so fie because it was in anotherone of Linuxes lib directories i put it in the main one an ok Pb cann init the database but now i have to add it to ODBC which is really hard without using a gui can anyone help plleaase.
bye Nik
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Ok i think i got a bit further there is the following output of my test program.

Code: Select all

The fllowing database drivers have been found
NAME
MySQL-test
Description
MySQL
NAME
KoMaNi
Description
MySQL
Trying to open Database
Error: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
Does anyone know what that means and how to fix it
Please help me :(
Biggles
New User
New User
Posts: 5
Joined: Fri Jun 17, 2005 9:56 am

MySQL

Post by Biggles »

I didn't get the ODBC version working. But using libmysqlclient.so.12 directly works for me. It's a piece of code I found on this forum and changed it a little to get it working on Linux. If it's usefull for you I can drop it here
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Digging through my old posts I came by this: viewtopic.php?p=69143

Has something to do with ODBC & mysql anyway..

EDIT: Ehm.. and then I read that you wanted something else than ODBC..
Then the only way to go is the mysqlclient lib..

oh well..
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Nik: can we see your test program ? It sounds good and the odbc libs seems to be correctly loaded. The next step is to create a dsn and then you could uses it name to connect to the DB.
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Yeha if you want i can i can post the code (I surely will but at the Moment I am at my Windows ) Its working now there are still Problems but it works. The last Probelm before it started to work was to figure out how to configure ODBC just with ssh. It´s not that easy to desinguish between configuration libs and the actuak driver. so if someone has the sameproblem i am surely able to help.
At the Moment my Problem ist that it crashes with a glibc error when It ry to write for example chr(248) into a MySQL Database with the field configured as ASCII-general_ci don´t know which would be the right configuration. In my Server there is also a problem with the Network Code working probably under windows because it could be an older version which i ported i will do this again today.
bye Nik
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Ok seems to be a bigger Problem than i thought I ported the working code again from the windows Version of my Server. Here all works pefectly i even handle splitted (over to buffers) network messages. Up to 9000 bytes of length without any Problem. But on Linux a message of approximitly 50 bytes causes

Code: Select all

*** glibc detected *** free(): invalid next size (fast): 0x08079638 ***
Aborted
Thats really suspicous it happens not only with network but also with database.
I searched a little bit more and the funny thing with the databse is that it writes the value into the database and crashs just after having them written. I couldn´t debug on the server so I will try to establish an ODBC Connection on my Laptop. Because the code is working on Windows I thnik it could be a Bug in PB but I will try to find out more about it before cring "BUG!"
bye Nik


[Edit corrected my English (wirtten very fast the first time) and added mor detail]
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Ok got problems getting ODBC running on my Ubuntu Laptop (hardly imagenable that it could be hard when you did it 48 hours before without touching the gui). It seems to be a Problem of the program odbcinst.
But lets get to the point: Does anyone know which coallsions I have to use in the MySQl database. It crashes with Ascii bin and Ascii general ci. (It does write a correct string with both, but crashes emdiatley afterwards). The Server doesn´t crash on user connect. Even though that uses Network Commands and Linked list and so on. So I am not sure weather the crashs with network stuff mentioned before (same function) are also inked to the MySQL Problem. Please can anyone help???
bye Nik

Edit: Ok i compiled a small "miniServer" just with the network commands and wich doesn´t touch the database. It works without any Problems and Messages of mor then 8000 bytes.
Post Reply