selecting database on aql anywhere using php

57 views
Skip to first unread message

Coco

unread,
Sep 1, 2010, 1:08:39 AM9/1/10
to SQL Anywhere Web Development
hy all...

i'm rico, from indonesia... and i'm just starting to use sql
anywhere..

i have a question about database selection..

in mysql, on my mysql data folder there are a lot of databases that
can i create..
but i found somthing different on sql anywhere..

i'm using php to make my application.. and i did not found code or
syntax to select database from aql anywhere..

as you know in php (with mysql database) i use mysql_select_db to
select database that i want..

but in sql anywhere i really did not found that similarly syntax...

anyone can help me... ?? thx before..

Eric Farrar

unread,
Sep 1, 2010, 10:00:22 AM9/1/10
to SQL Anywhere Web Development
Hello Rico,

The reason you have not found a similar function is because SQL
Anwyhere does not need one.

MySQL runs multiple databases inside of a single database server. When
you connect to MySQL, you are connecting to the MySQL server. After
you connect to the MySQL server, you can choose which database you
would like to set to the "active database". This is what the
mysql_select_db() function does.

SQL Anywhere is a bit different. Like MySQL, you can run multiple
databases inside of a single server. However when you connect to SQL
Anywhere, you connect directly to a database instance, not to the
server. A sample connection string (like the one used in
sasql_connect() ) might look something like this:

"Server=demosrv;DBN=demodb;UID=DBA;PWD=sql"

That connection string says that you want to connect to a database
named "demodb" on server named "demosrv". SQL Anywhere lets you
specify this at connection time, so there is no need to have a
function like mysql_select_db() to select it later.

Hope this helps,

- Eric
Reply all
Reply to author
Forward
0 new messages