我试图连接到Postgresql数据库,我收到以下错误:
错误:org.postgresql.util.PSQLException:致命:抱歉,已经有太多客户了
错误是什么意思,我该如何解决?
我的server.properties文件如下:
serverPortData=9042
serverPortCommand=9078
trackConnectionURL=jdbc:postgresql://127.0.0.1:5432/vTrack?user=postgres password=postgres
dst=1
DatabaseName=vTrack
ServerName=127.0.0.1
User=postgres
Password=admin
MaxConnections=90
InitialConnections=80
PoolSize=100
MaxPoolSize=100
KeepAliveTime=100
TrackPoolSize=120
TrackMaxPoolSize=120
TrackKeepAliveTime=100
PortNumber=5432
Logging=1
Run Code Online (Sandbox Code Playgroud) 我需要在java中将分钟转换为小时和分钟.例如260应该是4:20.任何人都可以帮助我如何转换它.
以下Java代码用于将文件附加到电子邮件.我想通过电子邮件发送多个文件附件.任何建议,将不胜感激.
public class SendMail {
public SendMail() throws MessagingException {
String host = "smtp.gmail.com";
String Password = "mnmnn";
String from = "xyz@gmail.com";
String toAddress = "abc@gmail.com";
String filename = "C:/Users/hp/Desktop/Write.txt";
// Get system properties
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
props.put("mail.smtps.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
Session session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.setRecipients(Message.RecipientType.TO, toAddress);
message.setSubject("JavaMail Attachment");
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText("Here's the file");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart(); …Run Code Online (Sandbox Code Playgroud) 我想在java中将字符串Date转换为Timestamp.我写了以下编码.我已声明date1的日期是:7-11-11 12:13:14.
SimpleDateFormat datetimeFormatter1 = new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss");
Date lFromDate1 = datetimeFormatter1.parse(date1);
System.out.println("gpsdate :" + lFromDate1);
Timestamp fromTS1 = new Timestamp(lFromDate1.getTime());
Run Code Online (Sandbox Code Playgroud)
我想将7-11-11 12:13:14这个字符串日期转换为时间戳.现在我得到的输出是0007-11-11 00:13:14.000000 +05:30:00但我希望(7-11-11 12:13:14)这种格式的时间戳日期.谁能帮帮我吗.谢谢.
我怎么解决这个问题.我收到以下错误:
java.nio.channels.ClosedChannelException
这是编码:
public void run() {
try {
SocketChannel socketChannel = (SocketChannel) key.channel();
ByteBuffer buffer = ByteBuffer.allocate(512);
int i1 = socketChannel.read(buffer);
if (buffer.limit() == 0 || i1 == -1) {
Socket s = null;
try {
s = socketChannel.socket();
s.close();
key.cancel();
} catch (IOException ie) {
if (UnitDataServer.isLog) {
log.error("Error closing socket " + s + ": " + ie);
}
}
} else {
buffer.flip();
if (UnitDataServer.isLog) {
log.info(" Recvd Message from Unit : " + buffer.array());
} …Run Code Online (Sandbox Code Playgroud) 我使用了以下代码,但SQL中的DateTime字段表示为:
2005-04-08 00:00:00
Run Code Online (Sandbox Code Playgroud)
我也想要时间.我应该改变什么?
这是我的代码如下:
// Get the system date and time.
java.util.Date utilDate = new Date();
// Convert it to java.sql.Date
java.sql.Date date = new java.sql.Date(utilDate.getTime());
...
...
...
PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setDate(1, date);
Run Code Online (Sandbox Code Playgroud) 我正在尝试更改名为company的表,但它会显示错误
syntax error at or near "("
LINE 2: ADD( company_access_level short NOT NULL,
Run Code Online (Sandbox Code Playgroud)
我的语法是
ALTER TABLE company
ADD company_access_level short NOT NULL,
workgroup_level short NOT NULL,
Company Logon URL character varying NOT NULL,
Company Logoff URL character varying NOT NULL
Run Code Online (Sandbox Code Playgroud)
谢谢
我创建了一个名为"myTable"的表,其中一列名为CURRENT_DATE,其数据类型为"DATE".当我以编程方式更新我的表时,我还想在CURRENT_DATE字段中放置时间戳或系统日期.我正在做的一部分如下所示,但它不起作用.我认为这很容易,但是......你能帮忙吗?
//System date is captured for placement in the CURRENT_DATE field in myTable
java.util.Date currentDate = new java.util.Date();
...
stmt.executeQuery("INSERT INTO myTable (NAME, CURRENT_DATE) VALUES (' " + userName + " ', ' " + currentDate + " ') ");
Run Code Online (Sandbox Code Playgroud) 我正在使用postgres v8.3,它有一个columntype作为XML.DDL看起来像这样:
CREATE TABLE contact (
"ID" INTEGER NOT NULL ,
"NAME" VARCHAR NOT NULL,
"Details" XML , ......
Run Code Online (Sandbox Code Playgroud)
在映射hbm.xml文件中,我将其映射为:
<key-property name="Details" type="java.lang.String" >
<column name="Details" />
</key-property>
Run Code Online (Sandbox Code Playgroud)
我想这是错误的原因:没有Dialect映射的JDBC类型:1111当我运行一个选择查询时使用:
List<?> contactList= session.createSQLQuery("select * from contact where id=" + val.getId() + " and name= '" + val.getName + "'").list();
Run Code Online (Sandbox Code Playgroud)
但是我可以将"XML"类型映射到java数据类型的另一种方式是什么?
我想在linux中安装eclipse,是否可以在linux中安装没有jdk的eclipse.如何在linux中安装eclipse.我正在使用Federo 10.请给出建议.