Suvin Posted April 12, 2010 Report Share Posted April 12, 2010 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. Quote Link to comment
Maca Posted April 12, 2010 Report Share Posted April 12, 2010 (edited) 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 April 12, 2010 by Maca Quote Link to comment
Suvin Posted April 12, 2010 Author Report Share Posted April 12, 2010 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? Quote Link to comment
jcarmody Posted April 12, 2010 Report Share Posted April 12, 2010 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. 1 Quote Link to comment
Suvin Posted April 13, 2010 Author Report Share Posted April 13, 2010 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? Quote Link to comment
Maca Posted April 13, 2010 Report Share Posted April 13, 2010 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. Quote Link to comment
Suvin Posted April 13, 2010 Author Report Share Posted April 13, 2010 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 Quote Link to comment
jgcode Posted April 13, 2010 Report Share Posted April 13, 2010 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 Quote Link to comment
Suvin Posted April 14, 2010 Author Report Share Posted April 14, 2010 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 1 Quote Link to comment
jgcode Posted April 14, 2010 Report Share Posted April 14, 2010 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.