Jump to content

Access a database from a remote computer(server)


Recommended Posts

Can somebody tell me how to access data from a database sitting on a different computer? I am using Sqlite database. It works fine in my computer. But i dont know how to put the database in a different computer (server) and access the data from there. In my program it is essential to make this for simultaneous use for different users.

Link to comment

Have a read of the SQLite documentation:

http://www.sqlite.org/docs.html

SQLite is NOT by architecture a client/server style database, but this can be achieved by placing the database on a network share (I.e. SMB, but note the documentation specifically advises not to use NFS due to bugs in some NFS implementations) See:

http://www.sqlite.org/faq.html#q5

You should consider using Postgres or Mysql (both open source) instead, as these are designed as client/server style databases.

http://www.sqlite.org/whentouse.html See the section titled "Situations Where Another RDBMS May Work Better"

http://www.postgresql.org/

http://www.mysql.com/

Edited by Maca
Link to comment

Thanks a lot for the comments.

Any idea about how to connect with a database sitting in a different computer? Now i am connecting by creating a datasource, as the database is in my PC. Now, when i put the database in another PC, how can I connect with the database? How should i link? Is there any way that i can specify server's IP address and database's location in the UDL file?

Link to comment

Thanks a lot for the comments.

Any idea about how to connect with a database sitting in a different computer? Now i am connecting by creating a datasource, as the database is in my PC. Now, when i put the database in another PC, how can I connect with the database? How should i link? Is there any way that i can specify server's IP address and database's location in the UDL file?

Skip the UDL file altogether and wire a  connection string directly into the Open Connection function.

  • Like 1
Link to comment

Thanks a lot for the reply

Till now i was using SQLite database. But I dont think I can connect to a remote SQLite database using the connection string. I am planning to shift to SQL Server 2005. Can somebody help me to configure the SQL server 2005 for a client server model?

Link to comment

Thanks Jcarmody, thats an awesome link.

Suvin the connection string will be something like:

Data Source=filename;Version=3;

Where filename will be something like "\\server\share\directory\databasefile" or "x:\directory\databasefile" (assuming you have mapped \\server\share to X:)

You just need to setup a share on the "server" that serves up c:\something\directory\databasefile (which will be the SQlite database file you are using).

It can be done quite easily (especially in comparison to setting up MS SQLserver) but its just not the nicest way to do it.

Link to comment

Hi all,

Thanks alot for these wondeful inputs..With all your help, i solved my problem. I connected MySQL server using the connection string. Once again thank you so much for the help.

Suvin

Is anyone able to post up the syntax they used.

I have not used connection string before and just had a quick go of connecting to MySQL database with no luck.

I tried:

Server=localhost; Database=gregs_list; Uid=root; Pwd=;

I want to check the syntax.

Password is blank and port is default 3306.

Cheers

Link to comment

Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;

this one is for Local machine. Create a database in My SQl server first and give the name instead of "myDatabase".

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;

this one is for remote connection.

By default, the MySQL server will not be shared for remote computers. You have to change the privilleges http://bui4ever.com/...windows-server/

Hope this will help

cheers

  • Like 1
Link to comment

Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;

this one is for Local machine. Create a database in My SQl server first and give the name instead of "myDatabase".

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;

this one is for remote connection.

By default, the MySQL server will not be shared for remote computers. You have to change the privilleges http://bui4ever.com/...windows-server/

Hope this will help

cheers

Thanks

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.