Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft JDBC Driver problem

Status
Not open for further replies.

fuadhamidov

Programmer
Sep 22, 2003
98
TR
hi
i have used odbc:jdbc to connect to MS SQL , but i get some regional character problem . so now i try microsoft JDBC Driver. at background there is a connection pool that create a number of connection.
i call this connection pool by following statament:

private static ConnectionPool con = new ConnectionPool
("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:eek:dbc:datasourcename;Connect Timeout=100",
userName, pass, anyInt1, anyInt2, anyBoolean );

now i replace some (bold) part for MS JDBC Driver:

private static ConnectionPool con = new ConnectionPool("com.microsoft.jdbc.sqlserver.SQLServerDriver", "jdbc:microsoft:sqlserver://localhost:80",
userName, pass, anyInt1, anyInt2, anyBoolean );


where is the error i dont know.is there any who can help me
 
this is only correct:
("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:eek:dbc:datasourcename;Connect Timeout=100",
userName, pass, anyInt1, anyInt2, anyBoolean );

have u set up the DSN???


Known is handfull, Unknown is worldfull
 
ok
i know

("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:eek:dbc:datasourcename;Connect Timeout=100",
userName, pass, anyInt1, anyInt2, anyBoolean );

is correct

but i need to use ms jdbc driver, which pass odbc and directly connect to ms sql, because obdc:jdbc gives regional character problem.

my problem:
when Apache Tomcat automatically runs from services turkish chars those i retrieve from db are printed on browser as question mark.
but if i restart Apache Tomcat from services or manually start Apache Tomcat all chars is printed as they are.
 
This is connection code. You can preference:

Connection connection = null;
try {
String driverName = "com.jnetdirect.jsql.JSQLDriver"; // NetDirect JDBC driver
String serverName = "127.0.0.1";
String portNumber = "1433";
String mydatabase = serverName + ":" + portNumber;
String url = "jdbc:JSQLConnect://" + mydatabase; // a JDBC url
String username = "username";
String password = "password";

// Load the JDBC driver
Class.forName(driverName);

// Create a connection to the database
connection = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
// Could not find the database driver
} catch (SQLException e) {
// Could not connect to the database
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top