I want to create a connection to a database from a Java service rather than an adapter service and i am doing this for my practice purpose (creating a “how to connect to databse using Java service” document). Any pointers or references to a java code is appreciated.
I am connecting to MSSQL server 2005 from IS 7.1.2. The inputs that i will be providing are database URL, Driver class and username/password.
This is not regarding using an existing connection, it has to create a new connection in the code.
What you got to do it simply embed the java connectivity code in a java service.
Here is the sample code:
Connection conn = DriverManager.getConnection( "jdbc:microsoft:sqlserver://server:port;User='';Password=");
catch (Exception e)
just make sure you have the jars at the right place.
I would strongly encourage not doing this and instead use the facilities provided by the JDBC adapter. If you must access a DB while running a Java service, use the IS Java API to invoke a proper JDBC service.
I understand the concern and it was just a curious how to thing.
Thanks for the pointer.