March 29, 2024, 03:00:42 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


How to connect to a DataBase Server

Started by efgee, March 30, 2006, 06:34:03 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

efgee

I've installed the new demo and tried to change the database example.

The database example connects to a local file, but how do I connect to a  DataBase Server?

I have the database name, user name, and password.

I can connect with other prg-languages, but until now no luck with Aurora.
Need more infos.

Thanks

Parker

You'll need to look up the ODBC connection string, which will probably be something like
USER=username;PASSWORD=password;SERVER=db.something.com;PORT=3376
well... I have no experience with ODBC though, so that's just my guess.

John Syl.

If I state the obvious, sorry, but I don't want to assume anything.

I can only speak from the point of[ b] mySQL[/b].

In this instance, using the  Cdatabase class:

Cdatabase db;


and the command you are looking for is:


pdb=db.Connect"MySQL ODBC 3.51 Driver","","database=<dbname>;server=<server>;port=3306;uid=<username>;pwd=<password>");

pdb will be a non-zero value if it connects else it wil be zero.

"MySQL ODBC 3.51 Driver" is the connector driver required and will need to be installed.

If you are using mySQL server remotely then you will need to allow remote access to the database.

If you are accessing the mySQL server on the same machine then the server is 'localhost'.

Once the connection has been made it pretty much straight forward from then on.

Hope this helps
regards
John


Intel 3.6 p4 ht, XP home,2 gb mem, 400 gb hd 20gb raid 0, Nvidia 6600le.
AMD k6-2 500, 40gb.

Started on PDP11 Assembler, BASIC, GWBASIC, 6502, Z80, 80x86, Java, Pascal, C, C++, 
IBasic (std & pro), Aurora, EBasic.  (Master of none, but it's been fun!)

tekrat

You would need the mySQL ODBC driver installed on your machine and use the connection strings to connect with the mySQL server.  Otherwise you'll have to get a DLL from mySQL and import the DLL functions into your project.

The second option gives you a ton of control and there by speed.  But it also kills you on programming/project overhead.  If you just need to retain your current hairline and would like a speeder coding, ODBC is your best bet.