Java remote connection to Sybase Database

Source: Internet
Author: User
Tags sybase database

Use Java to connect to the remote Sybase Database. The test statement is
Class. forName ("com. sybase. jdbc3.jdbc. SybDriver"). newInstance ();
String url = "jdbc: sybase: Tds: IP Address: Connection port number/database"; // database indicates the name of the database to be connected.
Connection conn = DriverManager. getConnection (url, user, password );

The connection is successfully tested;

Due to the differences between the data character sets of local machines and remote machines, Chinese Character garbled characters may occur when writing data to remote databases. According to the previous experience of Informix, Chinese character encoding of Chinese fields is converted in the program, I found that the problem was not solved, but it was indeed caused by the character encoding problem. After consulting with my former colleagues, I finally solved the problem, and it was relatively simple. ^_^
Change the second line of the above Code:
String url = "jdbc: sybase: Tds: IP Address: Connection port number/database? CHARSET = cp936 "; // The name of the database to be connected.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.