connecting mssql server at webserver from client

hi has someone ever connected MS sql server installed at webserver from client application using JdbcOdbcDriverplease tell me if it is possible or not.
[180 byte] By [parul_patidar] at [2007-9-26 2:05:43]
# 1

Try this code. For this you need to create one ODBC datasource using the utility ' Data Source (ODBC' under control panel in Windows OS. (if you are using Unix OS check the docs, how to create ODBC datasource)

In your java code add these line

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection dbConnection = DriverManager.getConnection("jdbc:odbc:YourDataSourceName", "DataBaseUserID", "Password");

Statement dbStatement = dbConnection.createStatement ();

tomym at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

locally this will work i have done it many times. i also did on local area network. but r u sure JdbcOdbcDriver works on Internet that is can i connect to database at web server from client. I have never tried this and i dont have a server database at my web server so i cant check whether it works on Internet or not. please tell me if u have done it

please reply

regards parul

parul_patidar at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

Q>>>>>but r u sure JdbcOdbcDriver works on Internet that is can i connect to database at web server from client

A) JdbcOdbcDriver will work in any Webservers supporting Java.

Q>>>>>I have never tried this and i dont have a server database at my web server

I don't understand what you mean by server databse in web server ?

Tomy

tomym at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
sir server database means database like sql server which listen on some portms access is a desktop product it is not a server databaseparul patidar
parul_patidar at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
tomy if i have ms access at one machine and my java prog on other machine and both machine are connected then i can't retrieve data from database without a middle tire like servlet or jspbut i can do this when i have sql server instead of ms access
parul_patidar at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 6

And what kind of client are you running?

An application client could be done by setting up a ODBC DSN on each client machine. Java doesn't do this, you have to find some other method to do it.

A browser client has security issues, although as long as the database is on the web server the problems are less.

A browser client will not normally use ODBC, since it requires a seperate installation (note DSN-less connections STILL require an install, to get the ODBC MS SQL driver.) Since the normal MS SQL driver is ODBC you need to find another solution:

-Use the freetds driver, from www.freetds.org

-Use a proxy driver, either a commercial one (search the sun site for drivers) or the one from http://www.objectweb.org/ called RmiJdbc

jschell at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 7

dear jschell

i can make an installer in vb which will create a dsn while installing my java application

please tell me whether i need a system dsn or a user dsn

some people say i will need to create a system dsn when i am connecting a database over internet

regards

parul

parul_patidar at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 8
Unless you have a strong reason for using a user dsn I would go with system.Presumably there is some way to get a user dsn to work, but the few times I tried it never did.
jschell at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 9
thank you very much everyone for helping
parul_patidar at 2007-6-29 8:51:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...