• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing Sybase using JDBC from an Applet

 
preeth prabakar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I created a code for an applet that accesses Sybase database usind DSN. But when I post it in a web server I could not access any thing due to the JDBC connectivity.
I believe DSN is for only stand alone systems and not for applets running in a web server. I found out that I can user JConnect to access the syabase database. I went to sybase website but could not find a real good explanation. Please can anybody tell me how to access sybase database using Jacconet.
Could you please tell me is there any other alternative to access database using the applet running in a webpage. It should help anybody accessing the webpage to access the database..
Thanks
Preeth
 
preeth prabakar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JConnect works fine for the applet. We need to install Jconnect and set path.
import the following file:
import com.sybase.jdbcx.*
establsih connection using the following code:
Driver specification:
Class c=Class.forName("com.sybase.jdbc.SybDriver");
sybDriver=(SybDriver)c.newInstance();
DriverManager.registerDriver((Driver)sybDriver);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
establish connecction using:
Connection con=DriverManager.getConnection("jdbc:sybase:Tds :phoenix:5795","id","pwd");
This will help you to connect to sybase database from JAVA wihtout using DSN
[This message has been edited by Thomas Paul (edited November 21, 2000).]
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, you only need:
Class.forName("com.sybase.jdbc.SybDriver");
Connection con=DriverManager.getConnection("jdbc:sybase:Tds:Phoenix:5795","id","pwd");
The problem may be that the browser is not going to let you create a connection to a database that is on a different server than the one where the applet was loaded from. If that is the case, then you will need to look at other possibilities such as Applet-Servlet communication.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic