Results 1 to 4 of 4
- 10-03-2011, 06:59 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 84
- Rep Power
- 0
Connecting to sqlserver from Java
I am using Java 1.6.0_27 ,SQL server 2005,Weblogic 10.3.5.
I am using weblogic.jdbc.sqlserver.SQLServerDriver as the driver class
and jdbc:bea:sqlserver://hostname:1433 jdbcProperties
where jdbcProperties={db=Test, user=test, password=test, ProgramName
=WebLogic JDBC Driver}
Properties jdbcProperties = new Properties();
jdbcProperties.put("user", user);
jdbcProperties.put("password", password);
jdbcProperties.put("db", DB);
jdbcProperties.put("ProgramName", "WebLogic JDBC Driver");
Driver jdbcDriver = (weblogic.jdbc.sqlserver.SQLServerDriver )Class.forName(DRIVER).newInstance();
Connection sqlCon = jdbcDriver.connect(PROTOCOL + "//" + server + ":1433", jdbcProperties);
sqlConn is returned as null.I am not able to connect to the database
Is there some issue with the driver?This code worked fine with Java 1.5_06 and Weblogic 9.1.
I just did an upgrade to Weblogic 10.3.5 and Java 1.6.0_27.
Please help
- 10-07-2011, 06:04 AM #2
Member
- Join Date
- Oct 2011
- Posts
- 2
- Rep Power
- 0
Re: Connecting to sqlserver from Java
Convert
toJava Code:Driver jdbcDriver = (weblogic.jdbc.sqlserver.SQLServerDriver )Class.forName(DRIVER).newInstance();
I'm not sure if that's causing your problems because if you don't have a String DRIVER variable it shouldn't compile to begin with.Java Code:Driver jdbcDriver = ("weblogic.jdbc.sqlserver.SQLServerDriver"); Class.forName(jdbcDriver).newInstance();
It might help if you copy past your code along with the stacktrace of your error
- 01-06-2012, 08:25 AM #3
Member
- Join Date
- Feb 2010
- Posts
- 80
- Rep Power
- 0
Re: Connecting to sqlserver from Java
Try printing the content of jdbcDriver and see what it contains tos see which variable and when in the program it becomes null.
If it were a connectivity problem, there should be an exception error. If you have an exception handler, try printing out any error caught.[why are you annoyed with my sig?]
- 01-06-2012, 09:36 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Similar Threads
-
Cannot connect to sqlserver 2008 with JDBC
By alexander.s in forum JDBCReplies: 4Last Post: 03-13-2011, 12:02 AM -
JDBC commands for connecting to sqlserver
By sudukrish in forum Advanced JavaReplies: 7Last Post: 04-22-2009, 09:48 AM -
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]System Exception: Connection
By Ram_TPS in forum JDBCReplies: 1Last Post: 10-16-2008, 02:09 PM -
Tomcat with SQLSERVER 2005
By bbq in forum JDBCReplies: 1Last Post: 07-05-2007, 04:40 AM -
SQLServer 2000 EXCEPTION
By Heather in forum JDBCReplies: 3Last Post: 06-29-2007, 03:10 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks